MCPcopy Create free account
hub / github.com/catboost/catboost / Y_UNIT_TEST

Function Y_UNIT_TEST

library/cpp/cache/ut/cache_ut.cpp:16–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15Y_UNIT_TEST_SUITE(TCacheTest) {
16 Y_UNIT_TEST(LRUListTest) {
17 typedef TLRUList<int, TString> TListType;
18 TListType list(2);
19
20 TListType::TItem x1(1, "ttt");
21 list.Insert(&x1);
22 UNIT_ASSERT_EQUAL(list.GetTotalSize(), 1);
23 UNIT_ASSERT_EQUAL(list.GetSize(), 1);
24 UNIT_ASSERT_EQUAL(list.GetOldest()->Key, 1);
25
26 TListType::TItem x2(2, "yyy");
27 list.Insert(&x2);
28 UNIT_ASSERT_EQUAL(list.GetTotalSize(), 2);
29 UNIT_ASSERT_EQUAL(list.GetSize(), 2);
30 UNIT_ASSERT_EQUAL(list.GetOldest()->Key, 1);
31
32 list.Promote(list.GetOldest());
33 UNIT_ASSERT_EQUAL(list.GetOldest()->Key, 2);
34
35 TListType::TItem x3(3, "zzz");
36 list.Insert(&x3);
37 UNIT_ASSERT_EQUAL(list.GetTotalSize(), 2);
38 UNIT_ASSERT_EQUAL(list.GetSize(), 2);
39 UNIT_ASSERT_EQUAL(list.GetOldest()->Key, 1);
40 }
41
42 Y_UNIT_TEST(LRUListWeightedTest) {
43 typedef TLRUList<int, TString, size_t (*)(const TString&)> TListType;

Callers

nothing calls this directly

Calls 15

TMoveOnlyIntClass · 0.85
GetOldestMethod · 0.80
GetLightestMethod · 0.80
FindOldestMethod · 0.80
GetOrNullMethod · 0.80
SafeAddFuncMethod · 0.80
GetUnsafeMethod · 0.80
ToStringFunction · 0.50
InsertMethod · 0.45
GetTotalSizeMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected