MCPcopy Create free account
hub / github.com/bytedance/bolt / TEST

Function TEST

bolt/common/caching/tests/StringIdMapTest.cpp:36–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34using namespace bytedance::bolt;
35
36TEST(StringIdMapTest, basic) {
37 constexpr const char* kFile1 = "file_1";
38 StringIdMap map;
39 uint64_t id = 0;
40 {
41 StringIdLease lease1;
42 EXPECT_FALSE(lease1.hasValue());
43 StringIdLease lease2(map, kFile1);
44 EXPECT_TRUE(lease2.hasValue());
45 id = lease2.id();
46 lease1 = lease2;
47 EXPECT_EQ(id, lease1.id());
48 EXPECT_EQ(strlen(kFile1), map.pinnedSize());
49 }
50 StringIdLease lease3(map, kFile1);
51 EXPECT_NE(lease3.id(), id);
52 lease3.clear();
53 EXPECT_EQ(0, map.pinnedSize());
54}
55
56TEST(StringIdMapTest, rehash) {
57 constexpr int32_t kCount = 10000;

Callers

nothing calls this directly

Calls 6

StringIdLeaseClass · 0.85
pinnedSizeMethod · 0.80
hasValueMethod · 0.45
idMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected