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

Function TEST

eval/eval/evaluator_stack_test.cc:12–32  ·  view source on GitHub ↗

Test Value Stack Push/Pop operation

Source from the content-addressed store, hash-verified

10
11// Test Value Stack Push/Pop operation
12TEST(EvaluatorStackTest, StackPushPop) {
13 cel::Attribute attribute("name", {});
14 EvaluatorStack stack(10);
15 stack.Push(cel::IntValue(1));
16 stack.Push(cel::IntValue(2), AttributeTrail());
17 stack.Push(cel::IntValue(3), AttributeTrail("name"));
18
19 ASSERT_EQ(stack.Peek().GetInt().NativeValue(), 3);
20 ASSERT_FALSE(stack.PeekAttribute().empty());
21 ASSERT_EQ(stack.PeekAttribute().attribute(), attribute);
22
23 stack.Pop(1);
24
25 ASSERT_EQ(stack.Peek().GetInt().NativeValue(), 2);
26 ASSERT_TRUE(stack.PeekAttribute().empty());
27
28 stack.Pop(1);
29
30 ASSERT_EQ(stack.Peek().GetInt().NativeValue(), 1);
31 ASSERT_TRUE(stack.PeekAttribute().empty());
32}
33
34// Test that inner stacks within value stack retain the equality of their sizes.
35TEST(EvaluatorStackTest, StackBalanced) {

Callers

nothing calls this directly

Calls 13

AttributeTrailClass · 0.85
attributeMethod · 0.80
attribute_sizeMethod · 0.80
PopAndPushMethod · 0.80
IntValueClass · 0.50
PushMethod · 0.45
NativeValueMethod · 0.45
GetIntMethod · 0.45
PeekMethod · 0.45
emptyMethod · 0.45
PopMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected