aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/mapfindptr_ut.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/generic/mapfindptr_ut.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/mapfindptr_ut.cpp')
-rw-r--r--util/generic/mapfindptr_ut.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/util/generic/mapfindptr_ut.cpp b/util/generic/mapfindptr_ut.cpp
index 613da7a96b..53f0f04b38 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;