MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

valdi_protobuf/test/FieldMap_tests.cpp:9–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace {
8
9TEST(FieldMap, canInsertInVec) {
10 auto str = StaticString::makeUTF8("Hello World!");
11 Protobuf::FieldMap fieldMap;
12 fieldMap[2] = Protobuf::Field::string(str);
13 fieldMap[7].setFloat(42.0f);
14 fieldMap[12].setInt32(1000);
15
16 ASSERT_FALSE(fieldMap.isUsingMap());
17
18 auto entries = fieldMap.getEntries();
19 ASSERT_EQ(static_cast<size_t>(3), entries.size());
20
21 ASSERT_EQ(static_cast<size_t>(2), entries[0].number);
22 ASSERT_EQ(str.get(), entries[0].value->getString());
23 ASSERT_EQ(static_cast<size_t>(7), entries[1].number);
24 ASSERT_EQ(42.0f, entries[1].value->getFloat());
25 ASSERT_EQ(static_cast<size_t>(12), entries[2].number);
26 ASSERT_EQ(1000, entries[2].value->getInt32());
27}
28
29TEST(FieldMap, canFindInVec) {
30 auto str = StaticString::makeUTF8("Hello World!");

Callers

nothing calls this directly

Calls 12

setFloatMethod · 0.80
setInt32Method · 0.80
isUsingMapMethod · 0.80
getInt32Method · 0.80
use_countMethod · 0.80
getMethod · 0.65
getStringMethod · 0.65
clearMethod · 0.65
getEntriesMethod · 0.45
sizeMethod · 0.45
getFloatMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected