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

Function TEST

eval/eval/equality_steps_test.cc:84–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82};
83
84TEST(RecursiveTest, PartialAttrUnknown) {
85 cel::Activation activation;
86 google::protobuf::Arena arena;
87 cel::RuntimeOptions opts;
88 opts.unknown_processing = cel::UnknownProcessingOptions::kAttributeOnly;
89 cel::runtime_internal::RuntimeTypeProvider type_provider(
90 cel::internal::GetTestingDescriptorPool());
91
92 // A little contrived for simplicity, but this is for cases where e.g.
93 // `msg == Msg{}` but msg.foo is unknown.
94 auto plan = CreateDirectEqualityStep(
95 std::make_unique<ValueStep>(IntValue(1), cel::Attribute("foo")),
96 std::make_unique<ValueStep>(IntValue(2)), false, -1);
97
98 activation.SetUnknownPatterns({cel::AttributePattern(
99 "foo", {cel::AttributeQualifierPattern::OfString("bar")})});
100
101 ExecutionFrameBase frame(activation, opts, type_provider,
102 cel::internal::GetTestingDescriptorPool(),
103 cel::internal::GetTestingMessageFactory(), &arena);
104
105 cel::Value result;
106 AttributeTrail attribute_trail;
107 ASSERT_THAT(plan->Evaluate(frame, result, attribute_trail), IsOk());
108
109 EXPECT_THAT(result, ValueKindIs(ValueKind::kUnknown));
110}
111
112TEST(RecursiveTest, PartialAttrUnknownDisabled) {
113 cel::Activation activation;

Callers

nothing calls this directly

Calls 8

CreateDirectEqualityStepFunction · 0.85
AttributeClass · 0.85
AttributePatternClass · 0.85
BoolValueIsFunction · 0.85
CreateEqualityStepFunction · 0.85
SetUnknownPatternsMethod · 0.80
IntValueClass · 0.50
EvaluateMethod · 0.45

Tested by

no test coverage detected