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

Function MakeDefaultCompilerBuilder

codelab/cel_compiler_test.cc:61–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59using ::testing::HasSubstr;
60
61std::unique_ptr<cel::CompilerBuilder> MakeDefaultCompilerBuilder() {
62 google::protobuf::LinkMessageReflection<AttributeContext>();
63 auto builder =
64 cel::NewCompilerBuilder(google::protobuf::DescriptorPool::generated_pool());
65 ABSL_CHECK_OK(builder.status());
66
67 ABSL_CHECK_OK((*builder)->AddLibrary(cel::StandardCompilerLibrary()));
68 ABSL_CHECK_OK((*builder)->GetCheckerBuilder().AddContextDeclaration(
69 "google.rpc.context.AttributeContext"));
70
71 return std::move(builder).value();
72}
73
74TEST(DefaultCompiler, Basic) {
75 ASSERT_OK_AND_ASSIGN(auto compiler, MakeDefaultCompilerBuilder()->Build());

Callers 1

TESTFunction · 0.85

Calls 5

StandardCompilerLibraryFunction · 0.85
AddContextDeclarationMethod · 0.80
NewCompilerBuilderFunction · 0.50
AddLibraryMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected