MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / TEST_P

Function TEST_P

extensions/bindings_ext_benchmark_test.cc:151–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149};
150
151TEST_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
178void RunBenchmark(const BenchmarkCase& benchmark, benchmark::State& state) {
179 std::vector<Macro> all_macros = Macro::AllMacros();

Callers

nothing calls this directly

Calls 7

AllMacrosFunction · 0.85
bindings_macrosFunction · 0.85
RegisterBuiltinFunctionsFunction · 0.85
GetRegistryMethod · 0.80
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected