aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrivokon <krivokon@yandex-team.ru>2022-02-10 16:52:04 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:52:04 +0300
commit0a4db2a8ab37872843d41855c2af41be46523ae5 (patch)
tree3b7e843beafaf28c2b574ca1c127590bcec9d8ef
parenta11cd113a7a73feeaae0e2fc268e9884792482a3 (diff)
downloadydb-0a4db2a8ab37872843d41855c2af41be46523ae5.tar.gz
Restoring authorship annotation for <krivokon@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--util/charset/utf8_ut.cpp16
-rw-r--r--util/generic/algorithm.h16
-rw-r--r--util/generic/algorithm_ut.cpp52
3 files changed, 42 insertions, 42 deletions
diff --git a/util/charset/utf8_ut.cpp b/util/charset/utf8_ut.cpp
index 9e68881cca..ea511e7def 100644
--- a/util/charset/utf8_ut.cpp
+++ b/util/charset/utf8_ut.cpp
@@ -2,7 +2,7 @@
#include "wide.h"
#include <util/stream/file.h>
-#include <util/ysaveload.h>
+#include <util/ysaveload.h>
#include <library/cpp/testing/unittest/registar.h>
#include <library/cpp/testing/unittest/env.h>
@@ -98,16 +98,16 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) {
TString text = in.ReadAll();
UNIT_ASSERT(WideToUTF8(UTF8ToWide(text)) == text);
}
-
+
Y_UNIT_TEST(TestInvalidUTF8) {
TVector<TString> testData;
TFileInput input(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/invalid_UTF8.bin"));
- Load(&input, testData);
-
- for (const auto& text : testData) {
- UNIT_ASSERT_EXCEPTION(UTF8ToWide(text), yexception);
- }
- }
+ Load(&input, testData);
+
+ for (const auto& text : testData) {
+ UNIT_ASSERT_EXCEPTION(UTF8ToWide(text), yexception);
+ }
+ }
Y_UNIT_TEST(TestUTF8ToWideScalar) {
TFileInput in(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/test1.txt"));
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h
index badfb88993..cfb8b450ae 100644
--- a/util/generic/algorithm.h
+++ b/util/generic/algorithm.h
@@ -665,16 +665,16 @@ static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, P p) {
return std::mismatch(b1, e1, b2, p);
}
-template <class RandomIterator>
-static inline void NthElement(RandomIterator begin, RandomIterator nth, RandomIterator end) {
+template <class RandomIterator>
+static inline void NthElement(RandomIterator begin, RandomIterator nth, RandomIterator end) {
std::nth_element(begin, nth, end);
-}
-
-template <class RandomIterator, class Compare>
-static inline void NthElement(RandomIterator begin, RandomIterator nth, RandomIterator end, Compare compare) {
+}
+
+template <class RandomIterator, class Compare>
+static inline void NthElement(RandomIterator begin, RandomIterator nth, RandomIterator end, Compare compare) {
std::nth_element(begin, nth, end, compare);
-}
-
+}
+
// no standard implementation until C++14
template <class I1, class I2>
static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, I2 e2) {
diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp
index 8d732fcc0c..abea879ea7 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) {
{