| 149 | }; |
| 150 | |
| 151 | TEST_P(BindingsBenchmarkTest, CheckBenchmarkCaseWorks) { |
| 152 | const BenchmarkCase& benchmark = GetParam(); |
| 153 | |
| 154 | std::vector<Macro> all_macros = Macro::AllMacros(); |
| 155 | std::vector<Macro> bindings_macros = cel::extensions::bindings_macros(); |
| 156 | all_macros.insert(all_macros.end(), bindings_macros.begin(), |
| 157 | bindings_macros.end()); |
| 158 | ASSERT_OK_AND_ASSIGN( |
| 159 | auto expr, ParseWithMacros(benchmark.expression, all_macros, "<input>")); |
| 160 | |
| 161 | InterpreterOptions options; |
| 162 | auto builder = |
| 163 | google::api::expr::runtime::CreateCelExpressionBuilder(options); |
| 164 | |
| 165 | ASSERT_OK(google::api::expr::runtime::RegisterBuiltinFunctions( |
| 166 | builder->GetRegistry())); |
| 167 | |
| 168 | ASSERT_OK_AND_ASSIGN(auto program, builder->CreateExpression( |
| 169 | &expr.expr(), &expr.source_info())); |
| 170 | |
| 171 | Activation activation; |
| 172 | google::protobuf::Arena arena; |
| 173 | ASSERT_OK_AND_ASSIGN(CelValue result, program->Evaluate(activation, &arena)); |
| 174 | |
| 175 | EXPECT_THAT(result, benchmark.matcher); |
| 176 | } |
| 177 | |
| 178 | void RunBenchmark(const BenchmarkCase& benchmark, benchmark::State& state) { |
| 179 | std::vector<Macro> all_macros = Macro::AllMacros(); |
nothing calls this directly
no test coverage detected