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

Function TEST_F

eval/eval/function_step_test.cc:1084–1105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1082};
1083
1084TEST_F(DirectFunctionStepTest, SimpleCall) {
1085 cel::IntValue(1);
1086
1087 CallExpr call;
1088 call.set_function(cel::builtin::kAdd);
1089 call.mutable_args().emplace_back();
1090 call.mutable_args().emplace_back();
1091
1092 std::vector<std::unique_ptr<DirectExpressionStep>> deps;
1093 deps.push_back(CreateConstValueDirectStep(cel::IntValue(1)));
1094 deps.push_back(CreateConstValueDirectStep(cel::IntValue(1)));
1095
1096 auto expr = CreateDirectFunctionStep(-1, call, std::move(deps),
1097 GetOverloads(cel::builtin::kAdd, 2));
1098
1099 auto plan = CreateExpressionImpl(options_, std::move(expr));
1100
1101 Activation activation;
1102 ASSERT_OK_AND_ASSIGN(auto value, plan->Evaluate(activation, &arena_));
1103
1104 EXPECT_THAT(value, test::IsCelInt64(2));
1105}
1106
1107TEST_F(DirectFunctionStepTest, RecursiveCall) {
1108 cel::IntValue(1);

Callers

nothing calls this directly

Calls 8

CreateDirectFunctionStepFunction · 0.85
CreateExpressionImplFunction · 0.85
IsCelInt64Function · 0.85
IsCelErrorFunction · 0.85
set_functionMethod · 0.80
IntValueClass · 0.50
StringValueClass · 0.50

Tested by

no test coverage detected