| 111 | } |
| 112 | |
| 113 | ::testing::AssertionResult IsInvalidUTF8(const std::string& s) { |
| 114 | if (!ValidateUTF8(reinterpret_cast<const uint8_t*>(s.data()), s.size())) { |
| 115 | return ::testing::AssertionSuccess(); |
| 116 | } else { |
| 117 | std::string h = HexEncode(reinterpret_cast<const uint8_t*>(s.data()), |
| 118 | static_cast<int32_t>(s.size())); |
| 119 | return ::testing::AssertionFailure() << "string '" << h << "' validated as UTF8"; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | ::testing::AssertionResult IsValidASCII(const std::string& s) { |
| 124 | if (ValidateAscii(reinterpret_cast<const uint8_t*>(s.data()), s.size())) { |
no test coverage detected