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

Function TEST

testing/testrunner/runner_lib_test.cc:528–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526}
527
528TEST(TestRunnerStandaloneTest, RunTestFailsWhenNoExpressionSourceIsProvided) {
529 const std::string expected_error =
530 "INVALID_ARGUMENT: No expression source provided.";
531
532 EXPECT_FATAL_FAILURE(
533 {
534 // Create a runtime.
535 ASSERT_OK_AND_ASSIGN(std::unique_ptr<const cel::Runtime> runtime,
536 CreateTestRuntime());
537 TestCase test_case = ParseTextProtoOrDie<TestCase>(R"pb(
538 input {
539 key: "x"
540 value { value { int64_value: 10 } }
541 }
542 input {
543 key: "y"
544 value { value { int64_value: 3 } }
545 }
546 output { result_value { int64_value: 123 } }
547 )pb");
548 ASSERT_OK_AND_ASSIGN(std::unique_ptr<cel::Compiler> compiler,
549 CreateBasicCompiler());
550
551 // Create a TestRunner but without an expression source.
552 std::unique_ptr<CelTestContext> context =
553 CelTestContext::CreateFromRuntime(std::move(runtime));
554 context->SetCompiler(std::move(compiler));
555 TestRunner test_runner(std::move(context));
556 test_runner.RunTest(test_case);
557 },
558 expected_error);
559}
560
561TEST(TestRunnerStandaloneTest, BasicTestWithErrorAssertion) {
562 // Compile the expression.

Callers 1

TEST_PFunction · 0.70

Calls 15

CreateBasicCompilerFunction · 0.85
AstToCheckedExprFunction · 0.85
StandardCompilerLibraryFunction · 0.85
MakeVariableDeclFunction · 0.85
EnableCoverageInRuntimeFunction · 0.85
CountSubstringsFunction · 0.85
SetCompilerMethod · 0.80
RunTestMethod · 0.80
SetExpressionSourceMethod · 0.80
GetAstMethod · 0.80

Tested by

no test coverage detected