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

Function TEST_P

extensions/regex_ext_test.cc:409–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409TEST_P(RegexExtTest, RegexExtTests) {
410 const RegexExtTestCase& test_case = GetParam();
411 auto result = TestEvaluate(test_case.expr);
412
413 switch (test_case.evaluation_type) {
414 case EvaluationType::kRuntimeError:
415 EXPECT_THAT(result, IsOkAndHolds(ErrorValueIs(
416 StatusIs(absl::StatusCode::kInvalidArgument,
417 HasSubstr(test_case.expected_result)))))
418 << "Expression: " << test_case.expr;
419 break;
420 case EvaluationType::kUnknownStaticError:
421 EXPECT_THAT(result, IsOkAndHolds(ErrorValueIs(
422 StatusIs(absl::StatusCode::kUnknown,
423 HasSubstr(test_case.expected_result)))))
424 << "Expression: " << test_case.expr;
425 break;
426 case EvaluationType::kInvalidArgStaticError:
427 EXPECT_THAT(result, StatusIs(absl::StatusCode::kInvalidArgument,
428 HasSubstr(test_case.expected_result)))
429 << "Expression: " << test_case.expr;
430 break;
431 case EvaluationType::kOptionalNone:
432 EXPECT_THAT(result, IsOkAndHolds(OptionalValueIsEmpty()))
433 << "Expression: " << test_case.expr;
434 break;
435 case EvaluationType::kOptionalValue:
436 EXPECT_THAT(result, IsOkAndHolds(OptionalValueIs(
437 StringValueIs(test_case.expected_result))))
438 << "Expression: " << test_case.expr;
439 break;
440 case EvaluationType::kBoolTrue:
441 EXPECT_THAT(result, IsOkAndHolds(BoolValueIs(true)))
442 << "Expression: " << test_case.expr;
443 break;
444 }
445}
446
447INSTANTIATE_TEST_SUITE_P(RegexExtTest, RegexExtTest,
448 ValuesIn(regexTestCases()));

Callers

nothing calls this directly

Calls 11

ErrorValueIsFunction · 0.85
OptionalValueIsEmptyFunction · 0.85
OptionalValueIsFunction · 0.85
StringValueIsFunction · 0.85
BoolValueIsFunction · 0.85
RegexExtValidatorFunction · 0.85
IsValidMethod · 0.80
FormatErrorMethod · 0.80
AddValidationMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected