MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / TEST

Function TEST

src/leveldb/util/cache_test.cc:73–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71CacheTest* CacheTest::current_;
72
73TEST(CacheTest, HitAndMiss) {
74 ASSERT_EQ(-1, Lookup(100));
75
76 Insert(100, 101);
77 ASSERT_EQ(101, Lookup(100));
78 ASSERT_EQ(-1, Lookup(200));
79 ASSERT_EQ(-1, Lookup(300));
80
81 Insert(200, 201);
82 ASSERT_EQ(101, Lookup(100));
83 ASSERT_EQ(201, Lookup(200));
84 ASSERT_EQ(-1, Lookup(300));
85
86 Insert(100, 102);
87 ASSERT_EQ(102, Lookup(100));
88 ASSERT_EQ(201, Lookup(200));
89 ASSERT_EQ(-1, Lookup(300));
90
91 ASSERT_EQ(1, deleted_keys_.size());
92 ASSERT_EQ(100, deleted_keys_[0]);
93 ASSERT_EQ(101, deleted_values_[0]);
94}
95
96TEST(CacheTest, Erase) {
97 Erase(200);

Callers

nothing calls this directly

Calls 10

LookupFunction · 0.85
DecodeValueFunction · 0.85
NewIdMethod · 0.80
EncodeKeyFunction · 0.70
sizeMethod · 0.45
LookupMethod · 0.45
ValueMethod · 0.45
ReleaseMethod · 0.45
push_backMethod · 0.45
PruneMethod · 0.45

Tested by

no test coverage detected