blob: f334b969d1643694d6ba3631dddf2d5f7875fae3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <library/cpp/testing/unittest/registar.h>
#include "scheduler.h"
#include <library/cpp/messagebus/misc/test_sync.h>
using namespace NBus;
using namespace NBus::NPrivate;
Y_UNIT_TEST_SUITE(TSchedulerTests) {
struct TSimpleScheduleItem: public IScheduleItem {
TTestSync* const TestSync;
TSimpleScheduleItem(TTestSync* testSync)
: IScheduleItem((TInstant::Now() + TDuration::MilliSeconds(1)))
, TestSync(testSync)
{
}
void Do() override {
TestSync->WaitForAndIncrement(0);
}
};
Y_UNIT_TEST(Simple) {
TTestSync testSync;
TScheduler scheduler;
scheduler.Schedule(new TSimpleScheduleItem(&testSync));
testSync.WaitForAndIncrement(1);
scheduler.Stop();
}
}
|