aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/actor/tasks_ut.cpp
blob: ddc97ee5ecb058f49d31d328a714ff3d3bf317c1 (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());
    }
}