diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
commit | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (patch) | |
tree | 26154e1e9990f1bb4525d3e3fb5b6dac2c2c1da2 /util/generic/algorithm_ut.cpp | |
parent | cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (diff) | |
download | ydb-3426a9bc7f169ae9da54cef557ad2a33f6e8eee0.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/algorithm_ut.cpp')
-rw-r--r-- | util/generic/algorithm_ut.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 8d732fcc0c..0925eb354d 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -281,37 +281,37 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(EraseNodesIfTest) { - TMap<int, int> map{{1, 1}, {2, 2}, {3, 5}}; - TMap<int, int> expectedMap{{1, 1}}; - EraseNodesIf(map, [](auto p) { return p.first >= 2; }); - UNIT_ASSERT_EQUAL(map, expectedMap); - - TMultiMap<int, int> multiMap{{1, 1}, {1, 3}, {2, 2}, {3, 5}}; - TMultiMap<int, int> expectedMultiMap{{1, 1}, {1, 3}}; - EraseNodesIf(multiMap, [](auto p) { return p.first >= 2; }); - UNIT_ASSERT_EQUAL(multiMap, expectedMultiMap); - - TSet<int> set{1, 2, 3, 4, 5, 6, 7}; - TSet<int> expectedSet{1, 3, 5, 7}; - EraseNodesIf(set, [](int i) { return i % 2 == 0; }); - UNIT_ASSERT_EQUAL(set, expectedSet); - - TMultiSet<int> multiSet{1, 1, 2, 3, 4, 4, 4, 5, 5, 5, 6, 7}; - TMultiSet<int> expectedMultiSet{1, 1, 3, 5, 5, 5, 7}; - EraseNodesIf(multiSet, [](int i) { return i % 2 == 0; }); - UNIT_ASSERT_EQUAL(multiSet, expectedMultiSet); - - THashMap<int, int> hashMap{{1, 0}, {3, 0}, {4, 0}, {10, 0}, {2, 0}, {5, 2}}; - THashMap<int, int> expectedHashMap{{1, 0}, {3, 0}, {5, 2}}; - EraseNodesIf(hashMap, [](auto p) { return p.first % 2 == 0; }); - UNIT_ASSERT_EQUAL(hashMap, expectedHashMap); - - THashMultiMap<int, int> hashMultiMap{{1, 0}, {3, 0}, {4, 0}, {10, 0}, {2, 0}, {5, 0}, {1, 0}, {1, 0}, {2, 0}, {2, 2}}; - THashMultiMap<int, int> expectedHashMultiMap{{1, 0}, {1, 0}, {1, 0}, {3, 0}, {5, 0}}; - EraseNodesIf(hashMultiMap, [](auto p) { return p.first % 2 == 0; }); - UNIT_ASSERT_EQUAL(hashMultiMap, expectedHashMultiMap); - } - + TMap<int, int> map{{1, 1}, {2, 2}, {3, 5}}; + TMap<int, int> expectedMap{{1, 1}}; + EraseNodesIf(map, [](auto p) { return p.first >= 2; }); + UNIT_ASSERT_EQUAL(map, expectedMap); + + TMultiMap<int, int> multiMap{{1, 1}, {1, 3}, {2, 2}, {3, 5}}; + TMultiMap<int, int> expectedMultiMap{{1, 1}, {1, 3}}; + EraseNodesIf(multiMap, [](auto p) { return p.first >= 2; }); + UNIT_ASSERT_EQUAL(multiMap, expectedMultiMap); + + TSet<int> set{1, 2, 3, 4, 5, 6, 7}; + TSet<int> expectedSet{1, 3, 5, 7}; + EraseNodesIf(set, [](int i) { return i % 2 == 0; }); + UNIT_ASSERT_EQUAL(set, expectedSet); + + TMultiSet<int> multiSet{1, 1, 2, 3, 4, 4, 4, 5, 5, 5, 6, 7}; + TMultiSet<int> expectedMultiSet{1, 1, 3, 5, 5, 5, 7}; + EraseNodesIf(multiSet, [](int i) { return i % 2 == 0; }); + UNIT_ASSERT_EQUAL(multiSet, expectedMultiSet); + + THashMap<int, int> hashMap{{1, 0}, {3, 0}, {4, 0}, {10, 0}, {2, 0}, {5, 2}}; + THashMap<int, int> expectedHashMap{{1, 0}, {3, 0}, {5, 2}}; + EraseNodesIf(hashMap, [](auto p) { return p.first % 2 == 0; }); + UNIT_ASSERT_EQUAL(hashMap, expectedHashMap); + + THashMultiMap<int, int> hashMultiMap{{1, 0}, {3, 0}, {4, 0}, {10, 0}, {2, 0}, {5, 0}, {1, 0}, {1, 0}, {2, 0}, {2, 2}}; + THashMultiMap<int, int> expectedHashMultiMap{{1, 0}, {1, 0}, {1, 0}, {3, 0}, {5, 0}}; + EraseNodesIf(hashMultiMap, [](auto p) { return p.first % 2 == 0; }); + UNIT_ASSERT_EQUAL(hashMultiMap, expectedHashMultiMap); + } + Y_UNIT_TEST(NthElementTest) { { TVector<TString> v; @@ -551,7 +551,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { TVector<int>::iterator iter = CopyN(data, toCopy, result.begin()); UNIT_ASSERT_VALUES_EQUAL(iter - result.begin(), toCopy); - UNIT_ASSERT_VALUES_EQUAL(result.size(), 10); + UNIT_ASSERT_VALUES_EQUAL(result.size(), 10); for (size_t idx = 0; idx < toCopy; ++idx) { UNIT_ASSERT_VALUES_EQUAL(data[idx], result[idx]); } @@ -582,7 +582,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { TVector<int> v(vSize, 0); TVector<int>::iterator iter = CopyIf(data, data + count, v.begin(), [](int x) { return !(x % 3); }); - UNIT_ASSERT_VALUES_EQUAL(v.size(), vSize); + UNIT_ASSERT_VALUES_EQUAL(v.size(), vSize); UNIT_ASSERT_VALUES_EQUAL(iter - v.begin(), 3); v.resize(iter - v.begin()); for (size_t idx = 0; idx < v.size(); ++idx) { |