diff options
author | vlad-kolotvin <vlad-kolotvin@yandex-team.ru> | 2022-02-10 16:48:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:20 +0300 |
commit | d26952c54d3ee92bbdc1888b64f3dec893e5a383 (patch) | |
tree | 72e5a06ef50a8d3041aaa60f5d7c287025cf657d /library/cpp/coroutine/engine/coroutine_ut.cpp | |
parent | 805923d9caf5cf5b7fd5f4aa268f783503260d62 (diff) | |
download | ydb-d26952c54d3ee92bbdc1888b64f3dec893e5a383.tar.gz |
Restoring authorship annotation for <vlad-kolotvin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine/coroutine_ut.cpp')
-rw-r--r-- | library/cpp/coroutine/engine/coroutine_ut.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/library/cpp/coroutine/engine/coroutine_ut.cpp b/library/cpp/coroutine/engine/coroutine_ut.cpp index 8b372496a2..a240161405 100644 --- a/library/cpp/coroutine/engine/coroutine_ut.cpp +++ b/library/cpp/coroutine/engine/coroutine_ut.cpp @@ -44,8 +44,8 @@ class TCoroTest: public TTestBase { UNIT_TEST(TestComputeCoroutineYield) UNIT_TEST(TestPollEngines); UNIT_TEST(TestUserEvent); - UNIT_TEST(TestPause); - UNIT_TEST(TestOverrideTime); + UNIT_TEST(TestPause); + UNIT_TEST(TestOverrideTime); UNIT_TEST_SUITE_END(); public: @@ -76,8 +76,8 @@ public: void TestComputeCoroutineYield(); void TestPollEngines(); void TestUserEvent(); - void TestPause(); - void TestOverrideTime(); + void TestPause(); + void TestOverrideTime(); }; void TCoroTest::TestException() { @@ -942,23 +942,23 @@ void TCoroTest::TestPollEngines() { UNIT_ASSERT(defaultChecked); } -void TCoroTest::TestPause() { +void TCoroTest::TestPause() { TContExecutor executor{1024*1024, IPollerFace::Default(), nullptr, nullptr, NCoro::NStack::EGuard::Canary, Nothing()}; - - int i = 0; - executor.CreateOwned([&](TCont*) { - i++; - executor.Pause(); - i++; - }, "coro"); - - UNIT_ASSERT_EQUAL(i, 0); - executor.Execute(); - UNIT_ASSERT_EQUAL(i, 1); - executor.Execute(); - UNIT_ASSERT_EQUAL(i, 2); -} - + + int i = 0; + executor.CreateOwned([&](TCont*) { + i++; + executor.Pause(); + i++; + }, "coro"); + + UNIT_ASSERT_EQUAL(i, 0); + executor.Execute(); + UNIT_ASSERT_EQUAL(i, 1); + executor.Execute(); + UNIT_ASSERT_EQUAL(i, 2); +} + void TCoroTest::TestUserEvent() { TContExecutor exec(32000); @@ -981,27 +981,27 @@ void TCoroTest::TestUserEvent() { UNIT_ASSERT(event.Called); } - -void TCoroTest::TestOverrideTime() { - class TTime: public NCoro::ITime { - public: - TInstant Now() override { - return Current; - } - - TInstant Current = TInstant::Zero(); - }; - - TTime time; + +void TCoroTest::TestOverrideTime() { + class TTime: public NCoro::ITime { + public: + TInstant Now() override { + return Current; + } + + TInstant Current = TInstant::Zero(); + }; + + TTime time; TContExecutor executor{1024*1024, IPollerFace::Default(), nullptr, nullptr, NCoro::NStack::EGuard::Canary, Nothing(), &time}; - - executor.CreateOwned([&](TCont* cont) { - UNIT_ASSERT_EQUAL(cont->Executor()->Now(), TInstant::Zero()); - time.Current = TInstant::Seconds(1); - cont->SleepD(TInstant::Seconds(1)); - UNIT_ASSERT_EQUAL(cont->Executor()->Now(), TInstant::Seconds(1)); - }, "coro"); - - executor.Execute(); -} + + executor.CreateOwned([&](TCont* cont) { + UNIT_ASSERT_EQUAL(cont->Executor()->Now(), TInstant::Zero()); + time.Current = TInstant::Seconds(1); + cont->SleepD(TInstant::Seconds(1)); + UNIT_ASSERT_EQUAL(cont->Executor()->Now(), TInstant::Seconds(1)); + }, "coro"); + + executor.Execute(); +} UNIT_TEST_SUITE_REGISTRATION(TCoroTest); |