| 298 | } // namespace |
| 299 | |
| 300 | void 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 | |
| 327 | void TestRunner::AssertError(const cel::Value& computed, |
| 328 | const TestOutput& output) { |
nothing calls this directly
no test coverage detected