MCPcopy Create free account
hub / github.com/Kitware/CMake / decode_good

Function decode_good

Tests/CMakeLib/testUTF8.cxx:78–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78static bool decode_good(test_utf8_entry const& entry)
79{
80 auto const& s = entry.str;
81 unsigned int uc;
82 if (char const* e =
83 cm_utf8_decode_character(s.data(), s.data() + s.size(), &uc)) {
84 int used = static_cast<int>(e - s.data());
85 if (uc != entry.chr) {
86 report_good(false, s);
87 printf("expected 0x%04X, got 0x%04X\n", entry.chr, uc);
88 return false;
89 }
90 if (used != int(s.size())) {
91 report_good(false, s);
92 printf("had %d bytes, used %d\n", int(s.size()), used);
93 return false;
94 }
95 report_good(true, s);
96 printf("got 0x%04X\n", uc);
97 return true;
98 }
99 report_good(false, s);
100 printf("failed\n");
101 return false;
102}
103
104static bool decode_bad(test_utf8_char s)
105{

Callers 1

testUTF8Function · 0.85

Calls 4

cm_utf8_decode_characterFunction · 0.85
report_goodFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…