diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/generic/mapfindptr_ut.cpp | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/mapfindptr_ut.cpp')
-rw-r--r-- | util/generic/mapfindptr_ut.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/util/generic/mapfindptr_ut.cpp b/util/generic/mapfindptr_ut.cpp index 53f0f04b38..613da7a96b 100644 --- a/util/generic/mapfindptr_ut.cpp +++ b/util/generic/mapfindptr_ut.cpp @@ -1,47 +1,47 @@ #include "string.h" -#include "hash.h" - +#include "hash.h" + #include <library/cpp/testing/unittest/registar.h> -#include <map> - -#include "mapfindptr.h" - +#include <map> + +#include "mapfindptr.h" + Y_UNIT_TEST_SUITE(TMapFindPtrTest) { - struct TTestMap: std::map<int, TString>, TMapOps<TTestMap> {}; + struct TTestMap: std::map<int, TString>, TMapOps<TTestMap> {}; Y_UNIT_TEST(TestDerivedClass) { - TTestMap a; + TTestMap a; - a[42] = "cat"; + a[42] = "cat"; UNIT_ASSERT(a.FindPtr(42)); - UNIT_ASSERT_EQUAL(*a.FindPtr(42), "cat"); + UNIT_ASSERT_EQUAL(*a.FindPtr(42), "cat"); UNIT_ASSERT_EQUAL(a.FindPtr(0), nullptr); - //test mutation + //test mutation if (TString* p = a.FindPtr(42)) { - *p = "dog"; + *p = "dog"; } UNIT_ASSERT(a.FindPtr(42)); - UNIT_ASSERT_EQUAL(*a.FindPtr(42), "dog"); - - //test const-overloaded functions too - const TTestMap& b = a; - UNIT_ASSERT(b.FindPtr(42) && *b.FindPtr(42) == "dog"); + UNIT_ASSERT_EQUAL(*a.FindPtr(42), "dog"); + + //test const-overloaded functions too + const TTestMap& b = a; + UNIT_ASSERT(b.FindPtr(42) && *b.FindPtr(42) == "dog"); UNIT_ASSERT_EQUAL(b.FindPtr(0), nullptr); UNIT_ASSERT_STRINGS_EQUAL(b.Value(42, "cat"), "dog"); UNIT_ASSERT_STRINGS_EQUAL(b.Value(0, "alien"), "alien"); - } - + } + Y_UNIT_TEST(TestTemplateFind) { THashMap<TString, int> m; - + m[TString("x")] = 2; - + UNIT_ASSERT(m.FindPtr(TStringBuf("x"))); UNIT_ASSERT_EQUAL(*m.FindPtr(TStringBuf("x")), 2); - } + } Y_UNIT_TEST(TestValue) { TTestMap a; |