MCPcopy Create free account
hub / github.com/chen3feng/toft / TEST

Function TEST

container/lru_cache_test.cpp:17–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15namespace toft {
16
17TEST(LruCacheTest, Normal) {
18 LruCache<int, int> cache(5);
19 cache.Put(2, 2);
20 cache.Put(1, 1);
21 cache.Put(3, 3);
22 EXPECT_EQ(1, cache.GetOrDefault(1));
23 EXPECT_EQ(3, cache.GetOrDefault(3));
24 EXPECT_EQ(2, cache.GetOrDefault(2));
25 EXPECT_EQ(1, cache.GetOrDefault(1));
26 EXPECT_EQ(2, cache.GetOrDefault(2));
27 EXPECT_EQ(3, cache.GetOrDefault(3));
28 EXPECT_FALSE(cache.HasKey(4));
29}
30
31TEST(LruCacheTest, SameKey) {
32 LruCache<int, int> cache(4);

Callers

nothing calls this directly

Calls 10

NewClosureFunction · 0.85
GetOrDefaultMethod · 0.80
HasKeyMethod · 0.80
IsFullMethod · 0.80
AddTaskMethod · 0.80
PutMethod · 0.45
SizeMethod · 0.45
CapacityMethod · 0.45
IsEmptyMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected