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 | 4aef354b224559d2b031487a10d4f5cc6e82e95a (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/generic/algorithm_ut.cpp | |
parent | c78b06a63de7beec995c1007bc5332bdf3d75b69 (diff) | |
download | ydb-4aef354b224559d2b031487a10d4f5cc6e82e95a.tar.gz |
Restoring authorship annotation for <tender-bum@yandex-team.ru>. Commit 2 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 632677a3c4..8d732fcc0c 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; })); |