| 19 | #include <unicode/uscript.h> |
| 20 | |
| 21 | static void TestScriptRun(std::span<const char16_t> testChars, std::span<const std::string_view> testResults) |
| 22 | { |
| 23 | icu::ScriptRun scriptRun(testChars.data(), 0, std::size(testChars)); |
| 24 | size_t i = 0; |
| 25 | |
| 26 | while (scriptRun.next()) { |
| 27 | int32_t start = scriptRun.getScriptStart(); |
| 28 | int32_t end = scriptRun.getScriptEnd(); |
| 29 | UScriptCode code = scriptRun.getScriptCode(); |
| 30 | |
| 31 | REQUIRE(i < std::size(testResults)); |
| 32 | CHECK(fmt::format("Script '{}' from {} to {}.", uscript_getName(code), start, end) == testResults[i]); |
| 33 | |
| 34 | ++i; |
| 35 | } |
| 36 | |
| 37 | REQUIRE(i == std::size(testResults)); |
| 38 | } |
| 39 | |
| 40 | TEST_CASE("ICU ScriptRun") |
| 41 | { |
no test coverage detected