diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /util/generic/hash_ut.cpp | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/hash_ut.cpp')
-rw-r--r-- | util/generic/hash_ut.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp index 0551d58770..060d617650 100644 --- a/util/generic/hash_ut.cpp +++ b/util/generic/hash_ut.cpp @@ -57,7 +57,7 @@ class THashTest: public TTestBase { UNIT_TEST(TestHMMapInitializerList); UNIT_TEST(TestHSetInitializerList); UNIT_TEST(TestHMSetInitializerList); - UNIT_TEST(TestHSetInsertInitializerList); + UNIT_TEST(TestHSetInsertInitializerList); UNIT_TEST(TestTupleHash); UNIT_TEST_SUITE_END(); @@ -108,7 +108,7 @@ protected: void TestHMMapInitializerList(); void TestHSetInitializerList(); void TestHMSetInitializerList(); - void TestHSetInsertInitializerList(); + void TestHSetInsertInitializerList(); void TestTupleHash(); }; @@ -798,7 +798,7 @@ public: TCountingAllocator(TAllocatorCounters* counters) : Counters_(counters) { - Y_ASSERT(counters); + Y_ASSERT(counters); } template <class Other> @@ -1187,44 +1187,44 @@ void THashTest::TestHMSetInitializerList() { h2.insert("baz"); UNIT_ASSERT_EQUAL(h1, h2); } - -namespace { - struct TFoo { - int A; - int B; - + +namespace { + struct TFoo { + int A; + int B; + bool operator==(const TFoo& o) const { - return A == o.A && B == o.B; - } - }; -} - -template <> -struct THash<TFoo> { - size_t operator()(const TFoo& v) const { - return v.A ^ v.B; - } -}; - -template <> -void Out<TFoo>(IOutputStream& o, const TFoo& v) { - o << '{' << v.A << ';' << v.B << '}'; -} - -void THashTest::TestHSetInsertInitializerList() { - { + return A == o.A && B == o.B; + } + }; +} + +template <> +struct THash<TFoo> { + size_t operator()(const TFoo& v) const { + return v.A ^ v.B; + } +}; + +template <> +void Out<TFoo>(IOutputStream& o, const TFoo& v) { + o << '{' << v.A << ';' << v.B << '}'; +} + +void THashTest::TestHSetInsertInitializerList() { + { const THashSet<int> x = {1}; THashSet<int> y; - y.insert({1}); - UNIT_ASSERT_VALUES_EQUAL(x, y); - } - { + y.insert({1}); + UNIT_ASSERT_VALUES_EQUAL(x, y); + } + { const THashSet<int> x = {1, 2}; THashSet<int> y; - y.insert({1, 2}); - UNIT_ASSERT_VALUES_EQUAL(x, y); - } - { + y.insert({1, 2}); + UNIT_ASSERT_VALUES_EQUAL(x, y); + } + { const THashSet<int> x = {1, 2, 3, 4, 5}; THashSet<int> y; y.insert({ @@ -1234,21 +1234,21 @@ void THashTest::TestHSetInsertInitializerList() { 4, 5, }); - UNIT_ASSERT_VALUES_EQUAL(x, y); - } - { + UNIT_ASSERT_VALUES_EQUAL(x, y); + } + { const THashSet<TFoo> x = {{1, 2}}; THashSet<TFoo> y; - y.insert({{1, 2}}); - UNIT_ASSERT_VALUES_EQUAL(x, y); - } - { + y.insert({{1, 2}}); + UNIT_ASSERT_VALUES_EQUAL(x, y); + } + { const THashSet<TFoo> x = {{1, 2}, {3, 4}}; THashSet<TFoo> y; - y.insert({{1, 2}, {3, 4}}); - UNIT_ASSERT_VALUES_EQUAL(x, y); - } -} + y.insert({{1, 2}, {3, 4}}); + UNIT_ASSERT_VALUES_EQUAL(x, y); + } +} /* * Sequence for MultiHash is reversed as it calculates hash as |