| 121 | } |
| 122 | |
| 123 | ::testing::AssertionResult IsValidASCII(const std::string& s) { |
| 124 | if (ValidateAscii(reinterpret_cast<const uint8_t*>(s.data()), s.size())) { |
| 125 | return ::testing::AssertionSuccess(); |
| 126 | } else { |
| 127 | std::string h = HexEncode(reinterpret_cast<const uint8_t*>(s.data()), |
| 128 | static_cast<int32_t>(s.size())); |
| 129 | return ::testing::AssertionFailure() |
| 130 | << "string '" << h << "' didn't validate as ASCII"; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | ::testing::AssertionResult IsInvalidASCII(const std::string& s) { |
| 135 | if (!ValidateAscii(reinterpret_cast<const uint8_t*>(s.data()), s.size())) { |
no test coverage detected