This is not a proper microbenchmark, but is used to check for major regressions in the ANTLR generated code or concurrency issues. Each benchmark iteration parses all of the basic test cases from the unit-tests.
| 261 | // regressions in the ANTLR generated code or concurrency issues. Each benchmark |
| 262 | // iteration parses all of the basic test cases from the unit-tests. |
| 263 | void BM_Parse(benchmark::State& state) { |
| 264 | std::vector<Macro> macros = Macro::AllMacros(); |
| 265 | macros.push_back(cel::OptMapMacro()); |
| 266 | macros.push_back(cel::OptFlatMapMacro()); |
| 267 | ParserOptions options; |
| 268 | options.enable_optional_syntax = true; |
| 269 | options.enable_quoted_identifiers = true; |
| 270 | for (auto s : state) { |
| 271 | for (const auto& test_case : GetTestCases()) { |
| 272 | auto result = ParseWithMacros(test_case.expr, macros, "<input>", options); |
| 273 | ABSL_DCHECK_EQ(result.ok(), test_case.result == ParseResult::kSuccess); |
| 274 | benchmark::DoNotOptimize(result); |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | BENCHMARK(BM_Parse)->ThreadRange(1, std::thread::hardware_concurrency()); |
| 280 |
nothing calls this directly
no test coverage detected