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

Function TEST_F

eval/eval/select_step_test.cc:316–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316TEST_F(SelectStepTest, MapPresenseIsErrorTest) {
317 TestMessage message;
318
319 Expr select_expr;
320 auto& select = select_expr.mutable_select_expr();
321 select.set_field("1");
322 select.set_test_only(true);
323 Expr& expr1 = select.mutable_operand();
324 auto& select_map = expr1.mutable_select_expr();
325 select_map.set_field("int32_int32_map");
326 Expr& expr0 = select_map.mutable_operand();
327 auto& ident = expr0.mutable_ident_expr();
328 ident.set_name("target");
329
330 ASSERT_OK_AND_ASSIGN(auto step0, CreateIdentStep(ident.name(), expr0.id()));
331 ASSERT_OK_AND_ASSIGN(
332 auto step1,
333 CreateSelectStep(select_map, expr1.id(),
334 /*enable_wrapper_type_null_unboxing=*/false));
335 ASSERT_OK_AND_ASSIGN(
336 auto step2,
337 CreateSelectStep(select, select_expr.id(),
338 /*enable_wrapper_type_null_unboxing=*/false));
339
340 ExecutionPath path;
341 path.push_back(std::move(step0));
342 path.push_back(std::move(step1));
343 path.push_back(std::move(step2));
344 CelExpressionFlatImpl cel_expr(
345 env_, FlatExpression(std::move(path), /*comprehension_slot_count=*/0,
346 env_->type_registry.GetComposedTypeProvider(),
347 cel::RuntimeOptions{}));
348 Activation activation;
349 activation.InsertValue("target",
350 CelProtoWrapper::CreateMessage(&message, &arena_));
351
352 ASSERT_OK_AND_ASSIGN(CelValue result, cel_expr.Evaluate(activation, &arena_));
353 EXPECT_TRUE(result.IsError());
354 EXPECT_EQ(result.ErrorOrDie()->code(), absl::StatusCode::kInvalidArgument);
355}
356
357TEST_F(SelectStepTest, MapPresenseIsTrueWithUnknownTest) {
358 UnknownSet unknown_set;

Calls 15

FlatExpressionClass · 0.85
CreateContainerBackedMapFunction · 0.85
CreateIdentStepFunction · 0.85
CreateSelectStepFunction · 0.85
CreateDirectSelectStepFunction · 0.85
CreateDirectIdentStepFunction · 0.85
OfFunction · 0.85
IntValueIsFunction · 0.85
AttributePatternClass · 0.85
ErrorValueFunction · 0.85

Tested by

no test coverage detected