aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/cache/ut
diff options
context:
space:
mode:
authorelviandante <elviandante@yandex-team.ru>2022-02-10 16:49:47 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:47 +0300
commit621a17b75565a8d70df465a0ac5c93a7c6d2e61f (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/cache/ut
parent643ddee8bd6125a18c4b1506c35bee857f64f4d2 (diff)
downloadydb-621a17b75565a8d70df465a0ac5c93a7c6d2e61f.tar.gz
Restoring authorship annotation for <elviandante@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/cache/ut')
-rw-r--r--library/cpp/cache/ut/cache_ut.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp
index f3a1a502af..329872cfde 100644
--- a/library/cpp/cache/ut/cache_ut.cpp
+++ b/library/cpp/cache/ut/cache_ut.cpp
@@ -116,31 +116,31 @@ Y_UNIT_TEST_SUITE(TCacheTest) {
Y_UNIT_TEST(SimpleTest) {
typedef TLRUCache<int, TString> TCache;
- TCache s(2); // size 2
- s.Insert(1, "abcd");
- UNIT_ASSERT(s.Find(1) != s.End());
- UNIT_ASSERT_EQUAL(*s.Find(1), "abcd");
- s.Insert(2, "defg");
- UNIT_ASSERT(s.GetOldest() == "abcd");
- s.Insert(3, "hjkl");
- UNIT_ASSERT(s.GetOldest() == "defg");
- // key 1 will be deleted
- UNIT_ASSERT(s.Find(1) == s.End());
- UNIT_ASSERT(s.Find(2) != s.End());
- UNIT_ASSERT(*s.Find(2) == "defg");
- UNIT_ASSERT(s.Find(3) != s.End());
- UNIT_ASSERT(*s.Find(3) == "hjkl");
-
+ TCache s(2); // size 2
+ s.Insert(1, "abcd");
+ UNIT_ASSERT(s.Find(1) != s.End());
+ UNIT_ASSERT_EQUAL(*s.Find(1), "abcd");
+ s.Insert(2, "defg");
+ UNIT_ASSERT(s.GetOldest() == "abcd");
+ s.Insert(3, "hjkl");
+ UNIT_ASSERT(s.GetOldest() == "defg");
+ // key 1 will be deleted
+ UNIT_ASSERT(s.Find(1) == s.End());
+ UNIT_ASSERT(s.Find(2) != s.End());
+ UNIT_ASSERT(*s.Find(2) == "defg");
+ UNIT_ASSERT(s.Find(3) != s.End());
+ UNIT_ASSERT(*s.Find(3) == "hjkl");
+
UNIT_ASSERT(!s.Insert(3, "abcd"));
UNIT_ASSERT(*s.Find(3) == "hjkl");
s.Update(3, "abcd");
UNIT_ASSERT(*s.Find(3) == "abcd");
- TCache::TIterator it = s.Find(3);
- s.Erase(it);
- UNIT_ASSERT(s.Find(3) == s.End());
+ TCache::TIterator it = s.Find(3);
+ s.Erase(it);
+ UNIT_ASSERT(s.Find(3) == s.End());
}
-
+
Y_UNIT_TEST(LRUWithCustomSizeProviderTest) {
typedef TLRUCache<int, TString, TNoopDelete, size_t(*)(const TString&)> TCache;
TCache s(10, false, [](auto& string) { return string.size(); }); // size 10
@@ -355,7 +355,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) {
s.Insert(3, "789");
UNIT_ASSERT(s.Find(1) != s.End()); // Key 2 should have been deleted
}
-}
+}
Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) {
typedef TThreadSafeCache<ui32, TString, ui32> TCache;