aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorzosimov <zosimov@yandex-team.ru>2022-02-10 16:50:32 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:32 +0300
commita8f009e06d613c9567eb4c0f461dbed5e0d8092b (patch)
treed21fc5cd2e0d5ade9588ebc637729e86b924279b /util
parent06e925754c8de946ff79d538bde1e6424cbd4cbb (diff)
downloadydb-a8f009e06d613c9567eb4c0f461dbed5e0d8092b.tar.gz
Restoring authorship annotation for <zosimov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/generic/hash.h18
-rw-r--r--util/generic/hash_set.h46
-rw-r--r--util/generic/hash_ut.cpp160
3 files changed, 112 insertions, 112 deletions
diff --git a/util/generic/hash.h b/util/generic/hash.h
index e46db21fa9..a950a41180 100644
--- a/util/generic/hash.h
+++ b/util/generic/hash.h
@@ -1736,16 +1736,16 @@ public:
template <class Key, class T, class HashFcn, class EqualKey, class Alloc>
inline bool operator==(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm1, const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm2) {
- if (hm1.size() != hm2.size()) {
- return false;
- }
+ if (hm1.size() != hm2.size()) {
+ return false;
+ }
for (const auto& it1 : hm1) {
- auto it2 = hm2.find(it1.first);
- if ((it2 == hm2.end()) || !(it1 == *it2)) {
- return false;
- }
- }
- return true;
+ auto it2 = hm2.find(it1.first);
+ if ((it2 == hm2.end()) || !(it1 == *it2)) {
+ return false;
+ }
+ }
+ return true;
}
template <class Key, class T, class HashFcn, class EqualKey, class Alloc>
diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h
index e8088cf23b..5c6387f19f 100644
--- a/util/generic/hash_set.h
+++ b/util/generic/hash_set.h
@@ -262,15 +262,15 @@ public:
template <class Value, class HashFcn, class EqualKey, class Alloc>
inline bool operator==(const THashSet<Value, HashFcn, EqualKey, Alloc>& hs1, const THashSet<Value, HashFcn, EqualKey, Alloc>& hs2) {
- if (hs1.size() != hs2.size()) {
- return false;
- }
- for (const auto& it : hs1) {
+ if (hs1.size() != hs2.size()) {
+ return false;
+ }
+ for (const auto& it : hs1) {
if (!hs2.contains(it)) {
- return false;
- }
- }
- return true;
+ return false;
+ }
+ }
+ return true;
}
template <class Value, class HashFcn, class EqualKey, class Alloc>
@@ -465,21 +465,21 @@ public:
template <class Val, class HashFcn, class EqualKey, class Alloc>
inline bool operator==(const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs1, const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs2) {
- if (hs1.size() != hs2.size()) {
- return false;
- }
- EqualKey equalKey;
- auto it = hs1.begin();
- while (it != hs1.end()) {
- const auto& value = *it;
- size_t count = 0;
- for (; (it != hs1.end()) && (equalKey(*it, value)); ++it, ++count) {
- }
- if (hs2.count(value) != count) {
- return false;
- }
- }
- return true;
+ if (hs1.size() != hs2.size()) {
+ return false;
+ }
+ EqualKey equalKey;
+ auto it = hs1.begin();
+ while (it != hs1.end()) {
+ const auto& value = *it;
+ size_t count = 0;
+ for (; (it != hs1.end()) && (equalKey(*it, value)); ++it, ++count) {
+ }
+ if (hs2.count(value) != count) {
+ return false;
+ }
+ }
+ return true;
}
template <class Val, class HashFcn, class EqualKey, class Alloc>
diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp
index 0551d58770..73c29c8b5a 100644
--- a/util/generic/hash_ut.cpp
+++ b/util/generic/hash_ut.cpp
@@ -15,7 +15,7 @@ class THashTest: public TTestBase {
UNIT_TEST_SUITE(THashTest);
UNIT_TEST(TestHMapConstructorsAndAssignments);
UNIT_TEST(TestHMap1);
- UNIT_TEST(TestHMapEqualityOperator);
+ UNIT_TEST(TestHMapEqualityOperator);
UNIT_TEST(TestHMMapEqualityOperator);
UNIT_TEST(TestHMMapConstructorsAndAssignments);
UNIT_TEST(TestHMMap1);
@@ -23,11 +23,11 @@ class THashTest: public TTestBase {
UNIT_TEST(TestHSetConstructorsAndAssignments);
UNIT_TEST(TestHSetSize);
UNIT_TEST(TestHSet2);
- UNIT_TEST(TestHSetEqualityOperator);
+ UNIT_TEST(TestHSetEqualityOperator);
UNIT_TEST(TestHMSetConstructorsAndAssignments);
UNIT_TEST(TestHMSetSize);
UNIT_TEST(TestHMSet1);
- UNIT_TEST(TestHMSetEqualityOperator);
+ UNIT_TEST(TestHMSetEqualityOperator);
UNIT_TEST(TestHMSetEmplace);
UNIT_TEST(TestInsertErase);
UNIT_TEST(TestResizeOnInsertSmartPtrBug)
@@ -66,7 +66,7 @@ class THashTest: public TTestBase {
protected:
void TestHMapConstructorsAndAssignments();
void TestHMap1();
- void TestHMapEqualityOperator();
+ void TestHMapEqualityOperator();
void TestHMMapEqualityOperator();
void TestHMMapConstructorsAndAssignments();
void TestHMMap1();
@@ -74,11 +74,11 @@ protected:
void TestHSetConstructorsAndAssignments();
void TestHSetSize();
void TestHSet2();
- void TestHSetEqualityOperator();
+ void TestHSetEqualityOperator();
void TestHMSetConstructorsAndAssignments();
void TestHMSetSize();
void TestHMSet1();
- void TestHMSetEqualityOperator();
+ void TestHMSetEqualityOperator();
void TestHMSetEmplace();
void TestInsertErase();
void TestResizeOnInsertSmartPtrBug();
@@ -202,29 +202,29 @@ void THashTest::TestHMap1() {
UNIT_ASSERT(!(cite != (maptype::const_iterator)ite));
}
-void THashTest::TestHMapEqualityOperator() {
+void THashTest::TestHMapEqualityOperator() {
using container = THashMap<TString, int>;
-
- container base;
- base["one"] = 1;
- base["two"] = 2;
-
- container c1(base);
- UNIT_ASSERT(c1 == base);
-
- container c2;
- c2["two"] = 2;
- c2["one"] = 1;
- UNIT_ASSERT(c2 == base);
-
- c2["three"] = 3;
+
+ container base;
+ base["one"] = 1;
+ base["two"] = 2;
+
+ container c1(base);
+ UNIT_ASSERT(c1 == base);
+
+ container c2;
+ c2["two"] = 2;
+ c2["one"] = 1;
+ UNIT_ASSERT(c2 == base);
+
+ c2["three"] = 3;
UNIT_ASSERT(c2 != base);
-
- container c3(base);
- c3["one"] = 0;
+
+ container c3(base);
+ c3["one"] = 0;
UNIT_ASSERT(c3 != base);
-}
-
+}
+
void THashTest::TestHMMapEqualityOperator() {
using container = THashMultiMap<TString, int>;
using value = container::value_type;
@@ -431,32 +431,32 @@ void THashTest::TestHSet2() {
UNIT_ASSERT(!p.second);
}
-void THashTest::TestHSetEqualityOperator() {
+void THashTest::TestHSetEqualityOperator() {
using container = THashSet<int>;
-
- container base;
- base.insert(1);
- base.insert(2);
-
- container c1(base);
- UNIT_ASSERT(c1 == base);
-
- c1.insert(1);
- UNIT_ASSERT(c1 == base);
-
- c1.insert(3);
+
+ container base;
+ base.insert(1);
+ base.insert(2);
+
+ container c1(base);
+ UNIT_ASSERT(c1 == base);
+
+ c1.insert(1);
+ UNIT_ASSERT(c1 == base);
+
+ c1.insert(3);
UNIT_ASSERT(c1 != base);
-
- container c2;
- c2.insert(2);
- c2.insert(1);
- UNIT_ASSERT(c2 == base);
-
- container c3;
- c3.insert(1);
+
+ container c2;
+ c2.insert(2);
+ c2.insert(1);
+ UNIT_ASSERT(c2 == base);
+
+ container c3;
+ c3.insert(1);
UNIT_ASSERT(c3 != base);
-}
-
+}
+
void THashTest::TestHMSetConstructorsAndAssignments() {
using container = THashMultiSet<int>;
@@ -522,38 +522,38 @@ void THashTest::TestHMSet1() {
UNIT_ASSERT(s.erase(star) == 2);
}
-void THashTest::TestHMSetEqualityOperator() {
+void THashTest::TestHMSetEqualityOperator() {
using container = THashMultiSet<int>;
-
- container base;
- base.insert(1);
- base.insert(1);
- base.insert(2);
-
- container c1(base);
- UNIT_ASSERT(c1 == base);
-
- c1.insert(1);
- UNIT_ASSERT(!(c1 == base));
-
- container c2;
- c2.insert(2);
- c2.insert(1);
- c2.insert(1);
- UNIT_ASSERT(c2 == base);
-
- container c3;
- c3.insert(1);
- c3.insert(2);
- UNIT_ASSERT(!(c3 == base));
-
- c3.insert(1);
- UNIT_ASSERT(c3 == base);
-
- c3.insert(3);
- UNIT_ASSERT(!(c3 == base));
-}
-
+
+ container base;
+ base.insert(1);
+ base.insert(1);
+ base.insert(2);
+
+ container c1(base);
+ UNIT_ASSERT(c1 == base);
+
+ c1.insert(1);
+ UNIT_ASSERT(!(c1 == base));
+
+ container c2;
+ c2.insert(2);
+ c2.insert(1);
+ c2.insert(1);
+ UNIT_ASSERT(c2 == base);
+
+ container c3;
+ c3.insert(1);
+ c3.insert(2);
+ UNIT_ASSERT(!(c3 == base));
+
+ c3.insert(1);
+ UNIT_ASSERT(c3 == base);
+
+ c3.insert(3);
+ UNIT_ASSERT(!(c3 == base));
+}
+
void THashTest::TestHMSetEmplace() {
class TKey: public NTesting::TProbe {
public: