aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/algorithm_ut.cpp
diff options
context:
space:
mode:
authorkrivokon <krivokon@yandex-team.ru>2022-02-10 16:52:05 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:52:05 +0300
commit57cd0ba1b8c1fb6b71ccd886caab0c1f28fe54f5 (patch)
treeab7fbbf3253d4c0e2793218f09378908beb025fb /util/generic/algorithm_ut.cpp
parent0a4db2a8ab37872843d41855c2af41be46523ae5 (diff)
downloadydb-57cd0ba1b8c1fb6b71ccd886caab0c1f28fe54f5.tar.gz
Restoring authorship annotation for <krivokon@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/algorithm_ut.cpp')
-rw-r--r--util/generic/algorithm_ut.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp
index abea879ea7..8d732fcc0c 100644
--- a/util/generic/algorithm_ut.cpp
+++ b/util/generic/algorithm_ut.cpp
@@ -265,7 +265,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {
UNIT_ASSERT_EQUAL(v, suV);
}
}
-
+
Y_UNIT_TEST(EraseTest) {
TVector<int> data = {5, 4, 3, 2, 1, 0};
TVector<int> expected = {5, 4, 2, 1, 0};
@@ -313,40 +313,40 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {
}
Y_UNIT_TEST(NthElementTest) {
- {
+ {
TVector<TString> v;
- NthElement(v.begin(), v.begin(), v.end());
+ NthElement(v.begin(), v.begin(), v.end());
UNIT_ASSERT_EQUAL(v, TVector<TString>());
- }
-
- {
- int data[] = {3, 2, 1, 4, 6, 5, 7, 9, 8};
+ }
+
+ {
+ int data[] = {3, 2, 1, 4, 6, 5, 7, 9, 8};
TVector<int> testVector(data, data + Y_ARRAY_SIZE(data));
-
+
size_t medianInd = testVector.size() / 2;
-
- NthElement(testVector.begin(), testVector.begin() + medianInd, testVector.end());
- UNIT_ASSERT_EQUAL(testVector[medianInd], 5);
-
+
+ NthElement(testVector.begin(), testVector.begin() + medianInd, testVector.end());
+ UNIT_ASSERT_EQUAL(testVector[medianInd], 5);
+
NthElement(testVector.begin(), testVector.begin() + medianInd, testVector.end(), [](int lhs, int rhs) { return lhs > rhs; });
- UNIT_ASSERT_EQUAL(testVector[medianInd], 5);
- }
-
- {
- const char* data[] = {"3", "234", "1231", "333", "545345", "11", "111", "55", "66"};
+ UNIT_ASSERT_EQUAL(testVector[medianInd], 5);
+ }
+
+ {
+ const char* data[] = {"3", "234", "1231", "333", "545345", "11", "111", "55", "66"};
TVector<TString> testVector(data, data + Y_ARRAY_SIZE(data));
-
+
size_t medianInd = testVector.size() / 2;
- NthElement(testVector.begin(), testVector.begin() + medianInd, testVector.end());
-
- auto median = testVector.begin() + medianInd;
+ NthElement(testVector.begin(), testVector.begin() + medianInd, testVector.end());
+
+ auto median = testVector.begin() + medianInd;
for (auto it0 = testVector.begin(); it0 != median; ++it0) {
for (auto it1 = median; it1 != testVector.end(); ++it1) {
- UNIT_ASSERT(*it0 <= *it1);
- }
- }
- }
- }
+ UNIT_ASSERT(*it0 <= *it1);
+ }
+ }
+ }
+ }
Y_UNIT_TEST(BinarySearchTest) {
{