diff options
| author | Dmitry Baksheev <[email protected]> | 2022-02-10 16:48:12 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:48:12 +0300 |
| commit | 0e38f1d675a0b3d02016acf698e8d04c0b224047 (patch) | |
| tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/threading/local_executor/ut | |
| parent | 17fe552c0aa936de030b2b72934d9688ab9bb1c6 (diff) | |
Restoring authorship annotation for Dmitry Baksheev <[email protected]>. Commit 2 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 a169edc2ec9..ac5737717cd 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 + ); + } +}; |
