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
commit643ddee8bd6125a18c4b1506c35bee857f64f4d2 (patch)
tree9b6a77d0a7c57a5e85a0ed2744f2a54ba1a46d9f /library/cpp/cache/ut
parent767f05356832cfac686778897626e124d257dbc8 (diff)
downloadydb-643ddee8bd6125a18c4b1506c35bee857f64f4d2.tar.gz
Restoring authorship annotation for <elviandante@yandex-team.ru>. Commit 1 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 329872cfde..f3a1a502af 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;