1 #include "rxcpp/rx.hpp"
2 
3 #include "rxcpp/rx-test.hpp"
4 #include "catch.hpp"
5 
6 SCENARIO("iterate sample"){
7     printf("//! [iterate sample]\n");
8     std::array< int, 3 > a={{1, 2, 3}};
9     auto values = rxcpp::observable<>::iterate(a);
10     values.
11         subscribe(
__anonaa6ec8d60102(int v)12             [](int v){printf("OnNext: %d\n", v);},
__anonaa6ec8d60202()13             [](){printf("OnCompleted\n");});
14     printf("//! [iterate sample]\n");
15 }
16 
17 SCENARIO("threaded iterate sample"){
18     printf("//! [threaded iterate sample]\n");
19     std::array< int, 3 > a={{1, 2, 3}};
20     auto values = rxcpp::observable<>::iterate(a, rxcpp::observe_on_event_loop());
21     values.
22         as_blocking().
23         subscribe(
__anonaa6ec8d60302(int v)24             [](int v){printf("OnNext: %d\n", v);},
__anonaa6ec8d60402()25             [](){printf("OnCompleted\n");});
26     printf("//! [threaded iterate sample]\n");
27 }
28