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

Function TEST_P

eval/eval/function_step_test.cc:258–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256};
257
258TEST_P(FunctionStepTest, SimpleFunctionTest) {
259 ExecutionPath path;
260
261 CelFunctionRegistry registry;
262 AddDefaults(registry);
263
264 CallExpr call1 = ConstFunction::MakeCall("Const3");
265 CallExpr call2 = ConstFunction::MakeCall("Const2");
266 CallExpr add_call = AddFunction::MakeCall();
267
268 ASSERT_OK_AND_ASSIGN(auto step0, MakeTestFunctionStep(call1, registry));
269 ASSERT_OK_AND_ASSIGN(auto step1, MakeTestFunctionStep(call2, registry));
270 ASSERT_OK_AND_ASSIGN(auto step2, MakeTestFunctionStep(add_call, registry));
271
272 path.push_back(std::move(step0));
273 path.push_back(std::move(step1));
274 path.push_back(std::move(step2));
275
276 std::unique_ptr<CelExpressionFlatImpl> impl = GetExpression(std::move(path));
277
278 Activation activation;
279 google::protobuf::Arena arena;
280
281 ASSERT_OK_AND_ASSIGN(CelValue value, impl->Evaluate(activation, &arena));
282 ASSERT_TRUE(value.IsInt64());
283 EXPECT_THAT(value.Int64OrDie(), Eq(5));
284}
285
286TEST_P(FunctionStepTest, TestStackUnderflow) {
287 ExecutionPath path;

Callers

nothing calls this directly

Calls 15

AddDefaultsFunction · 0.85
CreateDescriptorFunction · 0.85
IsInt64Method · 0.80
Int64OrDieMethod · 0.80
ErrorOrDieMethod · 0.80
set_functionMethod · 0.80
BoolOrDieMethod · 0.80
IsUnknownSetMethod · 0.80
InsertValueMethod · 0.80
ExprClass · 0.50

Tested by

no test coverage detected