diff options
author | tender-bum <tender-bum@yandex-team.ru> | 2022-02-10 16:50:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:01 +0300 |
commit | c78b06a63de7beec995c1007bc5332bdf3d75b69 (patch) | |
tree | 729de992758f40b85278d4abaad655be5dd68dbc /util/generic/algorithm_ut.cpp | |
parent | 95ab23a39b5482a434361566cabdd5b0a433cb43 (diff) | |
download | ydb-c78b06a63de7beec995c1007bc5332bdf3d75b69.tar.gz |
Restoring authorship annotation for <tender-bum@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/algorithm_ut.cpp')
-rw-r--r-- | util/generic/algorithm_ut.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 8d732fcc0cf..632677a3c41 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -696,12 +696,12 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { MinElementBy(empty, functor); } - Y_UNIT_TEST(TestApplyToMany) { - int res = 0; - ApplyToMany([&res](auto v) { res += v; }, 1, 2, 3, 4, 5); - UNIT_ASSERT_EQUAL(res, 15); - - struct TVisitor { + Y_UNIT_TEST(TestApplyToMany) { + int res = 0; + ApplyToMany([&res](auto v) { res += v; }, 1, 2, 3, 4, 5); + UNIT_ASSERT_EQUAL(res, 15); + + struct TVisitor { TVisitor(int& acc) : Acc(acc) { @@ -712,20 +712,20 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { void operator()(int v) { Acc += v * 2; }; - int& Acc; - }; + int& Acc; + }; TString s{"8-800-555-35-35"}; ApplyToMany(TVisitor{res = 0}, 1, s, 5, s); - UNIT_ASSERT_EQUAL(res, 12 + 2 * static_cast<int>(s.size())); - } - - Y_UNIT_TEST(TestTupleForEach) { + UNIT_ASSERT_EQUAL(res, 12 + 2 * static_cast<int>(s.size())); + } + + Y_UNIT_TEST(TestTupleForEach) { ForEach(std::tuple<>{}, [&](auto) { UNIT_ASSERT(false); }); - auto t = std::make_tuple(5, 6, 2, 3, 6); - ForEach(t, [](auto& v) { v *= -1; }); - UNIT_ASSERT_EQUAL(t, std::make_tuple(-5, -6, -2, -3, -6)); - } - + auto t = std::make_tuple(5, 6, 2, 3, 6); + ForEach(t, [](auto& v) { v *= -1; }); + UNIT_ASSERT_EQUAL(t, std::make_tuple(-5, -6, -2, -3, -6)); + } + Y_UNIT_TEST(TestTupleAllOf) { UNIT_ASSERT(AllOf(std::tuple<>{}, [](auto) { return false; })); UNIT_ASSERT(!AllOf(std::make_tuple(1, 2, 0, 4, 5), [&](auto v) { UNIT_ASSERT_LT(v, 3); return 0 != v; })); |