MCPcopy Create free account
hub / github.com/apache/arrow / IsValidUTF8

Function IsValidUTF8

cpp/src/arrow/util/utf8_util_test.cc:102–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100class ASCIIValidationTest : public UTF8Test {};
101
102::testing::AssertionResult IsValidUTF8(const std::string& s) {
103 if (ValidateUTF8(reinterpret_cast<const uint8_t*>(s.data()), s.size())) {
104 return ::testing::AssertionSuccess();
105 } else {
106 std::string h = HexEncode(reinterpret_cast<const uint8_t*>(s.data()),
107 static_cast<int32_t>(s.size()));
108 return ::testing::AssertionFailure()
109 << "string '" << h << "' didn't validate as UTF8";
110 }
111}
112
113::testing::AssertionResult IsInvalidUTF8(const std::string& s) {
114 if (!ValidateUTF8(reinterpret_cast<const uint8_t*>(s.data()), s.size())) {

Callers 1

AssertValidUTF8Function · 0.85

Calls 4

HexEncodeFunction · 0.85
ValidateUTF8Function · 0.70
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected