MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / TestScriptRun

Function TestScriptRun

src/3rdparty/icu/tests/test_srtest.cpp:21–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#include <unicode/uscript.h>
20
21static 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
40TEST_CASE("ICU ScriptRun")
41{

Callers 1

test_srtest.cppFile · 0.85

Calls 7

getScriptStartMethod · 0.80
getScriptEndMethod · 0.80
getScriptCodeMethod · 0.80
sizeFunction · 0.50
formatFunction · 0.50
dataMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected