aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/scheduler_actor_ut.cpp
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commitc2a1af049e9deca890e9923abe64fe6c59060348 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/messagebus/scheduler_actor_ut.cpp
parent1f553f46fb4f3c5eec631352cdd900a0709016af (diff)
downloadydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/scheduler_actor_ut.cpp')
-rw-r--r--library/cpp/messagebus/scheduler_actor_ut.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/library/cpp/messagebus/scheduler_actor_ut.cpp b/library/cpp/messagebus/scheduler_actor_ut.cpp
index 63e4d58782..e81ffd3186 100644
--- a/library/cpp/messagebus/scheduler_actor_ut.cpp
+++ b/library/cpp/messagebus/scheduler_actor_ut.cpp
@@ -1,48 +1,48 @@
#include <library/cpp/testing/unittest/registar.h>
-
+
#include "scheduler_actor.h"
-#include "misc/test_sync.h"
-
-using namespace NBus;
-using namespace NBus::NPrivate;
-using namespace NActor;
-
+#include "misc/test_sync.h"
+
+using namespace NBus;
+using namespace NBus::NPrivate;
+using namespace NActor;
+
Y_UNIT_TEST_SUITE(TSchedulerActorTests) {
struct TMyActor: public TAtomicRefCount<TMyActor>, public TActor<TMyActor>, public TScheduleActor<TMyActor> {
- TTestSync TestSync;
-
- TMyActor(TExecutor* executor, TScheduler* scheduler)
- : TActor<TMyActor>(executor)
- , TScheduleActor<TMyActor>(scheduler)
- , Iteration(0)
+ TTestSync TestSync;
+
+ TMyActor(TExecutor* executor, TScheduler* scheduler)
+ : TActor<TMyActor>(executor)
+ , TScheduleActor<TMyActor>(scheduler)
+ , Iteration(0)
{
}
-
- unsigned Iteration;
-
- void Act(TDefaultTag) {
- if (!Alarm.FetchTask()) {
+
+ unsigned Iteration;
+
+ void Act(TDefaultTag) {
+ if (!Alarm.FetchTask()) {
Y_FAIL("must not have no spurious wakeups in test");
- }
-
- TestSync.WaitForAndIncrement(Iteration++);
- if (Iteration <= 5) {
- ScheduleAt(TInstant::Now() + TDuration::MilliSeconds(Iteration));
- }
- }
- };
-
+ }
+
+ TestSync.WaitForAndIncrement(Iteration++);
+ if (Iteration <= 5) {
+ ScheduleAt(TInstant::Now() + TDuration::MilliSeconds(Iteration));
+ }
+ }
+ };
+
Y_UNIT_TEST(Simple) {
- TExecutor executor(1);
- TScheduler scheduler;
-
- TIntrusivePtr<TMyActor> actor(new TMyActor(&executor, &scheduler));
-
- actor->ScheduleAt(TInstant::Now() + TDuration::MilliSeconds(1));
-
- actor->TestSync.WaitForAndIncrement(6);
-
- // TODO: stop in destructor
- scheduler.Stop();
- }
-}
+ TExecutor executor(1);
+ TScheduler scheduler;
+
+ TIntrusivePtr<TMyActor> actor(new TMyActor(&executor, &scheduler));
+
+ actor->ScheduleAt(TInstant::Now() + TDuration::MilliSeconds(1));
+
+ actor->TestSync.WaitForAndIncrement(6);
+
+ // TODO: stop in destructor
+ scheduler.Stop();
+ }
+}