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

Function ABSL_FLAG

conformance/run.cc:65–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63ABSL_FLAG(std::vector<std::string>, skip_tests, {}, "Tests to skip");
64ABSL_FLAG(bool, dashboard, false, "Dashboard mode, ignore test failures");
65ABSL_FLAG(bool, skip_check, true, "Skip type checking the expressions");
66ABSL_FLAG(bool, select_optimization, false, "Enable select optimization.");
67
68namespace {
69
70using ::testing::IsEmpty;
71
72using cel::expr::conformance::test::SimpleTest;
73using cel::expr::conformance::test::SimpleTestFile;
74using google::api::expr::conformance::v1alpha1::CheckRequest;
75using google::api::expr::conformance::v1alpha1::CheckResponse;
76using google::api::expr::conformance::v1alpha1::EvalRequest;
77using google::api::expr::conformance::v1alpha1::EvalResponse;
78using google::api::expr::conformance::v1alpha1::ParseRequest;
79using google::api::expr::conformance::v1alpha1::ParseResponse;
80
81google::rpc::Code ToGrpcCode(absl::StatusCode code) {
82 return static_cast<google::rpc::Code>(code);
83}
84
85bool ShouldSkipTest(absl::Span<const std::string> tests_to_skip,
86 absl::string_view name) {
87 for (absl::string_view test_to_skip : tests_to_skip) {
88 auto consumed_name = name;
89 if (absl::ConsumePrefix(&consumed_name, test_to_skip) &&
90 (consumed_name.empty() || absl::StartsWith(consumed_name, "/"))) {
91 return true;
92 }
93 }
94 return false;
95}
96
97SimpleTest DefaultTestMatcherToTrueIfUnset(const SimpleTest& test) {
98 auto test_copy = test;
99 if (test_copy.result_matcher_case() == SimpleTest::RESULT_MATCHER_NOT_SET) {
100 test_copy.mutable_value()->set_bool_value(true);
101 }
102 return test_copy;
103}
104
105class ConformanceTest : public testing::Test {
106 public:
107 explicit ConformanceTest(
108 std::shared_ptr<cel_conformance::ConformanceServiceInterface> service,
109 const SimpleTest& test, bool skip)
110 : service_(std::move(service)),
111 test_(DefaultTestMatcherToTrueIfUnset(test)),
112 skip_(skip) {}
113
114 void TestBody() override {
115 if (skip_) {
116 GTEST_SKIP();
117 }
118 ParseRequest parse_request;
119 parse_request.set_cel_source(test_.expr());
120 parse_request.set_source_location(test_.name());
121 parse_request.set_disable_macros(test_.disable_macros());
122 ParseResponse parse_response;

Callers 2

run.ccFile · 0.70
cel_cc_embed.ccFile · 0.50

Calls 15

TestBodyFunction · 0.85
ToGrpcCodeFunction · 0.85
mutable_valueMethod · 0.80
has_resultMethod · 0.80
issuesMethod · 0.80
messageMethod · 0.80
codeMethod · 0.80
has_errorMethod · 0.80
nameFunction · 0.50
emptyMethod · 0.45
exprMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected