1 #include "rxcpp/rx.hpp"
2 
3 #include "rxcpp/rx-test.hpp"
4 #include "catch.hpp"
5 
6 SCENARIO("concat sample"){
7     printf("//! [concat sample]\n");
8     auto o1 = rxcpp::observable<>::range(1, 3);
9     auto o2 = rxcpp::observable<>::just(4);
10     auto o3 = rxcpp::observable<>::from(5, 6);
11     auto values = o1.concat(o2, o3);
12     values.
13         subscribe(
__anon5ac05ec00102(int v)14             [](int v){printf("OnNext: %d\n", v);},
__anon5ac05ec00202()15             [](){printf("OnCompleted\n");});
16     printf("//! [concat sample]\n");
17 }
18 
19 SCENARIO("implicit concat sample"){
20     printf("//! [implicit concat sample]\n");
21     auto o1 = rxcpp::observable<>::range(1, 3);
22     auto o2 = rxcpp::observable<>::just(4);
23     auto o3 = rxcpp::observable<>::from(5, 6);
24     auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
25     auto values = base.concat();
26     values.
27         subscribe(
__anon5ac05ec00302(int v)28             [](int v){printf("OnNext: %d\n", v);},
__anon5ac05ec00402()29             [](){printf("OnCompleted\n");});
30     printf("//! [implicit concat sample]\n");
31 }
32 
33 SCENARIO("threaded concat sample"){
34     printf("//! [threaded concat sample]\n");
35     auto o1 = rxcpp::observable<>::range(1, 3);
36     auto o2 = rxcpp::observable<>::just(4);
37     auto o3 = rxcpp::observable<>::from(5, 6);
38     auto values = o1.concat(rxcpp::observe_on_new_thread(), o2, o3);
39     values.
40         as_blocking().
41         subscribe(
__anon5ac05ec00502(int v)42             [](int v){printf("OnNext: %d\n", v);},
__anon5ac05ec00602()43             [](){printf("OnCompleted\n");});
44     printf("//! [threaded concat sample]\n");
45 }
46 
47 SCENARIO("threaded implicit concat sample"){
48     printf("//! [threaded implicit concat sample]\n");
49     auto o1 = rxcpp::observable<>::range(1, 3);
50     auto o2 = rxcpp::observable<>::just(4);
51     auto o3 = rxcpp::observable<>::from(5, 6);
52     auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
53     auto values = base.concat(rxcpp::observe_on_new_thread());
54     values.
55         as_blocking().
56         subscribe(
__anon5ac05ec00702(int v)57             [](int v){printf("OnNext: %d\n", v);},
__anon5ac05ec00802()58             [](){printf("OnCompleted\n");});
59     printf("//! [threaded implicit concat sample]\n");
60 }
61