diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
commit | 9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/cache | |
parent | 8cbc307de0221f84c80c42dcbe07d40727537e2c (diff) | |
download | ydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/cache')
-rw-r--r-- | library/cpp/cache/cache.h | 22 | ||||
-rw-r--r-- | library/cpp/cache/ut/cache_ut.cpp | 20 |
2 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/cache/cache.h b/library/cpp/cache/cache.h index 93bd6614db..6dc997076d 100644 --- a/library/cpp/cache/cache.h +++ b/library/cpp/cache/cache.h @@ -82,7 +82,7 @@ public: TItem* GetOldest() { typename TListType::TIterator it = List.Begin(); - Y_ASSERT(it != List.End()); + Y_ASSERT(it != List.End()); return &*it; } @@ -190,7 +190,7 @@ public: TItem* GetLeastFrequentlyUsed() { typename TListType::TIterator it = List.Begin(); - Y_ASSERT(it != List.End()); + Y_ASSERT(it != List.End()); return &*it; } @@ -310,7 +310,7 @@ public: TItem* GetLightest() { FixHeap(); - Y_ASSERT(!Heap.empty()); + Y_ASSERT(!Heap.empty()); return Heap.front(); } @@ -319,7 +319,7 @@ public: // Erased items are stored in Removed set // and will be deleted on-access (using FixHeap method) void Erase(TItem* item) { - Y_ASSERT(Size > 0); + Y_ASSERT(Size > 0); --Size; Removed.insert(item); @@ -460,14 +460,14 @@ public: // note: it shouldn't touch 'value' if it returns false. bool PickOut(const TKey& key, TValue* value) { - Y_ASSERT(value); + Y_ASSERT(value); TIndexIterator it = Index.find(TItem(key)); if (it == Index.end()) return false; *value = it->Value; List.Erase(const_cast<TItem*>(&*it)); Index.erase(it); - Y_ASSERT(Index.size() == List.GetSize()); + Y_ASSERT(Index.size() == List.GetSize()); return true; } @@ -492,7 +492,7 @@ public: } } - Y_ASSERT(Index.size() == List.GetSize()); + Y_ASSERT(Index.size() == List.GetSize()); return !insertedWasRemoved; } @@ -505,7 +505,7 @@ public: } Insert(key, value); - Y_ASSERT(Index.size() == List.GetSize()); + Y_ASSERT(Index.size() == List.GetSize()); } void Erase(TIterator it) { @@ -514,7 +514,7 @@ public: TDeleter::Destroy(item->Value); Index.erase(it.Iter); - Y_ASSERT(Index.size() == List.GetSize()); + Y_ASSERT(Index.size() == List.GetSize()); } bool Empty() const { @@ -527,7 +527,7 @@ public: List.Erase(item); TDeleter::Destroy(item->Value); } - Y_ASSERT(List.GetSize() == 0); + Y_ASSERT(List.GetSize() == 0); Index.clear(); } @@ -563,7 +563,7 @@ protected: void EraseFromIndex(TItem* item) { TDeleter::Destroy(item->Value); TIterator it = FindByItem(item); - Y_ASSERT(it != End()); + Y_ASSERT(it != End()); Index.erase(it.Iter); } }; diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp index e92e07b12e..329872cfde 100644 --- a/library/cpp/cache/ut/cache_ut.cpp +++ b/library/cpp/cache/ut/cache_ut.cpp @@ -8,8 +8,8 @@ struct TStrokaWeighter { } }; -Y_UNIT_TEST_SUITE(TCacheTest) { - Y_UNIT_TEST(LRUListTest) { +Y_UNIT_TEST_SUITE(TCacheTest) { + Y_UNIT_TEST(LRUListTest) { typedef TLRUList<int, TString> TListType; TListType list(2); @@ -65,7 +65,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { UNIT_ASSERT_EQUAL(list.GetOldest()->Key, 4); } - Y_UNIT_TEST(LFUListTest) { + Y_UNIT_TEST(LFUListTest) { typedef TLFUList<int, TString> TListType; TListType list(2); @@ -85,7 +85,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { UNIT_ASSERT_EQUAL(list.GetLeastFrequentlyUsed()->Key, 1); } - Y_UNIT_TEST(LWListTest) { + Y_UNIT_TEST(LWListTest) { typedef TLWList<int, TString, size_t, TStrokaWeighter> TListType; TListType list(2); @@ -114,7 +114,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { UNIT_ASSERT_EQUAL(list.GetSize(), 1); } - Y_UNIT_TEST(SimpleTest) { + Y_UNIT_TEST(SimpleTest) { typedef TLRUCache<int, TString> TCache; TCache s(2); // size 2 s.Insert(1, "abcd"); @@ -311,7 +311,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { UNIT_ASSERT(s.Find(6) != s.End()); } - Y_UNIT_TEST(MultiCacheTest) { + Y_UNIT_TEST(MultiCacheTest) { typedef TLRUCache<int, TString> TCache; TCache s(3, true); UNIT_ASSERT(s.Insert(1, "abcd")); @@ -333,7 +333,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { }; int TMyDelete::count = 0; - Y_UNIT_TEST(DeleterTest) { + Y_UNIT_TEST(DeleterTest) { typedef TLRUCache<int, TString, TMyDelete> TCache; TCache s(2); s.Insert(1, "123"); @@ -346,7 +346,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { UNIT_ASSERT(TMyDelete::count == 2); } - Y_UNIT_TEST(PromoteOnFind) { + Y_UNIT_TEST(PromoteOnFind) { typedef TLRUCache<int, TString> TCache; TCache s(2); s.Insert(1, "123"); @@ -357,7 +357,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { } } -Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) { +Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) { typedef TThreadSafeCache<ui32, TString, ui32> TCache; const char* VALS[] = {"abcd", "defg", "hjkl"}; @@ -375,7 +375,7 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) { mutable i32 Creations = 0; }; - Y_UNIT_TEST(SimpleTest) { + Y_UNIT_TEST(SimpleTest) { for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) { const TString data = *TCache::Get<TCallbacks>(i); UNIT_ASSERT(data == VALS[i]); |