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

Method AssertValue

testing/testrunner/runner_lib.cc:300–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298} // namespace
299
300void TestRunner::AssertValue(const cel::Value& computed,
301 const TestOutput& output, google::protobuf::Arena* arena) {
302 if (computed.IsError()) {
303 ADD_FAILURE() << "Expected value but got error: " << computed.DebugString();
304 return;
305 }
306 ValueProto expected_value_proto;
307 const auto* descriptor_pool = GetDescriptorPool(*test_context_);
308 auto* message_factory = GetMessageFactory(*test_context_);
309 if (output.has_result_value()) {
310 expected_value_proto = output.result_value();
311 } else if (output.has_result_expr()) {
312 InputValue input_value;
313 input_value.set_expr(output.result_expr());
314 ASSERT_OK_AND_ASSIGN(cel::Value resolved_cel_value,
315 ResolveInputValue(input_value, *test_context_, arena));
316 ASSERT_OK_AND_ASSIGN(expected_value_proto,
317 ToExprValue(resolved_cel_value, descriptor_pool,
318 message_factory, arena));
319 }
320 ValueProto computed_expr_value;
321 ASSERT_OK_AND_ASSIGN(
322 computed_expr_value,
323 ToExprValue(computed, descriptor_pool, message_factory, arena));
324 EXPECT_THAT(computed_expr_value, MatchesValue(expected_value_proto));
325}
326
327void TestRunner::AssertError(const cel::Value& computed,
328 const TestOutput& output) {

Callers

nothing calls this directly

Calls 7

GetDescriptorPoolFunction · 0.85
GetMessageFactoryFunction · 0.85
ToExprValueFunction · 0.85
set_exprMethod · 0.80
ASSERT_OK_AND_ASSIGNFunction · 0.50
IsErrorMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected