diff options
author | iddqd <iddqd@yandex-team.ru> | 2022-02-10 16:49:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:45 +0300 |
commit | 07fce9c5f7771600d0b3d70e1f88fd8a7e164d85 (patch) | |
tree | e4aa4750fbb864d70f8c06cf03d2750e979ea3bf /library/cpp/cache/ut | |
parent | af42068bf6cd93c976b80dd0388fa48cdf65da11 (diff) | |
download | ydb-07fce9c5f7771600d0b3d70e1f88fd8a7e164d85.tar.gz |
Restoring authorship annotation for <iddqd@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/cache/ut')
-rw-r--r-- | library/cpp/cache/ut/cache_ut.cpp | 24 |
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..c3b984995e 100644 --- a/library/cpp/cache/ut/cache_ut.cpp +++ b/library/cpp/cache/ut/cache_ut.cpp @@ -356,30 +356,30 @@ Y_UNIT_TEST_SUITE(TCacheTest) { UNIT_ASSERT(s.Find(1) != s.End()); // Key 2 should have been deleted } } - + Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) { typedef TThreadSafeCache<ui32, TString, ui32> TCache; - - const char* VALS[] = {"abcd", "defg", "hjkl"}; - + + const char* VALS[] = {"abcd", "defg", "hjkl"}; + class TCallbacks: public TCache::ICallbacks { - public: + public: TKey GetKey(ui32 i) const override { - return i; - } + return i; + } TValue* CreateObject(ui32 i) const override { Creations++; return new TString(VALS[i]); - } + } mutable i32 Creations = 0; - }; - + }; + 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]); - } + } } Y_UNIT_TEST(InsertUpdateTest) { @@ -404,7 +404,7 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) { UNIT_ASSERT(callbacks.Creations == 0); UNIT_ASSERT(*item == "hjk"); } -} +} Y_UNIT_TEST_SUITE(TThreadSafeCacheUnsafeTest) { typedef TThreadSafeCache<ui32, TString, ui32> TCache; |