| 256 | }; |
| 257 | |
| 258 | TEST_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 | |
| 286 | TEST_P(FunctionStepTest, TestStackUnderflow) { |
| 287 | ExecutionPath path; |
nothing calls this directly
no test coverage detected