diff options
author | Dmitry Baksheev <dbakshee@yandex.ru> | 2022-02-10 16:48:12 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:12 +0300 |
commit | 17fe552c0aa936de030b2b72934d9688ab9bb1c6 (patch) | |
tree | 9ee66fb456a7ca163946c7aace3a31e69ca47e7f /library/cpp/threading/local_executor/ut | |
parent | 2909866fbc652492b7d7cab3023cb19489dc4fd8 (diff) | |
download | ydb-17fe552c0aa936de030b2b72934d9688ab9bb1c6.tar.gz |
Restoring authorship annotation for Dmitry Baksheev <dbakshee@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/threading/local_executor/ut')
-rw-r--r-- | library/cpp/threading/local_executor/ut/local_executor_ut.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/threading/local_executor/ut/local_executor_ut.cpp b/library/cpp/threading/local_executor/ut/local_executor_ut.cpp index ac5737717c..a169edc2ec 100644 --- a/library/cpp/threading/local_executor/ut/local_executor_ut.cpp +++ b/library/cpp/threading/local_executor/ut/local_executor_ut.cpp @@ -324,48 +324,48 @@ Y_UNIT_TEST(NestedParallelExceptionsDoNotLeak) { } } ; - -Y_UNIT_TEST_SUITE(ExecLargeRangeWithThrow){ - - constexpr int LARGE_COUNT = 128 * (1 << 20); - - static auto IsValue(char v) { - return [=](char c) { return c == v; }; - } - - Y_UNIT_TEST(ExecLargeRangeNoExceptions) { - TVector<char> tasks(LARGE_COUNT); - - TLocalExecutor localExecutor; - localExecutor.RunAdditionalThreads(DefaultThreadsCount); - - localExecutor.ExecRangeBlockedWithThrow([&tasks](int i) { - tasks[i] = 1; - }, 0, tasks.size(), 0, TLocalExecutor::EFlags::WAIT_COMPLETE); - UNIT_ASSERT(AllOf(tasks, IsValue(1))); - - - localExecutor.ExecRangeBlockedWithThrow([&tasks](int i) { - tasks[i] += 1; - }, 0, tasks.size(), 128, TLocalExecutor::EFlags::WAIT_COMPLETE); - UNIT_ASSERT(AllOf(tasks, IsValue(2))); - } - - Y_UNIT_TEST(ExecLargeRangeWithException) { - TVector<char> tasks(LARGE_COUNT); - - TLocalExecutor localExecutor; - localExecutor.RunAdditionalThreads(DefaultThreadsCount); - - Fill(tasks.begin(), tasks.end(), 0); - UNIT_ASSERT_EXCEPTION( - localExecutor.ExecRangeBlockedWithThrow([&tasks](int i) { - tasks[i] += 1; - if (i == LARGE_COUNT / 2) { - throw TTestException(); - } - }, 0, tasks.size(), 0, TLocalExecutor::EFlags::WAIT_COMPLETE), - TTestException - ); - } -}; + +Y_UNIT_TEST_SUITE(ExecLargeRangeWithThrow){ + + constexpr int LARGE_COUNT = 128 * (1 << 20); + + static auto IsValue(char v) { + return [=](char c) { return c == v; }; + } + + Y_UNIT_TEST(ExecLargeRangeNoExceptions) { + TVector<char> tasks(LARGE_COUNT); + + TLocalExecutor localExecutor; + localExecutor.RunAdditionalThreads(DefaultThreadsCount); + + localExecutor.ExecRangeBlockedWithThrow([&tasks](int i) { + tasks[i] = 1; + }, 0, tasks.size(), 0, TLocalExecutor::EFlags::WAIT_COMPLETE); + UNIT_ASSERT(AllOf(tasks, IsValue(1))); + + + localExecutor.ExecRangeBlockedWithThrow([&tasks](int i) { + tasks[i] += 1; + }, 0, tasks.size(), 128, TLocalExecutor::EFlags::WAIT_COMPLETE); + UNIT_ASSERT(AllOf(tasks, IsValue(2))); + } + + Y_UNIT_TEST(ExecLargeRangeWithException) { + TVector<char> tasks(LARGE_COUNT); + + TLocalExecutor localExecutor; + localExecutor.RunAdditionalThreads(DefaultThreadsCount); + + Fill(tasks.begin(), tasks.end(), 0); + UNIT_ASSERT_EXCEPTION( + localExecutor.ExecRangeBlockedWithThrow([&tasks](int i) { + tasks[i] += 1; + if (i == LARGE_COUNT / 2) { + throw TTestException(); + } + }, 0, tasks.size(), 0, TLocalExecutor::EFlags::WAIT_COMPLETE), + TTestException + ); + } +}; |