summaryrefslogtreecommitdiff
path: root/Rx/v2/examples/doxygen/start_with.cpp
blob: 6a40142b46d8d5d6db805d29509d28b1d3335e82 (plain)
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
#include "rxcpp/rx.hpp"

#include "rxcpp/rx-test.hpp"
#include "catch.hpp"

SCENARIO("full start_with sample"){
    printf("//! [full start_with sample]\n");
    auto observable = rxcpp::observable<>::range(10, 12);
    auto values = rxcpp::observable<>::start_with(observable, 1, 2, 3);
    values.
        subscribe(
            [](int v){printf("OnNext: %d\n", v);},
            [](){printf("OnCompleted\n");});
    printf("//! [full start_with sample]\n");
}

SCENARIO("short start_with sample"){
    printf("//! [short start_with sample]\n");
    auto values = rxcpp::observable<>::range(10, 12).
        start_with(1, 2, 3);
    values.
        subscribe(
            [](int v){printf("OnNext: %d\n", v);},
            [](){printf("OnCompleted\n");});
    printf("//! [short start_with sample]\n");
}