aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/coroutine/engine/coroutine_ut.cpp
diff options
context:
space:
mode:
authorvlad-kolotvin <vlad-kolotvin@yandex-team.ru>2022-02-10 16:48:20 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:20 +0300
commit9ff71a8b1ce582cb08730cb11eb25839441317d1 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/coroutine/engine/coroutine_ut.cpp
parentd26952c54d3ee92bbdc1888b64f3dec893e5a383 (diff)
downloadydb-9ff71a8b1ce582cb08730cb11eb25839441317d1.tar.gz
Restoring authorship annotation for <vlad-kolotvin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine/coroutine_ut.cpp')
-rw-r--r--library/cpp/coroutine/engine/coroutine_ut.cpp84
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 a240161405..8b372496a2 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);