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

Function TEST

compiler/compiler_library_subset_factory_test.cc:51–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51TEST(CompilerLibrarySubsetFactoryTest, MakeStdlibSubsetInclude) {
52 ASSERT_OK_AND_ASSIGN(
53 std::unique_ptr<CompilerBuilder> builder,
54 NewCompilerBuilder(internal::GetSharedTestingDescriptorPool()));
55 ASSERT_THAT(builder->AddLibrary(StandardCompilerLibrary()), IsOk());
56
57 ASSERT_THAT(
58 builder->AddLibrarySubset(MakeStdlibSubset(
59 {"exists", "all"},
60 {StandardOverloadIds::kAnd, StandardOverloadIds::kOr,
61 StandardOverloadIds::kNot, StandardOverloadIds::kNotStrictlyFalse,
62 StandardOverloadIds::kEquals, StandardOverloadIds::kNotEquals})),
63 IsOk());
64
65 ASSERT_OK_AND_ASSIGN(std::unique_ptr<Compiler> compiler, builder->Build());
66
67 EXPECT_THAT(
68 compiler->Compile(
69 "[1, 2, 3].exists(x, x != 1 || x == 2 && !(x == 4 || x == 5) )"),
70 IsValid());
71 EXPECT_THAT(compiler->Compile("1+2"), Not(IsValid()));
72 EXPECT_THAT(compiler->Compile("[1, 2, 3].map(x, x)"), Not(IsValid()));
73}
74
75TEST(CompilerLibrarySubsetFactoryTest, MakeStdlibSubsetExclude) {
76 ASSERT_OK_AND_ASSIGN(

Callers

nothing calls this directly

Calls 10

StandardCompilerLibraryFunction · 0.85
NewCompilerBuilderFunction · 0.70
MakeStdlibSubsetFunction · 0.70
ASSERT_OK_AND_ASSIGNFunction · 0.50
AddLibraryMethod · 0.45
AddLibrarySubsetMethod · 0.45
BuildMethod · 0.45
CompileMethod · 0.45

Tested by

no test coverage detected