aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/cache/ut
diff options
context:
space:
mode:
authornkmakarov <nkmakarov@yandex-team.ru>2022-02-10 16:49:06 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:06 +0300
commitf1803fa4ac9e2ee6cbfde317571ec330013392ff (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/cache/ut
parent324348a37ed08cf66897faefb0ec4bebfe7804e1 (diff)
downloadydb-f1803fa4ac9e2ee6cbfde317571ec330013392ff.tar.gz
Restoring authorship annotation for <nkmakarov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/cache/ut')
-rw-r--r--library/cpp/cache/ut/cache_ut.cpp68
1 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp
index 2a9af30d10..329872cfde 100644
--- a/library/cpp/cache/ut/cache_ut.cpp
+++ b/library/cpp/cache/ut/cache_ut.cpp
@@ -376,7 +376,7 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) {
};
Y_UNIT_TEST(SimpleTest) {
- for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
+ for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
const TString data = *TCache::Get<TCallbacks>(i);
UNIT_ASSERT(data == VALS[i]);
}
@@ -405,39 +405,39 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) {
UNIT_ASSERT(*item == "hjk");
}
}
-
-Y_UNIT_TEST_SUITE(TThreadSafeCacheUnsafeTest) {
- typedef TThreadSafeCache<ui32, TString, ui32> TCache;
-
- const char* VALS[] = {"abcd", "defg", "hjkl"};
- const ui32 FAILED_IDX = 1;
-
- class TCallbacks: public TCache::ICallbacks {
- public:
- TKey GetKey(ui32 i) const override {
- return i;
- }
- TValue* CreateObject(ui32 i) const override {
- if (i == FAILED_IDX) {
- return nullptr;
- }
- return new TString(VALS[i]);
- }
- };
-
- Y_UNIT_TEST(SimpleTest) {
- TCallbacks callbacks;
- TCache cache(callbacks, Y_ARRAY_SIZE(VALS));
- for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
- const TString* data = cache.GetUnsafe(i).Get();
- if (i == FAILED_IDX) {
- UNIT_ASSERT(data == nullptr);
- } else {
- UNIT_ASSERT(*data == VALS[i]);
- }
- }
- }
-}
+
+Y_UNIT_TEST_SUITE(TThreadSafeCacheUnsafeTest) {
+ typedef TThreadSafeCache<ui32, TString, ui32> TCache;
+
+ const char* VALS[] = {"abcd", "defg", "hjkl"};
+ const ui32 FAILED_IDX = 1;
+
+ class TCallbacks: public TCache::ICallbacks {
+ public:
+ TKey GetKey(ui32 i) const override {
+ return i;
+ }
+ TValue* CreateObject(ui32 i) const override {
+ if (i == FAILED_IDX) {
+ return nullptr;
+ }
+ return new TString(VALS[i]);
+ }
+ };
+
+ Y_UNIT_TEST(SimpleTest) {
+ TCallbacks callbacks;
+ TCache cache(callbacks, Y_ARRAY_SIZE(VALS));
+ for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
+ const TString* data = cache.GetUnsafe(i).Get();
+ if (i == FAILED_IDX) {
+ UNIT_ASSERT(data == nullptr);
+ } else {
+ UNIT_ASSERT(*data == VALS[i]);
+ }
+ }
+ }
+}
Y_UNIT_TEST_SUITE(TThreadSafeLRUCacheTest) {
typedef TThreadSafeLRUCache<size_t, TString, size_t> TCache;