MCPcopy Create free account
hub / github.com/facebook/CacheLib / TEST

Function TEST

cachelib/common/tests/ApproxSplitSetTest.cpp:37–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37TEST(ApproxSplitSet, Basic) {
38 ApproxSplitSet s{6, 2};
39 std::vector<std::string> keys;
40 for (int i = 0; i < 6; i++) {
41 keys.push_back(getRandomAsciiStr(16));
42 EXPECT_FALSE(s.insert(makeHash(keys[i])));
43 }
44 for (int i = 3; i < 6; i++) {
45 EXPECT_TRUE(s.insert(makeHash(keys[i])));
46 }
47 // Add one more. First split is dropped. Because of this adding keys[0]
48 // again will not actually add anything (looks like first insert).
49 keys.push_back(getRandomAsciiStr(16));
50 EXPECT_FALSE(s.insert(makeHash(keys[6])));
51 EXPECT_FALSE(s.insert(makeHash(keys[0])));
52 EXPECT_TRUE(s.insert(makeHash(keys[6])));
53}
54
55TEST(ApproxSplitSet, Reset) {
56 ApproxSplitSet s{6, 2};

Callers

nothing calls this directly

Calls 8

getRandomAsciiStrFunction · 0.85
makeHashFunction · 0.85
numKeysTrackedMethod · 0.80
insertMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected