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

Function TEST

eval/public/activation_test.cc:54–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52};
53
54TEST(ActivationTest, CheckValueInsertFindAndRemove) {
55 Activation activation;
56
57 Arena arena;
58
59 activation.InsertValue("value42", CelValue::CreateInt64(42));
60
61 // Test getting unbound value
62 EXPECT_FALSE(activation.FindValue("value43", &arena));
63
64 // Test getting bound value
65 EXPECT_TRUE(activation.FindValue("value42", &arena));
66
67 CelValue value = activation.FindValue("value42", &arena).value();
68
69 // Test value is correct.
70 EXPECT_THAT(value.Int64OrDie(), Eq(42));
71
72 // Test removing unbound value
73 EXPECT_FALSE(activation.RemoveValueEntry("value43"));
74
75 // Test removing bound value
76 EXPECT_TRUE(activation.RemoveValueEntry("value42"));
77
78 // Now the value is unbound
79 EXPECT_FALSE(activation.FindValue("value42", &arena));
80}
81
82TEST(ActivationTest, CheckValueProducerInsertFindAndRemove) {
83 const std::string kValue = "42";

Callers

nothing calls this directly

Calls 15

InsertValueMethod · 0.80
FindValueMethod · 0.80
Int64OrDieMethod · 0.80
RemoveValueEntryMethod · 0.80
InsertValueProducerMethod · 0.80
StringOrDieMethod · 0.80
RemoveFunctionEntriesMethod · 0.80
ClearValueEntryMethod · 0.80
ClearCachedValuesMethod · 0.80
set_fieldMethod · 0.80

Tested by

no test coverage detected