aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/actor/tasks_ut.cpp
blob: d80e8451a5045e1bf8be9a87a2e6e94284574cf3 (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
#include <library/cpp/testing/unittest/registar.h>

#include "tasks.h"

using namespace NActor;

Y_UNIT_TEST_SUITE(TTasks) {
    Y_UNIT_TEST(AddTask_FetchTask_Simple) {
        TTasks tasks;

        UNIT_ASSERT(tasks.AddTask());
        UNIT_ASSERT(!tasks.AddTask());
        UNIT_ASSERT(!tasks.AddTask());

        UNIT_ASSERT(tasks.FetchTask());
        UNIT_ASSERT(!tasks.FetchTask());

        UNIT_ASSERT(tasks.AddTask());
    }

    Y_UNIT_TEST(AddTask_FetchTask_AddTask) {
        TTasks tasks;

        UNIT_ASSERT(tasks.AddTask());
        UNIT_ASSERT(!tasks.AddTask());

        UNIT_ASSERT(tasks.FetchTask());
        UNIT_ASSERT(!tasks.AddTask());
        UNIT_ASSERT(tasks.FetchTask());
        UNIT_ASSERT(!tasks.AddTask());
        UNIT_ASSERT(!tasks.AddTask());
        UNIT_ASSERT(tasks.FetchTask());
        UNIT_ASSERT(!tasks.FetchTask());

        UNIT_ASSERT(tasks.AddTask());
    }
}