| 80 | } |
| 81 | |
| 82 | static void BenchmarkASCIIValidation( |
| 83 | benchmark::State& state, // NOLINT non-const reference |
| 84 | const std::string& s, bool expected) { |
| 85 | auto data = reinterpret_cast<const uint8_t*>(s.data()); |
| 86 | auto data_size = static_cast<int64_t>(s.size()); |
| 87 | |
| 88 | bool b = ValidateAsciiNoInline(data, data_size); |
| 89 | if (b != expected) { |
| 90 | std::cerr << "Unexpected validation result" << std::endl; |
| 91 | std::abort(); |
| 92 | } |
| 93 | |
| 94 | while (state.KeepRunning()) { |
| 95 | bool b = ValidateAsciiNoInline(data, data_size); |
| 96 | benchmark::DoNotOptimize(b); |
| 97 | } |
| 98 | state.SetBytesProcessed(state.iterations() * s.size()); |
| 99 | } |
| 100 | |
| 101 | static void ValidateTinyAscii(benchmark::State& state) { // NOLINT non-const reference |
| 102 | BenchmarkASCIIValidation(state, tiny_valid_ascii, true); |
no test coverage detected