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

Function InitSimpleTree

eval/compiler/flat_expr_builder_extensions_test.cc:94–114  ·  view source on GitHub ↗

simulate a program of: a / \ // b c

Source from the content-addressed store, hash-verified

92// / \
93// b c
94absl::StatusOr<SimpleTreeSteps> InitSimpleTree(
95 const Expr& a, const Expr& b, const Expr& c,
96 ProgramBuilder& program_builder) {
97 CEL_ASSIGN_OR_RETURN(auto a_step, CreateConstValueStep(cel::NullValue(), -1));
98 CEL_ASSIGN_OR_RETURN(auto b_step, CreateConstValueStep(cel::NullValue(), -1));
99 CEL_ASSIGN_OR_RETURN(auto c_step, CreateConstValueStep(cel::NullValue(), -1));
100
101 SimpleTreeSteps result{a_step.get(), b_step.get(), c_step.get()};
102
103 program_builder.EnterSubexpression(&a);
104 program_builder.EnterSubexpression(&b);
105 program_builder.AddStep(std::move(b_step));
106 program_builder.ExitSubexpression(&b);
107 program_builder.EnterSubexpression(&c);
108 program_builder.AddStep(std::move(c_step));
109 program_builder.ExitSubexpression(&c);
110 program_builder.AddStep(std::move(a_step));
111 program_builder.ExitSubexpression(&a);
112
113 return result;
114}
115
116TEST_F(PlannerContextTest, GetPlan) {
117 Expr a;

Callers 1

TEST_FFunction · 0.85

Calls 2

getMethod · 0.45
AddStepMethod · 0.45

Tested by

no test coverage detected