Helper method. Creates simple pipeline containing CreateStruct step that builds Map and runs it. Equivalent to {key0: value0, ...}
| 123 | // builds Map and runs it. |
| 124 | // Equivalent to {key0: value0, ...} |
| 125 | absl::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 | |
| 149 | class CreateMapStepTest |
| 150 | : public testing::TestWithParam<std::tuple<bool, bool>> { |
no test coverage detected