aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/rain_check/test/helper/misc.h
blob: 9150be4d2f3b4afc91e0b23528eb3e857bf90728 (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
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once

#include <library/cpp/messagebus/rain_check/core/rain_check.h>

#include <array>

namespace NRainCheck {
    struct TNopSimpleTask: public ISimpleTask {
        TNopSimpleTask(IEnv*, const void*) {
        }

        TContinueFunc Start() override {
            return nullptr;
        }
    };

    struct TNopCoroTask: public ICoroTask {
        TNopCoroTask(IEnv*, const void*) {
        }

        void Run() override {
        }
    };

    struct TSpawnNopTasksCoroTask: public ICoroTask {
        IEnv* const Env;
        unsigned const Count;

        TSpawnNopTasksCoroTask(IEnv* env, unsigned count)
            : Env(env)
            , Count(count)
        {
        }

        std::array<TSubtaskCompletion, 2> Completion;

        void Run() override;
    };

    struct TSpawnNopTasksSimpleTask: public ISimpleTask {
        IEnv* const Env;
        unsigned const Count;

        TSpawnNopTasksSimpleTask(IEnv* env, unsigned count)
            : Env(env)
            , Count(count)
        {
        }

        std::array<TSubtaskCompletion, 2> Completion;

        TContinueFunc Start() override;

        TContinueFunc Join();
    };

}