blob: 05f7de1319539f237f2f74e1de19642bf8cdb3c4 (
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
37
38
39
40
41
42
43
44
45
|
#include <library/cpp/testing/unittest/registar.h>
#include "track.h"
#include <library/cpp/messagebus/rain_check/test/helper/misc.h>
#include <library/cpp/messagebus/rain_check/test/ut/test.h>
using namespace NRainCheck;
Y_UNIT_TEST_SUITE(TaskTracker) {
struct TTaskForTracker: public ISimpleTask {
TTestSync* const TestSync;
TTaskForTracker(TTestEnv*, TTestSync* testSync)
: TestSync(testSync)
{
}
TContinueFunc Start() override {
TestSync->WaitForAndIncrement(0);
TestSync->WaitForAndIncrement(2);
return nullptr;
}
};
Y_UNIT_TEST(Simple) {
TTestEnv env;
TIntrusivePtr<TTaskTracker> tracker(new TTaskTracker(env.GetExecutor()));
TTestSync testSync;
tracker->Spawn<TTaskForTracker>(&env, &testSync);
testSync.WaitFor(1);
UNIT_ASSERT_VALUES_EQUAL(1u, tracker->Size());
testSync.CheckAndIncrement(1);
testSync.WaitForAndIncrement(3);
tracker->Shutdown();
}
}
|