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

Function TEST

extensions/strings_test.cc:63–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61using ::testing::ValuesIn;
62
63TEST(StringsCheckerLibrary, SmokeTest) {
64 ASSERT_OK_AND_ASSIGN(
65 auto builder, NewCompilerBuilder(internal::GetTestingDescriptorPool()));
66 ASSERT_THAT(builder->AddLibrary(StringsCheckerLibrary()), IsOk());
67 ASSERT_THAT(builder->AddLibrary(StandardCheckerLibrary()), IsOk());
68 ASSERT_THAT(builder->GetCheckerBuilder().AddVariable(
69 MakeVariableDecl("foo", StringType())),
70 IsOk());
71
72 ASSERT_OK_AND_ASSIGN(auto compiler, std::move(*builder).Build());
73
74 ASSERT_OK_AND_ASSIGN(
75 ValidationResult result,
76 compiler->Compile("foo.replace('he', 'we', 1) == 'wello hello'"));
77 ASSERT_TRUE(result.IsValid());
78
79 EXPECT_EQ(test::FormatBaselineAst(*result.GetAst()),
80 R"(_==_(
81 foo~string^foo.replace(
82 "he"~string,
83 "we"~string,
84 1~int
85 )~string^string_replace_string_string_int,
86 "wello hello"~string
87)~bool^equals)");
88}
89
90TEST(StringsExtTest, MaxPrecisionOption) {
91 StringsExtensionOptions extension_options;

Callers

nothing calls this directly

Calls 15

StandardCheckerLibraryFunction · 0.85
MakeVariableDeclFunction · 0.85
FormatBaselineAstFunction · 0.85
StandardCompilerLibraryFunction · 0.85
StringsCompilerLibraryFunction · 0.85
RegisterStringsFunctionsFunction · 0.85
AddVariableMethod · 0.80
IsValidMethod · 0.80
GetAstMethod · 0.80
ReleaseAstMethod · 0.80
StringsCheckerLibraryFunction · 0.70
StringTypeClass · 0.50

Tested by

no test coverage detected