| 84 | using ParamType = std::tuple<TestCase, Options>; |
| 85 | |
| 86 | absl::StatusOr<std::unique_ptr<Compiler>> CreateCompiler() { |
| 87 | google::protobuf::LinkMessageReflection<cel::expr::conformance::proto3::TestAllTypes>(); |
| 88 | google::protobuf::LinkMessageReflection< |
| 89 | cel::expr::conformance::proto3::NestedTestAllTypes>(); |
| 90 | |
| 91 | CEL_ASSIGN_OR_RETURN( |
| 92 | std::unique_ptr<CompilerBuilder> b, |
| 93 | NewCompilerBuilder(google::protobuf::DescriptorPool::generated_pool())); |
| 94 | CEL_RETURN_IF_ERROR(b->AddLibrary(StandardCompilerLibrary())); |
| 95 | CEL_RETURN_IF_ERROR(b->AddLibrary(OptionalCompilerLibrary())); |
| 96 | b->GetCheckerBuilder().set_container("cel.expr.conformance.proto3"); |
| 97 | auto& cb = b->GetCheckerBuilder(); |
| 98 | CEL_RETURN_IF_ERROR(cb.AddVariable(MakeVariableDecl("bool_var", BoolType()))); |
| 99 | CEL_RETURN_IF_ERROR( |
| 100 | cb.AddVariable(MakeVariableDecl("string_var", StringType()))); |
| 101 | CEL_RETURN_IF_ERROR( |
| 102 | cb.AddVariable(MakeVariableDecl("condition", BoolType()))); |
| 103 | CEL_RETURN_IF_ERROR(cb.AddVariable(MakeVariableDecl( |
| 104 | "nested_test_all_types", MessageType(NestedTestAllTypes::descriptor())))); |
| 105 | |
| 106 | CEL_RETURN_IF_ERROR(cb.AddFunction( |
| 107 | MakeFunctionDecl("IsPrivate", MakeOverloadDecl("IsPrivate_string", |
| 108 | BoolType(), StringType())) |
| 109 | .value())); |
| 110 | CEL_RETURN_IF_ERROR(cb.AddFunction( |
| 111 | MakeFunctionDecl( |
| 112 | "net.IsPrivate", |
| 113 | MakeOverloadDecl("net_IsPrivate_string", BoolType(), StringType())) |
| 114 | .value())); |
| 115 | |
| 116 | return b->Build(); |
| 117 | } |
| 118 | |
| 119 | const Compiler& GetCompiler() { |
| 120 | static const Compiler* compiler = []() { |
no test coverage detected