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

Function TEST

eval/public/containers/field_backed_map_impl_test.cc:32–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32TEST(FieldBackedMapImplTest, BadKeyTypeTest) {
33 TestMessage message;
34 google::protobuf::Arena arena;
35 constexpr std::array<absl::string_view, 6> map_types = {
36 "int64_int32_map", "uint64_int32_map", "string_int32_map",
37 "bool_int32_map", "int32_int32_map", "uint32_uint32_map",
38 };
39
40 for (auto map_type : map_types) {
41 auto cel_map = CreateMap(&message, std::string(map_type), &arena);
42 // Look up a boolean key. This should result in an error for both the
43 // presence test and the value lookup.
44 auto result = cel_map->Has(CelValue::CreateNull());
45 EXPECT_FALSE(result.ok());
46 EXPECT_THAT(result.status().code(), Eq(absl::StatusCode::kInvalidArgument));
47
48 EXPECT_FALSE(result.ok());
49 EXPECT_THAT(result.status().code(), Eq(absl::StatusCode::kInvalidArgument));
50
51 auto lookup = (*cel_map)[CelValue::CreateNull()];
52 EXPECT_TRUE(lookup.has_value());
53 EXPECT_TRUE(lookup->IsError());
54 EXPECT_THAT(lookup->ErrorOrDie()->code(),
55 Eq(absl::StatusCode::kInvalidArgument));
56 }
57}
58
59TEST(FieldBackedMapImplTest, Int32KeyTest) {
60 TestMessage message;

Callers

nothing calls this directly

Calls 13

codeMethod · 0.80
ErrorOrDieMethod · 0.80
Int64OrDieMethod · 0.80
Uint64OrDieMethod · 0.80
StringOrDieMethod · 0.80
CreateMapFunction · 0.70
HasMethod · 0.45
okMethod · 0.45
has_valueMethod · 0.45
IsErrorMethod · 0.45
sizeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected