aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/cache/ut
diff options
context:
space:
mode:
authorlucius <lucius@yandex-team.ru>2022-02-10 16:50:14 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:14 +0300
commit95ad0bd7bde5cd56bd6395ad6b7c47f0e73e4c99 (patch)
tree8162a11ee819c3dd6107870455732fd441483b38 /library/cpp/cache/ut
parentecc19a1fc1e15d78a9279514cb11edd9e808d600 (diff)
downloadydb-95ad0bd7bde5cd56bd6395ad6b7c47f0e73e4c99.tar.gz
Restoring authorship annotation for <lucius@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/cache/ut')
-rw-r--r--library/cpp/cache/ut/cache_ut.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp
index 329872cfde..cf2ea3eeab 100644
--- a/library/cpp/cache/ut/cache_ut.cpp
+++ b/library/cpp/cache/ut/cache_ut.cpp
@@ -2,12 +2,12 @@
#include <library/cpp/cache/thread_safe_cache.h>
#include <library/cpp/testing/unittest/registar.h>
-struct TStrokaWeighter {
+struct TStrokaWeighter {
static size_t Weight(const TString& s) {
- return s.size();
- }
-};
-
+ return s.size();
+ }
+};
+
Y_UNIT_TEST_SUITE(TCacheTest) {
Y_UNIT_TEST(LRUListTest) {
typedef TLRUList<int, TString> TListType;
@@ -88,32 +88,32 @@ Y_UNIT_TEST_SUITE(TCacheTest) {
Y_UNIT_TEST(LWListTest) {
typedef TLWList<int, TString, size_t, TStrokaWeighter> TListType;
TListType list(2);
-
+
TListType::TItem x1(1, "tt");
list.Insert(&x1);
UNIT_ASSERT_EQUAL(list.GetLightest()->Key, 1);
UNIT_ASSERT_EQUAL(list.GetSize(), 1);
-
+
TListType::TItem x2(2, "yyyy");
list.Insert(&x2);
UNIT_ASSERT_EQUAL(list.GetLightest()->Key, 1);
UNIT_ASSERT_EQUAL(list.GetSize(), 2);
-
+
TListType::TItem x3(3, "z");
list.Insert(&x3);
UNIT_ASSERT_EQUAL(list.GetLightest()->Key, 1);
UNIT_ASSERT_EQUAL(list.GetSize(), 2);
-
+
TListType::TItem x4(4, "xxxxxx");
list.Insert(&x4);
UNIT_ASSERT_EQUAL(list.GetLightest()->Key, 2);
UNIT_ASSERT_EQUAL(list.GetSize(), 2);
-
+
list.Erase(&x2);
UNIT_ASSERT_EQUAL(list.GetLightest()->Key, 4);
UNIT_ASSERT_EQUAL(list.GetSize(), 1);
- }
-
+ }
+
Y_UNIT_TEST(SimpleTest) {
typedef TLRUCache<int, TString> TCache;
TCache s(2); // size 2