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

Function TEST

eval/eval/create_list_step_test.cc:159–182  ·  view source on GitHub ↗

Tests error when not enough list elements are on the stack during list creation.

Source from the content-addressed store, hash-verified

157// Tests error when not enough list elements are on the stack during list
158// creation.
159TEST(CreateListStepTest, TestCreateListStackUnderflow) {
160 ExecutionPath path;
161 Expr dummy_expr;
162
163 auto& create_list = dummy_expr.mutable_list_expr();
164 auto& expr0 = create_list.mutable_elements().emplace_back().mutable_expr();
165 expr0.mutable_const_expr().set_int64_value(1);
166
167 ASSERT_OK_AND_ASSIGN(auto step0,
168 CreateCreateListStep(create_list, dummy_expr.id()));
169 path.push_back(std::move(step0));
170
171 auto env = NewTestingRuntimeEnv();
172 CelExpressionFlatImpl cel_expr(
173 env, FlatExpression(std::move(path), /*comprehension_slot_count=*/0,
174 env->type_registry.GetComposedTypeProvider(),
175 cel::RuntimeOptions{}));
176 Activation activation;
177
178 google::protobuf::Arena arena;
179
180 auto status = cel_expr.Evaluate(activation, &arena);
181 ASSERT_THAT(status, Not(IsOk()));
182}
183
184TEST_P(CreateListStepTest, CreateListEmpty) {
185 ASSERT_OK_AND_ASSIGN(CelValue result,

Callers

nothing calls this directly

Calls 15

FlatExpressionClass · 0.85
CreateDirectListStepFunction · 0.85
ErrorValueFunction · 0.85
AttributeClass · 0.85
UnknownAttrNamesFunction · 0.85
AttributePatternClass · 0.85
OfFunction · 0.85
IntValueIsFunction · 0.85
IsUnknownSetMethod · 0.80
UnknownSetOrDieMethod · 0.80
SetMissingPatternsMethod · 0.80

Tested by

no test coverage detected