diff options
author | richard <richard@yandex-team.ru> | 2022-02-10 16:52:06 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:52:06 +0300 |
commit | 3d614c8de544db53c298060cd32d4119154be35a (patch) | |
tree | 42dba2ca5911fd8ba60884db03c5208e5cd5e794 /util/generic/algorithm_ut.cpp | |
parent | c51a16470c0065cef7d3f961d0cbe80cf5e6a0fd (diff) | |
download | ydb-3d614c8de544db53c298060cd32d4119154be35a.tar.gz |
Restoring authorship annotation for <richard@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/algorithm_ut.cpp')
-rw-r--r-- | util/generic/algorithm_ut.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 8d732fcc0c..a69f2657e7 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -128,17 +128,17 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } template <class TTestConstPtr> - void TestFindPtrFoundValue(int j, TTestConstPtr root) { - if (j == 3) { - UNIT_ASSERT(root && *root == 3); - } else if (j == 4) { - UNIT_ASSERT(root == nullptr); - } else { - ythrow yexception() << "invalid param " << j; - } - } - - template <class TTestConstPtr> + void TestFindPtrFoundValue(int j, TTestConstPtr root) { + if (j == 3) { + UNIT_ASSERT(root && *root == 3); + } else if (j == 4) { + UNIT_ASSERT(root == nullptr); + } else { + ythrow yexception() << "invalid param " << j; + } + } + + template <class TTestConstPtr> void TestFindIfPtrFoundValue(int j, TTestConstPtr root) { if (j == 3) { UNIT_ASSERT(root == nullptr); @@ -158,7 +158,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { void operator=(const TVectorNoCopy&); }; - Y_UNIT_TEST(FindPtrTest) { + Y_UNIT_TEST(FindPtrTest) { TVectorNoCopy v; v.push_back(1); v.push_back(2); @@ -168,28 +168,28 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { const int array_const[3] = {1, 2, 3}; //test (const, non-const) * (iterator, vector, array) * (found, not found) variants. - // value '3' is in container, value '4' is not - for (int j = 3; j <= 4; ++j) { - TestFindPtrFoundValue<int*>(j, FindPtr(v, j)); - TestFindPtrFoundValue<int*>(j, FindPtr(v.begin(), v.end(), j)); - const TVectorNoCopy& q = v; - TestFindPtrFoundValue<const int*>(j, FindPtr(q, j)); - TestFindPtrFoundValue<const int*>(j, FindPtr(q.begin(), q.end(), j)); - TestFindPtrFoundValue<int*>(j, FindPtr(array, j)); - TestFindPtrFoundValue<const int*>(j, FindPtr(array_const, j)); - } - } - - Y_UNIT_TEST(FindIfPtrTest) { - TVectorNoCopy v; - v.push_back(1); - v.push_back(2); - v.push_back(3); - + // value '3' is in container, value '4' is not + for (int j = 3; j <= 4; ++j) { + TestFindPtrFoundValue<int*>(j, FindPtr(v, j)); + TestFindPtrFoundValue<int*>(j, FindPtr(v.begin(), v.end(), j)); + const TVectorNoCopy& q = v; + TestFindPtrFoundValue<const int*>(j, FindPtr(q, j)); + TestFindPtrFoundValue<const int*>(j, FindPtr(q.begin(), q.end(), j)); + TestFindPtrFoundValue<int*>(j, FindPtr(array, j)); + TestFindPtrFoundValue<const int*>(j, FindPtr(array_const, j)); + } + } + + Y_UNIT_TEST(FindIfPtrTest) { + TVectorNoCopy v; + v.push_back(1); + v.push_back(2); + v.push_back(3); + int array[3] = {1, 2, 3}; const int array_const[3] = {1, 2, 3}; - - //test (const, non-const) * (iterator, vector, array) * (found, not found) variants. + + //test (const, non-const) * (iterator, vector, array) * (found, not found) variants. // search, that 2*2 == 4, but there is no value 'x' in array that (x*x == 3) for (int j = 3; j <= 4; ++j) { TestFindIfPtrFoundValue<int*>(j, FindIfPtr(v, [j](int i) { return i * i == j; })); |