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

Function RunCreateMapExpression

eval/eval/create_map_step_test.cc:125–147  ·  view source on GitHub ↗

Helper method. Creates simple pipeline containing CreateStruct step that builds Map and runs it. Equivalent to {key0: value0, ...}

Source from the content-addressed store, hash-verified

123// builds Map and runs it.
124// Equivalent to {key0: value0, ...}
125absl::StatusOr<CelValue> RunCreateMapExpression(
126 const absl_nonnull std::shared_ptr<const RuntimeEnv>& env,
127 const std::vector<std::pair<CelValue, CelValue>>& values,
128 google::protobuf::Arena* arena, bool enable_unknowns, bool enable_recursive_program) {
129 Activation activation;
130
131 ExecutionPath path;
132 if (enable_recursive_program) {
133 CEL_ASSIGN_OR_RETURN(path, CreateRecursiveProgram(values, activation));
134 } else {
135 CEL_ASSIGN_OR_RETURN(path, CreateStackMachineProgram(values, activation));
136 }
137 cel::RuntimeOptions options;
138 if (enable_unknowns) {
139 options.unknown_processing = cel::UnknownProcessingOptions::kAttributeOnly;
140 }
141
142 CelExpressionFlatImpl cel_expr(
143 env,
144 FlatExpression(std::move(path), /*comprehension_slot_count=*/0,
145 env->type_registry.GetComposedTypeProvider(), options));
146 return cel_expr.Evaluate(activation, arena);
147}
148
149class CreateMapStepTest
150 : public testing::TestWithParam<std::tuple<bool, bool>> {

Callers 1

RunMapExpressionMethod · 0.85

Calls 5

CreateRecursiveProgramFunction · 0.85
FlatExpressionClass · 0.85
CEL_ASSIGN_OR_RETURNFunction · 0.70
EvaluateMethod · 0.45

Tested by

no test coverage detected