MCPcopy Create free account
hub / github.com/ElementsProject/elements / TEST

Function TEST

src/leveldb/util/cache_test.cc:67–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 11

LookupFunction · 0.85
DecodeValueFunction · 0.85
NewLRUCacheFunction · 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