summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirk Shoop <kirk.shoop@microsoft.com>2015-07-23 08:59:00 -0700
committerKirk Shoop <kirk.shoop@microsoft.com>2015-07-23 16:18:46 -0700
commit36f031be7b825f5e5b3579c906f857e7a6ad4821 (patch)
tree349f07bae3d17161e75fc44c15fa08ab55cdecac
parentdb0c195f2f042d8e4afd052adbf8cb1bb12cfa91 (diff)
downloadRxCpp-36f031be7b825f5e5b3579c906f857e7a6ad4821.tar.gz
make a binary and test for each test cpp file
-rw-r--r--.travis.yml4
-rw-r--r--Rx/v2/test/CMakeLists.txt59
-rw-r--r--Rx/v2/test/operators/combine_latest.1.cpp730
-rw-r--r--Rx/v2/test/operators/combine_latest.cpp (renamed from Rx/v2/test/operators/combine_latest.2.cpp)738
-rw-r--r--Rx/v2/test/operators/zip.1.cpp942
-rw-r--r--Rx/v2/test/operators/zip.2.cpp949
-rw-r--r--Rx/v2/test/operators/zip.cpp1885
-rw-r--r--appveyor.yml6
8 files changed, 2654 insertions, 2659 deletions
diff --git a/.travis.yml b/.travis.yml
index a007ab8..b2f62df 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -65,7 +65,9 @@ install:
- cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${CXX_LINKER_FLAGS}"
script:
- make VERBOSE=1 $PROJECT
-- if [ "$RUN_TEST" == "On" ]; then build/test/rxcppv2_test; fi
+- if [ "$RUN_TEST" == "On" ]; then cd build/test/; fi
+- if [ "$RUN_TEST" == "On" ]; then ctest -V; fi
+- if [ "$RUN_TEST" == "On" ]; then cd ../../; fi
after_success:
- if [ "$PUBLISH_DOCS" == "On" ]; then sh projects/scripts/travis-doxygen.sh; fi
branches:
diff --git a/Rx/v2/test/CMakeLists.txt b/Rx/v2/test/CMakeLists.txt
index 70f4cab..5fde194 100644
--- a/Rx/v2/test/CMakeLists.txt
+++ b/Rx/v2/test/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-project(rxcppv2_test LANGUAGES C CXX)
+project(rxcpp_test LANGUAGES C CXX)
# define some folders
@@ -12,11 +12,13 @@ MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
include(${RXCPP_DIR}/projects/CMake/shared.cmake)
+# configure unit tests via CTest
+enable_testing()
+
set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test)
# define the sources of the self test
set(TEST_SOURCES
- ${TEST_DIR}/test.cpp
${TEST_DIR}/subscriptions/observer.cpp
${TEST_DIR}/subscriptions/subscription.cpp
${TEST_DIR}/subjects/subject.cpp
@@ -28,8 +30,7 @@ set(TEST_SOURCES
${TEST_DIR}/operators/amb.cpp
${TEST_DIR}/operators/amb_variadic.cpp
${TEST_DIR}/operators/buffer.cpp
- ${TEST_DIR}/operators/combine_latest.1.cpp
- ${TEST_DIR}/operators/combine_latest.2.cpp
+ ${TEST_DIR}/operators/combine_latest.cpp
${TEST_DIR}/operators/concat.cpp
${TEST_DIR}/operators/concat_map.cpp
${TEST_DIR}/operators/distinct_until_changed.cpp
@@ -56,10 +57,11 @@ set(TEST_SOURCES
${TEST_DIR}/operators/take_until.cpp
${TEST_DIR}/operators/tap.cpp
${TEST_DIR}/operators/window.cpp
- ${TEST_DIR}/operators/zip.1.cpp
- ${TEST_DIR}/operators/zip.2.cpp
+ ${TEST_DIR}/operators/zip.cpp
)
-add_executable(rxcppv2_test ${TEST_SOURCES})
+
+
+add_executable(rxcppv2_test EXCLUDE_FROM_ALL ${TEST_DIR}/test.cpp ${TEST_SOURCES})
add_executable(rxcpp::tests ALIAS rxcppv2_test)
target_compile_options(rxcppv2_test PUBLIC ${RX_COMPILE_OPTIONS})
target_compile_features(rxcppv2_test PUBLIC ${RX_COMPILE_FEATURES})
@@ -68,29 +70,30 @@ target_include_directories(rxcppv2_test
)
target_link_libraries(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT})
-# define the sources of the self test
-set(ONE_SOURCES
- ${TEST_DIR}/test.cpp
- #${TEST_DIR}/operators/tap.cpp
- #${TEST_DIR}/operators/on_error_resume_next.cpp
-)
-add_executable(one_test ${ONE_SOURCES})
-add_executable(rxcpp::one_test ALIAS one_test)
-target_compile_options(one_test PUBLIC ${RX_COMPILE_OPTIONS})
-target_compile_features(one_test PUBLIC ${RX_COMPILE_FEATURES})
-target_include_directories(one_test
- PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}
- )
-target_link_libraries(one_test ${CMAKE_THREAD_LIBS_INIT})
+#add_test(NAME RunTests COMMAND rxcppv2_test)
-# configure unit tests via CTest
-enable_testing()
+#add_test(NAME ListTests COMMAND rxcppv2_test --list-tests)
+#set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases")
+
+#add_test(NAME ListTags COMMAND rxcppv2_test --list-tags)
+#set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
+
+foreach(ONE_TEST_SOURCE ${TEST_SOURCES})
+ get_filename_component(ONE_TEST_NAME "${ONE_TEST_SOURCE}" NAME)
+ string( REPLACE ".cpp" "" ONE_TEST_NAME ${ONE_TEST_NAME})
+ set(ONE_TEST_FULL_NAME "rxcpp_test_${ONE_TEST_NAME}")
+ add_executable( ${ONE_TEST_FULL_NAME} ${ONE_TEST_SOURCE} )
+ add_executable( rxcpp::${ONE_TEST_NAME} ALIAS ${ONE_TEST_FULL_NAME})
+ target_compile_definitions(${ONE_TEST_FULL_NAME} PUBLIC "CATCH_CONFIG_MAIN")
+ target_compile_options(${ONE_TEST_FULL_NAME} PUBLIC ${RX_COMPILE_OPTIONS})
+ target_compile_features(${ONE_TEST_FULL_NAME} PUBLIC ${RX_COMPILE_FEATURES})
+ target_include_directories(${ONE_TEST_FULL_NAME}
+ PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}
+ )
+ target_link_libraries(${ONE_TEST_FULL_NAME} ${CMAKE_THREAD_LIBS_INIT})
-add_test(NAME RunTests COMMAND rxcppv2_test)
+ add_test(NAME ${ONE_TEST_NAME} COMMAND ${ONE_TEST_FULL_NAME})
+endforeach(ONE_TEST_SOURCE ${TEST_SOURCES})
-add_test(NAME ListTests COMMAND rxcppv2_test --list-tests)
-set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases")
-add_test(NAME ListTags COMMAND rxcppv2_test --list-tags)
-set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
diff --git a/Rx/v2/test/operators/combine_latest.1.cpp b/Rx/v2/test/operators/combine_latest.1.cpp
deleted file mode 100644
index 04d98b4..0000000
--- a/Rx/v2/test/operators/combine_latest.1.cpp
+++ /dev/null
@@ -1,730 +0,0 @@
-#include "rxcpp/rx.hpp"
-namespace rxu=rxcpp::util;
-namespace rxsc=rxcpp::schedulers;
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.next(230, 5),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(220, 2 + 3),
- on.next(225, 4 + 3),
- on.next(230, 4 + 5),
- on.next(235, 4 + 6),
- on.next(240, 4 + 7),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest consecutive", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(235, 4 + 6),
- on.next(240, 4 + 7),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest consecutive ends with error left", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.error(230, ex)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error"){
- auto required = rxu::to_vector({
- on.error(230, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest consecutive ends with error right", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(250)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.error(245, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints followed by an error"){
- auto required = rxu::to_vector({
- on.next(235, 4 + 6),
- on.next(240, 4 + 7),
- on.error(245, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest never N", "[combine_latest][join][operators]"){
- GIVEN("N never completed hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 16;
-
- std::vector<rxcpp::test::testable_observable<int>> n;
- for (int i = 0; i < N; ++i) {
- n.push_back(
- sc.make_hot_observable({
- on.next(150, 1)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n[0]
- .combine_latest(
- [](int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){
- return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15;
- },
- n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14], n[15]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(n.begin(), n.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("combine_latest empty N", "[combine_latest][join][operators]"){
- GIVEN("N empty hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 16;
-
- std::vector<rxcpp::test::testable_observable<int>> e;
- for (int i = 0; i < N; ++i) {
- e.push_back(
- sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210 + 10 * i)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e[0]
- .combine_latest(
- [](int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){
- return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15;
- },
- e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(200 + 10 * N)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- int i = 0;
- std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 200 + 10 * ++i)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("combine_latest never/empty", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest empty/never", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest empty/return", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest return/empty", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest never/return", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest return/never", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
diff --git a/Rx/v2/test/operators/combine_latest.2.cpp b/Rx/v2/test/operators/combine_latest.cpp
index de7167a..51e6819 100644
--- a/Rx/v2/test/operators/combine_latest.2.cpp
+++ b/Rx/v2/test/operators/combine_latest.cpp
@@ -5,6 +5,730 @@ namespace rxsc=rxcpp::schedulers;
#include "rxcpp/rx-test.hpp"
#include "catch.hpp"
+SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.next(225, 4),
+ on.completed(230)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(220, 3),
+ on.next(230, 5),
+ on.next(235, 6),
+ on.next(240, 7),
+ on.completed(250)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints"){
+ auto required = rxu::to_vector({
+ on.next(220, 2 + 3),
+ on.next(225, 4 + 3),
+ on.next(230, 4 + 5),
+ on.next(235, 4 + 6),
+ on.next(240, 4 + 7),
+ on.completed(250)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 230)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 250)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest consecutive", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.next(225, 4),
+ on.completed(230)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(235, 6),
+ on.next(240, 7),
+ on.completed(250)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints"){
+ auto required = rxu::to_vector({
+ on.next(235, 4 + 6),
+ on.next(240, 4 + 7),
+ on.completed(250)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 230)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 250)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest consecutive ends with error left", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("combine_latest on_error from source");
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.next(225, 4),
+ on.error(230, ex)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(235, 6),
+ on.next(240, 7),
+ on.completed(250)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only an error"){
+ auto required = rxu::to_vector({
+ on.error(230, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 230)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 230)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest consecutive ends with error right", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("combine_latest on_error from source");
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.next(225, 4),
+ on.completed(250)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(235, 6),
+ on.next(240, 7),
+ on.error(245, ex)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints followed by an error"){
+ auto required = rxu::to_vector({
+ on.next(235, 4 + 6),
+ on.next(240, 4 + 7),
+ on.error(245, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 245)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 245)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest never N", "[combine_latest][join][operators]"){
+ GIVEN("N never completed hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ const int N = 4;
+
+ std::vector<rxcpp::test::testable_observable<int>> n;
+ for (int i = 0; i < N; ++i) {
+ n.push_back(
+ sc.make_hot_observable({
+ on.next(150, 1)
+ })
+ );
+ }
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return n[0]
+ .combine_latest(
+ [](int v0, int v1, int v2, int v3){
+ return v0 + v1 + v2 + v3;
+ },
+ n[1], n[2], n[3]
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to each observable"){
+
+ std::for_each(n.begin(), n.end(), [&](rxcpp::test::testable_observable<int> &s){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = s.subscriptions();
+ REQUIRE(required == actual);
+ });
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest empty N", "[combine_latest][join][operators]"){
+ GIVEN("N empty hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ const int N = 4;
+
+ std::vector<rxcpp::test::testable_observable<int>> e;
+ for (int i = 0; i < N; ++i) {
+ e.push_back(
+ sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210 + 10 * i)
+ })
+ );
+ }
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return e[0]
+ .combine_latest(
+ [](int v0, int v1, int v2, int v3){
+ return v0 + v1 + v2 + v3;
+ },
+ e[1], e[2], e[3]
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only complete message"){
+ auto required = rxu::to_vector({
+ on.completed(200 + 10 * N)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to each observable"){
+
+ int i = 0;
+ std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 200 + 10 * ++i)
+ });
+ auto actual = s.subscriptions();
+ REQUIRE(required == actual);
+ });
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest never/empty", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ auto e = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return n
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ e
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the e"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest empty/never", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto e = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return e
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ n
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the e"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest empty/return", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto e = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ auto o = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(220)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return e
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only complete message"){
+ auto required = rxu::to_vector({
+ on.completed(220)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the e"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest return/empty", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(220)
+ });
+
+ auto e = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ e
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only complete message"){
+ auto required = rxu::to_vector({
+ on.completed(220)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the e"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest never/return", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ auto o = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(220)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return n
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("combine_latest return/never", "[combine_latest][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(220)
+ });
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o
+ .combine_latest(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ n
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+
SCENARIO("combine_latest return/return", "[combine_latest][join][operators]"){
GIVEN("2 hot observables of ints."){
auto sc = rxsc::make_test();
@@ -814,7 +1538,7 @@ SCENARIO("combine_latest selector throws N", "[combine_latest][join][operators]"
auto w = sc.create_worker();
const rxsc::test::messages<int> on;
- const int N = 16;
+ const int N = 4;
std::runtime_error ex("combine_latest on_error from source");
@@ -834,10 +1558,10 @@ SCENARIO("combine_latest selector throws N", "[combine_latest][join][operators]"
[&]() {
return e[0]
.combine_latest(
- [&ex](int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) -> int {
+ [&ex](int, int, int, int) -> int {
throw ex;
},
- e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]
+ e[1], e[2], e[3]
)
// forget type to workaround lambda deduction bug on msvc 2013
.as_dynamic();
@@ -872,7 +1596,7 @@ SCENARIO("combine_latest typical N", "[combine_latest][join][operators]"){
auto w = sc.create_worker();
const rxsc::test::messages<int> on;
- const int N = 16;
+ const int N = 4;
std::vector<rxcpp::test::testable_observable<int>> o;
for (int i = 0; i < N; ++i) {
@@ -892,10 +1616,10 @@ SCENARIO("combine_latest typical N", "[combine_latest][join][operators]"){
[&]() {
return o[0]
.combine_latest(
- [](int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15) {
- return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15;
+ [](int v0, int v1, int v2, int v3) {
+ return v0 + v1 + v2 + v3;
},
- o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9], o[10], o[11], o[12], o[13], o[14], o[15]
+ o[1], o[2], o[3]
)
// forget type to workaround lambda deduction bug on msvc 2013
.as_dynamic();
diff --git a/Rx/v2/test/operators/zip.1.cpp b/Rx/v2/test/operators/zip.1.cpp
deleted file mode 100644
index cf0c8a4..0000000
--- a/Rx/v2/test/operators/zip.1.cpp
+++ /dev/null
@@ -1,942 +0,0 @@
-#include "rxcpp/rx.hpp"
-namespace rxu=rxcpp::util;
-namespace rxsc=rxcpp::schedulers;
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("zip never/never", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n1 = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto n2 = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- n2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip never N", "[zip][join][operators]"){
- GIVEN("N never completed hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const std::size_t N = 16;
-
- std::vector<rxcpp::test::testable_observable<int>> n;
- for (std::size_t i = 0; i < N; ++i) {
- n.push_back(
- sc.make_hot_observable({
- on.next(150, 1)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n[0]
- .zip(
- [](int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){
- return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15;
- },
- n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14], n[15]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(n.begin(), n.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("zip never/empty", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip empty/never", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip empty/empty", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e1 = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto e2 = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- e2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(210)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip empty N", "[zip][join][operators]"){
- GIVEN("N empty hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 16;
-
- std::vector<rxcpp::test::testable_observable<int>> e;
- for (int i = 0; i < N; ++i) {
- e.push_back(
- sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210 + 10 * i)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e[0]
- .zip(
- [](int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){
- return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15;
- },
- e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(200 + 10 * N)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- int i = 0;
- std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 200 + 10 * ++i)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("zip empty/return", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip return/empty", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip never/return", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip return/never", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip return/return", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.completed(240)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(220, 2 + 3),
- on.completed(240)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 240)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip empty/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto emp = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(230)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return emp
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the emp"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = emp.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/empty", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto emp = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(230)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- emp
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the emp"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = emp.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip never/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/never", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("zip on_error from source 1");
- std::runtime_error ex2("zip on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex1)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/zip.2.cpp b/Rx/v2/test/operators/zip.2.cpp
deleted file mode 100644
index d56cb83..0000000
--- a/Rx/v2/test/operators/zip.2.cpp
+++ /dev/null
@@ -1,949 +0,0 @@
-#include "rxcpp/rx.hpp"
-namespace rxu=rxcpp::util;
-namespace rxsc=rxcpp::schedulers;
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("zip return/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(230)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/return", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(230)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- ret
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip left completes first", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(220)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 4),
- on.completed(225)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(215, 2 + 4),
- on.completed(225)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip right completes first", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 4),
- on.completed(225)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(215, 2 + 4),
- on.completed(225)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip selector throws", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.completed(240)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o1
- .zip(
- [&ex](int, int) -> int {
- throw ex;
- },
- o2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip selector throws N", "[zip][join][operators]"){
- GIVEN("N hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 16;
-
- std::runtime_error ex("zip on_error from source");
-
- std::vector<rxcpp::test::testable_observable<int>> e;
- for (int i = 0; i < N; ++i) {
- e.push_back(
- sc.make_hot_observable({
- on.next(210 + 10 * i, 1),
- on.completed(500)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e[0]
- .zip(
- [&ex](int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) -> int {
- throw ex;
- },
- e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error"){
- auto required = rxu::to_vector({
- on.error(200 + 10 * N, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 200 + 10 * N)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("zip typical N", "[zip][join][operators]"){
- GIVEN("N hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 16;
-
- std::vector<rxcpp::test::testable_observable<int>> o;
- for (int i = 0; i < N; ++i) {
- o.push_back(
- sc.make_hot_observable({
- on.next(150, 1),
- on.next(210 + 10 * i, i + 1),
- on.next(410 + 10 * i, i + N + 1),
- on.completed(800)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o[0]
- .zip(
- [](int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15) {
- return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15;
- },
- o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9], o[10], o[11], o[12], o[13], o[14], o[15]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(200 + 10 * N, N * (N + 1) / 2),
- on.next(400 + 10 * N, N * (3 * N + 1) / 2)
- });
- required.push_back(on.completed(800));
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(o.begin(), o.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 800)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("zip interleaved with tail", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.next(230, 5),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(220, 2 + 3),
- on.next(230, 4 + 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip consecutive", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(235, 2 + 6),
- on.next(240, 4 + 7),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip consecutive ends with error left", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.error(230, ex)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error"){
- auto required = rxu::to_vector({
- on.error(230, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip consecutive ends with error right", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(250)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.error(245, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints followed by an error"){
- auto required = rxu::to_vector({
- on.next(235, 2 + 6),
- on.next(240, 4 + 7),
- on.error(245, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip next+error/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("zip on_error from source 1");
- std::runtime_error ex2("zip on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(220, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex1)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/next+error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("zip on_error from source 1");
- std::runtime_error ex2("zip on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(220, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex2)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error after completed left", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(215)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return ret
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error after completed right", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(215)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- ret
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/zip.cpp b/Rx/v2/test/operators/zip.cpp
new file mode 100644
index 0000000..047edb2
--- /dev/null
+++ b/Rx/v2/test/operators/zip.cpp
@@ -0,0 +1,1885 @@
+#include "rxcpp/rx.hpp"
+namespace rxu=rxcpp::util;
+namespace rxsc=rxcpp::schedulers;
+
+#include "rxcpp/rx-test.hpp"
+#include "catch.hpp"
+
+SCENARIO("zip never/never", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto n1 = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ auto n2 = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return n1
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ n2
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip never N", "[zip][join][operators]"){
+ GIVEN("N never completed hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ const std::size_t N = 4;
+
+ std::vector<rxcpp::test::testable_observable<int>> n;
+ for (std::size_t i = 0; i < N; ++i) {
+ n.push_back(
+ sc.make_hot_observable({
+ on.next(150, 1)
+ })
+ );
+ }
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return n[0]
+ .zip(
+ [](int v0, int v1, int v2, int v3){
+ return v0 + v1 + v2 + v3;
+ },
+ n[1], n[2], n[3]
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to each observable"){
+
+ std::for_each(n.begin(), n.end(), [&](rxcpp::test::testable_observable<int> &s){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = s.subscriptions();
+ REQUIRE(required == actual);
+ });
+ }
+ }
+ }
+}
+
+SCENARIO("zip never/empty", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ auto e = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return n
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ e
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the e"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip empty/never", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto e = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return e
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ n
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the e"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip empty/empty", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto e1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ auto e2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return e1
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ e2
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only complete message"){
+ auto required = rxu::to_vector({
+ on.completed(210)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the e"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip empty N", "[zip][join][operators]"){
+ GIVEN("N empty hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ const int N = 4;
+
+ std::vector<rxcpp::test::testable_observable<int>> e;
+ for (int i = 0; i < N; ++i) {
+ e.push_back(
+ sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210 + 10 * i)
+ })
+ );
+ }
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return e[0]
+ .zip(
+ [](int v0, int v1, int v2, int v3){
+ return v0 + v1 + v2 + v3;
+ },
+ e[1], e[2], e[3]
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only complete message"){
+ auto required = rxu::to_vector({
+ on.completed(200 + 10 * N)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to each observable"){
+
+ int i = 0;
+ std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 200 + 10 * ++i)
+ });
+ auto actual = s.subscriptions();
+ REQUIRE(required == actual);
+ });
+ }
+ }
+ }
+}
+
+SCENARIO("zip empty/return", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto e = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ auto o = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(220)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return e
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only complete message"){
+ auto required = rxu::to_vector({
+ on.completed(220)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the e"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip return/empty", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(220)
+ });
+
+ auto e = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(210)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ e
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only complete message"){
+ auto required = rxu::to_vector({
+ on.completed(220)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the e"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 210)
+ });
+ auto actual = e.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip never/return", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ auto o = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(220)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return n
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip return/never", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(220)
+ });
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ n
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output is empty"){
+ auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 1000)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip return/return", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(230)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(220, 3),
+ on.completed(240)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o1
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o2
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints"){
+ auto required = rxu::to_vector({
+ on.next(220, 2 + 3),
+ on.completed(240)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 230)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 240)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip empty/error", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto emp = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(230)
+ });
+
+ auto err = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(220, ex)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return emp
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ err
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the emp"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = emp.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip error/empty", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto err = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(220, ex)
+ });
+
+ auto emp = sc.make_hot_observable({
+ on.next(150, 1),
+ on.completed(230)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return err
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ emp
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the emp"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = emp.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip never/error", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ auto err = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(220, ex)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return n
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ err
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip error/never", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto err = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(220, ex)
+ });
+
+ auto n = sc.make_hot_observable({
+ on.next(150, 1)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return err
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ n
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the n"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = n.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip error/error", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex1("zip on_error from source 1");
+ std::runtime_error ex2("zip on_error from source 2");
+
+ auto err1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(220, ex1)
+ });
+
+ auto err2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(230, ex2)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return err1
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ err2
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex1)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip return/error", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto o = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(210, 2),
+ on.completed(230)
+ });
+
+ auto err = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(220, ex)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ err
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the ret"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip error/return", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto err = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(220, ex)
+ });
+
+ auto ret = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(210, 2),
+ on.completed(230)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return err
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ ret
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the ret"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = ret.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip left completes first", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(210, 2),
+ on.completed(220)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 4),
+ on.completed(225)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints"){
+ auto required = rxu::to_vector({
+ on.next(215, 2 + 4),
+ on.completed(225)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 225)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip right completes first", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 4),
+ on.completed(225)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(210, 2),
+ on.completed(220)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints"){
+ auto required = rxu::to_vector({
+ on.next(215, 2 + 4),
+ on.completed(225)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 225)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip selector throws", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.completed(230)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(220, 3),
+ on.completed(240)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o1
+ .zip(
+ [&ex](int, int) -> int {
+ throw ex;
+ },
+ o2
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error"){
+ auto required = rxu::to_vector({
+ on.error(220, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip selector throws N", "[zip][join][operators]"){
+ GIVEN("N hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ const int N = 4;
+
+ std::runtime_error ex("zip on_error from source");
+
+ std::vector<rxcpp::test::testable_observable<int>> e;
+ for (int i = 0; i < N; ++i) {
+ e.push_back(
+ sc.make_hot_observable({
+ on.next(210 + 10 * i, 1),
+ on.completed(500)
+ })
+ );
+ }
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return e[0]
+ .zip(
+ [&ex](int, int, int, int) -> int {
+ throw ex;
+ },
+ e[1], e[2], e[3]
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error"){
+ auto required = rxu::to_vector({
+ on.error(200 + 10 * N, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to each observable"){
+
+ std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 200 + 10 * N)
+ });
+ auto actual = s.subscriptions();
+ REQUIRE(required == actual);
+ });
+ }
+ }
+ }
+}
+
+SCENARIO("zip typical N", "[zip][join][operators]"){
+ GIVEN("N hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ const int N = 4;
+
+ std::vector<rxcpp::test::testable_observable<int>> o;
+ for (int i = 0; i < N; ++i) {
+ o.push_back(
+ sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(210 + 10 * i, i + 1),
+ on.next(410 + 10 * i, i + N + 1),
+ on.completed(800)
+ })
+ );
+ }
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o[0]
+ .zip(
+ [](int v0, int v1, int v2, int v3) {
+ return v0 + v1 + v2 + v3;
+ },
+ o[1], o[2], o[3]
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints"){
+ auto required = rxu::to_vector({
+ on.next(200 + 10 * N, N * (N + 1) / 2),
+ on.next(400 + 10 * N, N * (3 * N + 1) / 2)
+ });
+ required.push_back(on.completed(800));
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to each observable"){
+
+ std::for_each(o.begin(), o.end(), [&](rxcpp::test::testable_observable<int> &s){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 800)
+ });
+ auto actual = s.subscriptions();
+ REQUIRE(required == actual);
+ });
+ }
+ }
+ }
+}
+
+SCENARIO("zip interleaved with tail", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.next(225, 4),
+ on.completed(230)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(220, 3),
+ on.next(230, 5),
+ on.next(235, 6),
+ on.next(240, 7),
+ on.completed(250)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints"){
+ auto required = rxu::to_vector({
+ on.next(220, 2 + 3),
+ on.next(230, 4 + 5),
+ on.completed(250)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 230)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 250)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip consecutive", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.next(225, 4),
+ on.completed(230)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(235, 6),
+ on.next(240, 7),
+ on.completed(250)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints"){
+ auto required = rxu::to_vector({
+ on.next(235, 2 + 6),
+ on.next(240, 4 + 7),
+ on.completed(250)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 230)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 250)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip consecutive ends with error left", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.next(225, 4),
+ on.error(230, ex)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(235, 6),
+ on.next(240, 7),
+ on.completed(250)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only an error"){
+ auto required = rxu::to_vector({
+ on.error(230, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 230)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 230)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip consecutive ends with error right", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto o1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(215, 2),
+ on.next(225, 4),
+ on.completed(250)
+ });
+
+ auto o2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(235, 6),
+ on.next(240, 7),
+ on.error(245, ex)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return o2
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ o1
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains combined ints followed by an error"){
+ auto required = rxu::to_vector({
+ on.next(235, 2 + 6),
+ on.next(240, 4 + 7),
+ on.error(245, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 245)
+ });
+ auto actual = o1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the o2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 245)
+ });
+ auto actual = o2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip next+error/error", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex1("zip on_error from source 1");
+ std::runtime_error ex2("zip on_error from source 2");
+
+ auto err1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(210, 2),
+ on.error(220, ex1)
+ });
+
+ auto err2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(230, ex2)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return err1
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ err2
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex1)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip error/next+error", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex1("zip on_error from source 1");
+ std::runtime_error ex2("zip on_error from source 2");
+
+ auto err1 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(230, ex1)
+ });
+
+ auto err2 = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(210, 2),
+ on.error(220, ex2)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return err1
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ err2
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex2)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err1"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err1.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err2"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err2.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip error after completed left", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto ret = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(210, 2),
+ on.completed(215)
+ });
+
+ auto err = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(220, ex)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return ret
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ err
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the ret"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 215)
+ });
+ auto actual = ret.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
+
+SCENARIO("zip error after completed right", "[zip][join][operators]"){
+ GIVEN("2 hot observables of ints."){
+ auto sc = rxsc::make_test();
+ auto w = sc.create_worker();
+ const rxsc::test::messages<int> on;
+
+ std::runtime_error ex("zip on_error from source");
+
+ auto err = sc.make_hot_observable({
+ on.next(150, 1),
+ on.error(220, ex)
+ });
+
+ auto ret = sc.make_hot_observable({
+ on.next(150, 1),
+ on.next(210, 2),
+ on.completed(215)
+ });
+
+ WHEN("each int is combined with the latest from the other source"){
+
+ auto res = w.start(
+ [&]() {
+ return err
+ .zip(
+ [](int v2, int v1){
+ return v2 + v1;
+ },
+ ret
+ )
+ // forget type to workaround lambda deduction bug on msvc 2013
+ .as_dynamic();
+ }
+ );
+
+ THEN("the output contains only error message"){
+ auto required = rxu::to_vector({
+ on.error(220, ex)
+ });
+ auto actual = res.get_observer().messages();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the ret"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 215)
+ });
+ auto actual = ret.subscriptions();
+ REQUIRE(required == actual);
+ }
+
+ THEN("there was one subscription and one unsubscription to the err"){
+ auto required = rxu::to_vector({
+ on.subscribe(200, 220)
+ });
+ auto actual = err.subscriptions();
+ REQUIRE(required == actual);
+ }
+ }
+ }
+}
diff --git a/appveyor.yml b/appveyor.yml
index 304ee3c..a6d45d8 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -24,7 +24,9 @@ build:
project: build\rxcpp.sln
test_script:
- - build\test\Debug\rxcppv2_test.exe
+ - cd build\test\
+ - ctest -V
+ - cd ..\..
artifacts:
- path: Rx\v2\src\
@@ -36,6 +38,6 @@ artifacts:
notifications:
- provider: Slack
- auth_token:
+ auth_token:
secure: qaGjbI98VXZa7Zd2s3RmMzfA+ymrfWUDuzevdtOcHssEGBXbcoOJzLHNOmG+Y1nX
channel: rxcpp