diff --git a/.clang-format b/.clang-format index 892d60add..b246583c7 100644 --- a/.clang-format +++ b/.clang-format @@ -68,7 +68,7 @@ RequiresExpressionIndentation: OuterScope FixNamespaceComments: true IncludeBlocks: Regroup IncludeCategories: - - Regex: '^<(snitch|nanobench).*>' + - Regex: '^<(catch|nanobench).*>' Priority: 1 SortPriority: 1 - Regex: '^' diff --git a/.github/workflows/analyzers.yml b/.github/workflows/analyzers.yml index 8f4f46d2e..e4cd67e56 100644 --- a/.github/workflows/analyzers.yml +++ b/.github/workflows/analyzers.yml @@ -47,7 +47,7 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-ci-ubuntu-clang-Release-${{ hashFiles('conanfile.py') }} + key: deps-ci-ubuntu-clang-Release-${{ hashFiles('**/conanfile.py') }} restore-keys: deps-ci-ubuntu-clang-Release - name: conan detect profile @@ -131,7 +131,7 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-ci-ubuntu-clang-Release-${{ hashFiles('conanfile.py') }} + key: deps-ci-ubuntu-clang-Release-${{ hashFiles('**/conanfile.py') }} restore-keys: deps-ci-ubuntu-clang-Release - name: conan detect profile diff --git a/.github/workflows/ci v2.yml b/.github/workflows/ci v2.yml index 82635a7ea..55579cf7a 100644 --- a/.github/workflows/ci v2.yml +++ b/.github/workflows/ci v2.yml @@ -59,7 +59,7 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }}-${{ hashFiles('conanfile.py') }} + key: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }}-${{ hashFiles('**/conanfile.py') }} restore-keys: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }} - name: conan detect profile @@ -110,7 +110,7 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-ci-ubuntu-clang-Release-${{ hashFiles('conanfile.py') }} + key: deps-ci-ubuntu-clang-Release-${{ hashFiles('**/conanfile.py') }} restore-keys: deps-ci-ubuntu-clang-Release - name: conan detect profile @@ -187,7 +187,7 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }}-${{ hashFiles('conanfile.py') }} + key: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }}-${{ hashFiles('**/conanfile.py') }} restore-keys: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }} - name: conan detect profile diff --git a/CMakeLists.txt b/CMakeLists.txt index 31af85e01..5dbec6c2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,9 +52,9 @@ if (RPP_BUILD_TESTS OR RPP_BUILD_BENCHMARKS) macro(add_test_with_coverage TARGET) if (RPP_USE_LLVM_COV) - add_test(NAME ${TARGET} COMMAND ${CMAKE_COMMAND} -E env LLVM_PROFILE_FILE=${RPP_TEST_RESULTS_DIR}/${TARGET}.profraw $ -v full) + add_test(NAME ${TARGET} COMMAND ${CMAKE_COMMAND} -E env LLVM_PROFILE_FILE=${RPP_TEST_RESULTS_DIR}/${TARGET}.profraw $ -v high) else() - add_test(NAME ${TARGET} COMMAND $ -v full) + add_test(NAME ${TARGET} COMMAND $ -v high) endif() endmacro() endif() diff --git a/CMakePresets.json b/CMakePresets.json index 8a5aa475a..2b2c7688d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -144,7 +144,7 @@ "cacheVariables": { "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake/conan_provider.cmake", "CONAN_ARGS": "", - "CONAN_INSTALL_ARGS": "--build=missing;-s=compiler.cppstd=20;-c=tools.system.package_manager:mode=install;-c=tools.system.package_manager:sudo=True" + "CONAN_INSTALL_ARGS": "--build=missing;-s:a compiler.cppstd=20;-c tools.system.package_manager:mode=install;-c tools.system.package_manager:sudo=True" } }, { diff --git a/Readme.md b/Readme.md index f1a3866df..be289269b 100644 --- a/Readme.md +++ b/Readme.md @@ -182,7 +182,7 @@ DEALINGS IN THE SOFTWARE. # Credits: ReactivePlusPlus library uses: - [PVS-Studio](https://pvs-studio.com/pvs-studio/?utm_source=website&utm_medium=github&utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code. -- [snitch](https://github.com/cschreib/snitch) for unit testing only, fetched automatically in case of `RPP_BUILD_TESTS` enabled +- [catch](https://github.com/catchorg/Catch2) for unit testing only, fetched automatically in case of `RPP_BUILD_TESTS` enabled - [trompeloeil](https://github.com/rollbear/trompeloeil) for mocking in unit testing only, fetched automatically in case of `RPP_BUILD_TESTS` enabled - [nanobench](https://github.com/martinus/nanobench) for benchmarking only, fetched automatically in case of `RPP_BUILD_BENCHMARKS` enabled - [RxCpp](https://github.com/ReactiveX/RxCpp) only for comparison of performance between RPP and RxCpp in CI benchmarks. Used as cmake dependency under option diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 7a9bdfa03..cd7a23f8c 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -71,9 +71,10 @@ if (RPP_BUILD_RXCPP AND RPP_BUILD_BENCHMARKS) rpp_fetch_library(rxcpp https://github.com/ReactiveX/RxCpp.git origin/main) endif() -# ===================== Snitch =================== +# ===================== Tests =================== if (RPP_BUILD_TESTS) - rpp_fetch_library(snitch https://github.com/cschreib/snitch.git main) + rpp_fetch_library(Catch2 https://github.com/catchorg/Catch2.git v3.6.0) + target_compile_features(Catch2::Catch2WithMain INTERFACE cxx_std_20) rpp_fetch_library(trompeloeil https://github.com/rollbear/trompeloeil.git main) endif() diff --git a/conanfile.py b/conanfile.py index bc7892cd9..f7bb8f74a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -4,6 +4,7 @@ class RppConan(ConanFile): name = "rpp" settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain" + extension_properties = {"compatibility_cppstd": False} options = { "with_grpc" : [False, True], @@ -23,7 +24,7 @@ class RppConan(ConanFile): def requirements(self): if self.options.with_tests: self.requires("trompeloeil/47") - self.requires("snitch/1.2.3") + self.requires("catch2/3.6.0") if self.options.with_benchmarks: self.requires("nanobench/4.3.11") diff --git a/sonar-project.properties b/sonar-project.properties index 643d5cd75..9df2d58bc 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -8,4 +8,4 @@ sonar.cfamily.llvm-cov.reportPath=build/test_results/coverage.txt sonar.coverage.exclusions=src/tests/**/* sonar.cpd.exclusions=src/tests/**/* sonar.issue.ignore.allfile=a1 -sonar.issue.ignore.allfile.a1.fileRegexp=#include.*snitch +sonar.issue.ignore.allfile.a1.fileRegexp=#include.*catch diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 71ae46e80..855142c86 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -14,7 +14,8 @@ macro(add_test_target target_name module files) set(TARGET ${target_name}) add_executable(${TARGET} ${files}) - target_link_libraries(${TARGET} PRIVATE snitch::snitch trompeloeil::trompeloeil rpp_tests_utils ${module}) + target_link_libraries(${TARGET} PRIVATE Catch2::Catch2WithMain trompeloeil::trompeloeil rpp_tests_utils ${module}) + target_compile_definitions(${TARGET} PRIVATE "CATCH_CONFIG_FAST_COMPILE") set_target_properties(${TARGET} PROPERTIES FOLDER Tests/Suites/${module}) add_test_with_coverage(${TARGET}) @@ -23,6 +24,8 @@ macro(add_test_target target_name module files) rpp_add_qt_support_to_executable(${TARGET}) endif() + target_compile_features(${TARGET} PRIVATE cxx_std_20) + if(MSVC) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd4702) else() diff --git a/src/tests/rpp/test_buffer.cpp b/src/tests/rpp/test_buffer.cpp index 629388a49..82964c588 100644 --- a/src/tests/rpp/test_buffer.cpp +++ b/src/tests/rpp/test_buffer.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -29,18 +30,18 @@ TEST_CASE("buffer bundles items") auto obs = rpp::source::just(1, 2, 3); SECTION("buffer(0) - shall see -{1}-{2}-{3}-|") { - REQUIRE_CALL(*mock, on_next(std::vector{1})).IN_SEQUENCE(s); - REQUIRE_CALL(*mock, on_next(std::vector{2})).IN_SEQUENCE(s); - REQUIRE_CALL(*mock, on_next(std::vector{3})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{1})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{2})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{3})).IN_SEQUENCE(s); REQUIRE_CALL(*mock, on_completed()).IN_SEQUENCE(s); obs | rpp::ops::buffer(0) | rpp::ops::subscribe(mock); } SECTION("buffer(1) - shall see -{1}-{2}-{3}-|") { - REQUIRE_CALL(*mock, on_next(std::vector{1})).IN_SEQUENCE(s); - REQUIRE_CALL(*mock, on_next(std::vector{2})).IN_SEQUENCE(s); - REQUIRE_CALL(*mock, on_next(std::vector{3})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{1})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{2})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{3})).IN_SEQUENCE(s); REQUIRE_CALL(*mock, on_completed()).IN_SEQUENCE(s); obs | rpp::ops::buffer(1) @@ -48,8 +49,8 @@ TEST_CASE("buffer bundles items") } SECTION("buffer(2) - shall see -{1,2}-{3}|") { - REQUIRE_CALL(*mock, on_next(std::vector{1, 2})).IN_SEQUENCE(s); - REQUIRE_CALL(*mock, on_next(std::vector{3})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{1, 2})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{3})).IN_SEQUENCE(s); REQUIRE_CALL(*mock, on_completed()).IN_SEQUENCE(s); obs | rpp::ops::buffer(2) @@ -57,7 +58,7 @@ TEST_CASE("buffer bundles items") } SECTION("buffer(3) - shall see -{1,2,3}-|") { - REQUIRE_CALL(*mock, on_next(std::vector{1, 2, 3})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{1, 2, 3})).IN_SEQUENCE(s); REQUIRE_CALL(*mock, on_completed()).IN_SEQUENCE(s); obs | rpp::ops::buffer(3) @@ -65,7 +66,7 @@ TEST_CASE("buffer bundles items") } SECTION("buffer(4) - shall see -{1,2,3}-|") { - REQUIRE_CALL(*mock, on_next(std::vector{1, 2, 3})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{1, 2, 3})).IN_SEQUENCE(s); REQUIRE_CALL(*mock, on_completed()).IN_SEQUENCE(s); obs | rpp::ops::buffer(4) @@ -81,7 +82,7 @@ TEST_CASE("buffer bundles items") | rpp::ops::merge(); SECTION("buffer(0) - shall see -{1}-x, which means error event is through") { - REQUIRE_CALL(*mock, on_next(std::vector{1})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{1})).IN_SEQUENCE(s); REQUIRE_CALL(*mock, on_error(trompeloeil::_)).IN_SEQUENCE(s); obs | rpp::ops::buffer(0) @@ -89,7 +90,7 @@ TEST_CASE("buffer bundles items") } SECTION("buffer(1) - shall see -{1}-x, which means error event is through") { - REQUIRE_CALL(*mock, on_next(std::vector{1})).IN_SEQUENCE(s); + REQUIRE_CALL(*mock, on_next_rvalue(std::vector{1})).IN_SEQUENCE(s); REQUIRE_CALL(*mock, on_error(trompeloeil::_)).IN_SEQUENCE(s); obs | rpp::ops::buffer(1) diff --git a/src/tests/rpp/test_combine_latest.cpp b/src/tests/rpp/test_combine_latest.cpp index 42c7b73d0..a395bfd70 100644 --- a/src/tests/rpp/test_combine_latest.cpp +++ b/src/tests/rpp/test_combine_latest.cpp @@ -8,9 +8,9 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include -#include #include #include #include @@ -22,29 +22,36 @@ #include #include "disposable_observable.hpp" -#include "snitch_logging.hpp" +#include "rpp_trompeloil.hpp" TEST_CASE("combine_latest bundles items") { SECTION("observable of -1-2-3-| combines with -4-5-6-| on immediate scheduler") { - auto mock = mock_observer_strategy>{}; + auto mock = mock_observer>{}; + trompeloeil::sequence seq; + + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(1, 6))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(2, 6))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(3, 6))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_completed()).IN_SEQUENCE(seq); + rpp::source::just(rpp::schedulers::immediate{}, 1, 2, 3) | rpp::ops::combine_latest(rpp::source::just(rpp::schedulers::immediate{}, 4, 5, 6)) | rpp::ops::subscribe(mock); - - CHECK(mock.get_received_values() == std::vector>{ - std::make_tuple(1, 6), - std::make_tuple(2, 6), - std::make_tuple(3, 6), - }); - CHECK(mock.get_on_completed_count() == 1); - CHECK(mock.get_on_error_count() == 0); } SECTION("observable of -1-2-3-| combines with -4-5-6-| on current_thread") { - auto mock = mock_observer_strategy>{}; + auto mock = mock_observer>{}; + trompeloeil::sequence seq; + + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(1, 4))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(1, 5))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(2, 5))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(2, 6))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(3, 6))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_completed()).IN_SEQUENCE(seq); rpp::source::just(rpp::schedulers::current_thread{}, 1, 2, 3) // source 1 | rpp::ops::combine_latest(rpp::source::just(rpp::schedulers::current_thread{}, 4, 5, 6)) // source 2 @@ -53,21 +60,21 @@ TEST_CASE("combine_latest bundles items") // Above stream should output in such sequence // source 1: -1---2---3-| // source 2: -4---5---6-| - - CHECK(mock.get_received_values() == std::vector>{ - std::make_tuple(1, 4), - std::make_tuple(1, 5), - std::make_tuple(2, 5), - std::make_tuple(2, 6), - std::make_tuple(3, 6), - }); - CHECK(mock.get_on_completed_count() == 1); - CHECK(mock.get_on_error_count() == 0); } SECTION("observable of -1-2-3-| combines with two other sources on current_thread") { - auto mock = mock_observer_strategy>{}; + auto mock = mock_observer>{}; + trompeloeil::sequence seq; + + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(1, 4, 7))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(1, 5, 7))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(1, 5, 8))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(2, 5, 8))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(2, 6, 8))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(2, 6, 9))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue(std::make_tuple(3, 6, 9))).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_completed()).IN_SEQUENCE(seq); rpp::source::just(rpp::schedulers::current_thread{}, 1, 2, 3) // source 1 | rpp::ops::combine_latest( @@ -79,18 +86,6 @@ TEST_CASE("combine_latest bundles items") // source 1: --1---2---3-| // source 2: -4---5---6-| // source 3: --7---8---9-| - - CHECK(mock.get_received_values() == std::vector>{ - std::make_tuple(1, 4, 7), - std::make_tuple(1, 5, 7), - std::make_tuple(1, 5, 8), - std::make_tuple(2, 5, 8), - std::make_tuple(2, 6, 8), - std::make_tuple(2, 6, 9), - std::make_tuple(3, 6, 9), - }); - CHECK(mock.get_on_completed_count() == 1); - CHECK(mock.get_on_error_count() == 0); } } @@ -98,14 +93,11 @@ TEST_CASE("combine_latest defers completed event") { SECTION("observable of -1-2-3-| and never") { - auto mock = mock_observer_strategy>{}; + auto mock = mock_observer>{}; + rpp::source::just(1, 2, 3) | rpp::ops::combine_latest(rpp::source::never()) | rpp::ops::subscribe(mock); - - CHECK(mock.get_received_values().empty()); - CHECK(mock.get_on_completed_count() == 0); - CHECK(mock.get_on_error_count() == 0); } } @@ -113,44 +105,37 @@ TEST_CASE("combine_latest forwards errors") { SECTION("observable of -1-2-3-| combines with error") { - auto mock = mock_observer_strategy>{}; + auto mock = mock_observer>{}; + REQUIRE_CALL(*mock, on_error(trompeloeil::_)); rpp::source::just(1, 2, 3) | rpp::ops::combine_latest(rpp::source::error(std::make_exception_ptr(std::runtime_error{""}))) | rpp::ops::subscribe(mock); - - CHECK(mock.get_received_values().empty()); - CHECK(mock.get_on_completed_count() == 0); - CHECK(mock.get_on_error_count() == 1); } } TEST_CASE("combine_latest handles race condition") { - SECTION("source observable in current thread pairs with error in other thread") + SECTION("suscribe on source observable in current thread pairs with error in other thread - on_error can't interleave with on_next") { - std::atomic_bool on_error_called{false}; - auto subject = rpp::subjects::publish_subject{}; - - SECTION("subscribe on it") - { - SECTION("on_error can't interleave with on_next") - { - rpp::source::just(1, 1, 1) - | rpp::ops::combine_latest(rpp::source::concat(rpp::source::just(2), subject.get_observable())) - | rpp::ops::as_blocking() - | rpp::ops::subscribe([&](auto&&) { - CHECK(!on_error_called); - std::thread{[&] - { - subject.get_observer().on_error(std::exception_ptr{}); - }}.detach(); - std::this_thread::sleep_for(std::chrono::seconds{1}); - CHECK(!on_error_called); }, - [&](auto) { on_error_called = true; }); - - CHECK(on_error_called); - } - } + auto subject = rpp::subjects::publish_subject{}; + auto mock = mock_observer>{}; + trompeloeil::sequence s{}; + + REQUIRE_CALL(*mock, on_next_rvalue(trompeloeil::_)) + .TIMES(AT_LEAST(1)) + .IN_SEQUENCE(s) + .LR_SIDE_EFFECT({ + std::thread{[subject] { + subject.get_observer().on_error(std::exception_ptr{}); + }}.detach(); + std::this_thread::sleep_for(std::chrono::seconds{1}); + }); + REQUIRE_CALL(*mock, on_error(trompeloeil::_)).IN_SEQUENCE(s); + + rpp::source::just(1, 1, 1) + | rpp::ops::combine_latest(rpp::source::concat(rpp::source::just(2), subject.get_observable())) + | rpp::ops::as_blocking() + | rpp::ops::subscribe(mock); } } @@ -165,5 +150,5 @@ TEST_CASE("combine_latest satisfies disposable contracts") test_operator_finish_before_dispose(op); } - CHECK(observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2); + CHECK((observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2)); } diff --git a/src/tests/rpp/test_concat.cpp b/src/tests/rpp/test_concat.cpp index b362a0b51..3f2527cf1 100644 --- a/src/tests/rpp/test_concat.cpp +++ b/src/tests/rpp/test_concat.cpp @@ -8,9 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include -#include -#include +#include +#include #include #include @@ -25,7 +24,6 @@ #include "copy_count_tracker.hpp" #include "disposable_observable.hpp" -#include "snitch_logging.hpp" #include #include diff --git a/src/tests/rpp/test_connectable_observable.cpp b/src/tests/rpp/test_connectable_observable.cpp index c330287f7..435ac1127 100644 --- a/src/tests/rpp/test_connectable_observable.cpp +++ b/src/tests/rpp/test_connectable_observable.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -25,7 +26,7 @@ TEST_CASE("connectable observable") SECTION("source and connectable observable from it") { auto source = rpp::source::just(1); - auto test = [&mock, &d](auto&& connectable) { + auto test = [&](auto&& connectable) { SECTION("subscribe on connectable") { connectable.subscribe(mock.get_observer(d)); @@ -86,7 +87,7 @@ TEST_CASE("connectable observable") SECTION("subject as source and connectable observable from it") { auto source = rpp::subjects::publish_subject(); - auto test = [&mock, &source, &d](auto&& connectable) { + auto test = [&](auto&& connectable) { SECTION("subscribe on connectable and connect") { connectable.subscribe(mock.get_observer(d)); diff --git a/src/tests/rpp/test_debounce.cpp b/src/tests/rpp/test_debounce.cpp index 39ff61f89..6510a54ec 100644 --- a/src/tests/rpp/test_debounce.cpp +++ b/src/tests/rpp/test_debounce.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_defer.cpp b/src/tests/rpp/test_defer.cpp index 34e73738b..0f841597f 100644 --- a/src/tests/rpp/test_defer.cpp +++ b/src/tests/rpp/test_defer.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_delay.cpp b/src/tests/rpp/test_delay.cpp index b7dcf3069..64dbfdf3c 100644 --- a/src/tests/rpp/test_delay.cpp +++ b/src/tests/rpp/test_delay.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -21,7 +22,6 @@ #include #include "disposable_observable.hpp" -#include "snitch_logging.hpp" namespace { @@ -56,7 +56,7 @@ TEST_CASE("delay delays observable's emissions") std::chrono::milliseconds delay_duration{300}; auto scheduler = test_scheduler{}; - auto subscribe_with_delay = [&mock, &delay_duration](auto get_now) { + auto subscribe_with_delay = [&](auto get_now) { const auto now = get_now(); return rpp::ops::subscribe( [&, now, get_now](const auto& v) { @@ -244,7 +244,7 @@ TEST_CASE("observe_on forward error immediately") std::chrono::milliseconds delay_duration{300}; auto scheduler = test_scheduler{}; - auto subscribe_with_delay = [&mock, &delay_duration](auto get_now) { + auto subscribe_with_delay = [&](auto get_now) { const auto now = get_now(); return rpp::ops::subscribe( [&, now, get_now](const auto& v) { diff --git a/src/tests/rpp/test_disposables.cpp b/src/tests/rpp/test_disposables.cpp index 665449389..7c60fc64e 100644 --- a/src/tests/rpp/test_disposables.cpp +++ b/src/tests/rpp/test_disposables.cpp @@ -7,7 +7,8 @@ // // Project home: https://github.com/victimsnino/ReactivePlusPlus -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_distinct.cpp b/src/tests/rpp/test_distinct.cpp index 560f56893..223c9fd9f 100644 --- a/src/tests/rpp/test_distinct.cpp +++ b/src/tests/rpp/test_distinct.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_distinct_until_changed.cpp b/src/tests/rpp/test_distinct_until_changed.cpp index c7df6c7e6..74e8a4377 100644 --- a/src/tests/rpp/test_distinct_until_changed.cpp +++ b/src/tests/rpp/test_distinct_until_changed.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_filter.cpp b/src/tests/rpp/test_filter.cpp index ce98ffee5..d0387a91e 100644 --- a/src/tests/rpp/test_filter.cpp +++ b/src/tests/rpp/test_filter.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_finally.cpp b/src/tests/rpp/test_finally.cpp index 552940215..4c4c66f4b 100644 --- a/src/tests/rpp/test_finally.cpp +++ b/src/tests/rpp/test_finally.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -111,5 +112,5 @@ TEST_CASE("finally satisfies disposable contracts") rpp::ops::finally([]() noexcept {})); } - CHECK(observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2); + CHECK((observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2)); } diff --git a/src/tests/rpp/test_first.cpp b/src/tests/rpp/test_first.cpp index a7de00bd1..f41ee9b00 100644 --- a/src/tests/rpp/test_first.cpp +++ b/src/tests/rpp/test_first.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_flat_map.cpp b/src/tests/rpp/test_flat_map.cpp index aff4b2deb..a267db021 100644 --- a/src/tests/rpp/test_flat_map.cpp +++ b/src/tests/rpp/test_flat_map.cpp @@ -8,8 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_from.cpp b/src/tests/rpp/test_from.cpp index d04b3704e..f058c0f93 100644 --- a/src/tests/rpp/test_from.cpp +++ b/src/tests/rpp/test_from.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -56,10 +57,10 @@ struct infinite_container TEMPLATE_TEST_CASE("from iterable emit items from container", "", - std::pair, - std::pair, - std::pair, - std::pair) + (std::pair), + (std::pair), + (std::pair), + (std::pair)) { using memory_model = std::tuple_element_t<1, TestType>; using scheduler = std::tuple_element_t<0, TestType>; @@ -369,10 +370,10 @@ TEST_CASE("just") TEMPLATE_TEST_CASE("just variadic", "", - std::pair, - std::pair, - std::pair, - std::pair) + (std::pair), + (std::pair), + (std::pair), + (std::pair)) { using memory_model = std::tuple_element_t<1, TestType>; using scheduler = std::tuple_element_t<0, TestType>; diff --git a/src/tests/rpp/test_group_by.cpp b/src/tests/rpp/test_group_by.cpp index f78cee8ff..76d5c43b1 100644 --- a/src/tests/rpp/test_group_by.cpp +++ b/src/tests/rpp/test_group_by.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_interval.cpp b/src/tests/rpp/test_interval.cpp index 5b6ee2924..4471eab55 100644 --- a/src/tests/rpp/test_interval.cpp +++ b/src/tests/rpp/test_interval.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -20,8 +21,6 @@ #include #include -#include "snitch_logging.hpp" - #include TEST_CASE("interval emit values with provided interval") diff --git a/src/tests/rpp/test_last.cpp b/src/tests/rpp/test_last.cpp index 502b4df65..21a110f5b 100644 --- a/src/tests/rpp/test_last.cpp +++ b/src/tests/rpp/test_last.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_map.cpp b/src/tests/rpp/test_map.cpp index 12a469a48..23a9824be 100644 --- a/src/tests/rpp/test_map.cpp +++ b/src/tests/rpp/test_map.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -29,8 +30,8 @@ TEMPLATE_TEST_CASE("map modifies values and forward errors/completions", "", rpp mock_observer mock{}; trompeloeil::sequence seq; - REQUIRE_CALL(*mock, on_next("TEST 1")).IN_SEQUENCE(seq); - REQUIRE_CALL(*mock, on_next("TEST 2")).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue("TEST 1")).IN_SEQUENCE(seq); + REQUIRE_CALL(*mock, on_next_rvalue("TEST 2")).IN_SEQUENCE(seq); REQUIRE_CALL(*mock, on_completed()).IN_SEQUENCE(seq); obs | rpp::operators::map([](auto v) { return std::string("TEST ") + std::to_string(v); }) | rpp::operators::subscribe(std::move(mock)); diff --git a/src/tests/rpp/test_merge.cpp b/src/tests/rpp/test_merge.cpp index 55e8511a8..0ee6c65ec 100644 --- a/src/tests/rpp/test_merge.cpp +++ b/src/tests/rpp/test_merge.cpp @@ -8,8 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include -#include +#include +#include #include #include @@ -290,5 +290,5 @@ TEST_CASE("merge satisfies disposable contracts") test_operator_with_disposable(op); test_operator_finish_before_dispose(op); } - CHECK(observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2); + CHECK((observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2)); } diff --git a/src/tests/rpp/test_observables.cpp b/src/tests/rpp/test_observables.cpp index 349747ecb..2aeb295b3 100644 --- a/src/tests/rpp/test_observables.cpp +++ b/src/tests/rpp/test_observables.cpp @@ -7,7 +7,8 @@ // // Project home: https://github.com/victimsnino/ReactivePlusPlus -#include +#include +#include #include #include @@ -203,7 +204,7 @@ TEST_CASE("base observables") } } -TEST_CASE("create observable works properly as observable") +TEST_CASE("pipe observable works properly as observable") { SECTION("using const& variant") { @@ -246,19 +247,19 @@ TEST_CASE("create observable works properly as observable") TEMPLATE_TEST_CASE( "observable has type traits defined", "", - rpp::empty_observable, - rpp::dynamic_observable, - rpp::blocking_observable>, - rpp::connectable_observable, rpp::subjects::replay_subject>, - rpp::grouped_observable>) + (rpp::empty_observable), + (rpp::dynamic_observable), + (rpp::blocking_observable>), + (rpp::connectable_observable, rpp::subjects::replay_subject>), + (rpp::grouped_observable>)) { SECTION("value_type defined") { - CONSTEVAL_CHECK(requires { typename TestType::value_type; }); - CONSTEVAL_CHECK(std::is_same_v); + CHECK(requires { typename TestType::value_type; }); + CHECK(std::is_same_v); } SECTION("strategy_type defined") { - CONSTEVAL_CHECK(requires { typename TestType::strategy_type; }); + CHECK(requires { typename TestType::strategy_type; }); } } diff --git a/src/tests/rpp/test_observers.cpp b/src/tests/rpp/test_observers.cpp index 082c55836..11d890cab 100644 --- a/src/tests/rpp/test_observers.cpp +++ b/src/tests/rpp/test_observers.cpp @@ -7,7 +7,8 @@ // // Project home: https://github.com/victimsnino/ReactivePlusPlus -#include +#include +#include #include @@ -76,7 +77,7 @@ TEST_CASE("lambda observer works properly as base observer") TEST_CASE("as_dynamic keeps disposing") { - auto check = [](auto&& observer) { + auto check = [&](auto&& observer) { SECTION("dispose and convert to dynamic") { observer.on_completed(); @@ -161,7 +162,7 @@ TEST_CASE("set_upstream without base disposable makes it main disposalbe") { auto original_observer = rpp::make_lambda_observer([](int) {}, [](const std::exception_ptr&) {}, []() {}); - auto test_observer = [](auto&& observer) { + auto test_observer = [&](auto&& observer) { auto upstream = rpp::disposable_wrapper::make(); observer.set_upstream(upstream); CHECK(!upstream.is_disposed()); @@ -232,7 +233,7 @@ TEST_CASE("set_upstream depends on base disposable") [](const std::exception_ptr&) {}, []() {}); - auto test_observer = [&d](auto&& observer) { + auto test_observer = [&](auto&& observer) { auto upstream = rpp::disposable_wrapper::make(); CHECK(!d.is_disposed()); diff --git a/src/tests/rpp/test_on_error_resume_next.cpp b/src/tests/rpp/test_on_error_resume_next.cpp index b71fcc959..77078d7d2 100644 --- a/src/tests/rpp/test_on_error_resume_next.cpp +++ b/src/tests/rpp/test_on_error_resume_next.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -174,5 +175,5 @@ TEST_CASE("on_error_resume_next satisfies disposable contracts") test_operator_finish_before_dispose(op); } - CHECK(observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2); + CHECK((observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2)); } diff --git a/src/tests/rpp/test_reduce.cpp b/src/tests/rpp/test_reduce.cpp index be7609552..9ea9e4669 100644 --- a/src/tests/rpp/test_reduce.cpp +++ b/src/tests/rpp/test_reduce.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_repeat.cpp b/src/tests/rpp/test_repeat.cpp index 44573c758..9d1635d13 100644 --- a/src/tests/rpp/test_repeat.cpp +++ b/src/tests/rpp/test_repeat.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_scan.cpp b/src/tests/rpp/test_scan.cpp index 4c7ae77da..00dfbd23d 100644 --- a/src/tests/rpp/test_scan.cpp +++ b/src/tests/rpp/test_scan.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_scheduler.cpp b/src/tests/rpp/test_scheduler.cpp index be184450b..3d13936bd 100644 --- a/src/tests/rpp/test_scheduler.cpp +++ b/src/tests/rpp/test_scheduler.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_skip.cpp b/src/tests/rpp/test_skip.cpp index 4d279d47e..b4b30dfdc 100644 --- a/src/tests/rpp/test_skip.cpp +++ b/src/tests/rpp/test_skip.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -24,10 +25,10 @@ TEMPLATE_TEST_CASE("skip ignores first `count` of items", "", - std::pair, - std::pair, - std::pair, - std::pair) + (std::pair), + (std::pair), + (std::pair), + (std::pair)) { using memory_model = std::tuple_element_t<1, TestType>; using scheduler = std::tuple_element_t<0, TestType>; diff --git a/src/tests/rpp/test_start_with.cpp b/src/tests/rpp/test_start_with.cpp index 58678a2a7..0f8ae1953 100644 --- a/src/tests/rpp/test_start_with.cpp +++ b/src/tests/rpp/test_start_with.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_subjects.cpp b/src/tests/rpp/test_subjects.cpp index a16fac72a..5f7ddbb74 100644 --- a/src/tests/rpp/test_subjects.cpp +++ b/src/tests/rpp/test_subjects.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -19,7 +20,6 @@ #include #include "copy_count_tracker.hpp" -#include "snitch_logging.hpp" #include diff --git a/src/tests/rpp/test_subscribe.cpp b/src/tests/rpp/test_subscribe.cpp index e7735282d..8fca2b799 100644 --- a/src/tests/rpp/test_subscribe.cpp +++ b/src/tests/rpp/test_subscribe.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_subscribe_on.cpp b/src/tests/rpp/test_subscribe_on.cpp index 5cf0d02cd..5a39e7be3 100644 --- a/src/tests/rpp/test_subscribe_on.cpp +++ b/src/tests/rpp/test_subscribe_on.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -111,7 +112,7 @@ TEST_CASE("subscribe_on schedules job in another scheduler") } -TEST_CASE("group_by satisfies disposable contracts") +TEST_CASE("subscribe_on satisfies disposable contracts") { test_operator_with_disposable(rpp::ops::subscribe_on(rpp::schedulers::current_thread{})); } diff --git a/src/tests/rpp/test_switch_on_next.cpp b/src/tests/rpp/test_switch_on_next.cpp index a4c4e35d0..f16d19e62 100644 --- a/src/tests/rpp/test_switch_on_next.cpp +++ b/src/tests/rpp/test_switch_on_next.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -21,7 +22,6 @@ #include "copy_count_tracker.hpp" #include "disposable_observable.hpp" -#include "snitch_logging.hpp" TEST_CASE("switch_on_next switches observable after obtaining new one") { diff --git a/src/tests/rpp/test_take.cpp b/src/tests/rpp/test_take.cpp index 71eaa8c38..ed62e148d 100644 --- a/src/tests/rpp/test_take.cpp +++ b/src/tests/rpp/test_take.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_take_last.cpp b/src/tests/rpp/test_take_last.cpp index fe2ae7eb8..ed21b8313 100644 --- a/src/tests/rpp/test_take_last.cpp +++ b/src/tests/rpp/test_take_last.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_take_until.cpp b/src/tests/rpp/test_take_until.cpp index aa637524e..f149c3d95 100644 --- a/src/tests/rpp/test_take_until.cpp +++ b/src/tests/rpp/test_take_until.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_take_while.cpp b/src/tests/rpp/test_take_while.cpp index 6d8ac1bc0..0e1f73e6a 100644 --- a/src/tests/rpp/test_take_while.cpp +++ b/src/tests/rpp/test_take_while.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_tap.cpp b/src/tests/rpp/test_tap.cpp index b2ac2020f..e1b4de6f9 100644 --- a/src/tests/rpp/test_tap.cpp +++ b/src/tests/rpp/test_tap.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_throttle.cpp b/src/tests/rpp/test_throttle.cpp index f2b96df3e..f385642c6 100644 --- a/src/tests/rpp/test_throttle.cpp +++ b/src/tests/rpp/test_throttle.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -17,7 +18,6 @@ #include #include "disposable_observable.hpp" -#include "snitch_logging.hpp" TEST_CASE("throttle throttles emissions") { diff --git a/src/tests/rpp/test_timeout.cpp b/src/tests/rpp/test_timeout.cpp index 42abaa33d..025dfee46 100644 --- a/src/tests/rpp/test_timeout.cpp +++ b/src/tests/rpp/test_timeout.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -20,7 +21,6 @@ #include #include "disposable_observable.hpp" -#include "snitch_logging.hpp" TEST_CASE("timeout subscribes to passed observable in case of reaching timeout") diff --git a/src/tests/rpp/test_timer.cpp b/src/tests/rpp/test_timer.cpp index b54f7aeb1..508fd74e0 100644 --- a/src/tests/rpp/test_timer.cpp +++ b/src/tests/rpp/test_timer.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include diff --git a/src/tests/rpp/test_window.cpp b/src/tests/rpp/test_window.cpp index a0b31124b..de5130b85 100644 --- a/src/tests/rpp/test_window.cpp +++ b/src/tests/rpp/test_window.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -17,7 +18,6 @@ #include #include "disposable_observable.hpp" -#include "snitch_logging.hpp" TEST_CASE("window subdivide observable into sub-observables") { diff --git a/src/tests/rpp/test_window_toggle.cpp b/src/tests/rpp/test_window_toggle.cpp index 87b58036d..a0a73b385 100644 --- a/src/tests/rpp/test_window_toggle.cpp +++ b/src/tests/rpp/test_window_toggle.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -19,7 +20,6 @@ #include "disposable_observable.hpp" #include "rpp/schedulers/immediate.hpp" -#include "snitch_logging.hpp" TEST_CASE("window_toggle") diff --git a/src/tests/rpp/test_with_latest_from.cpp b/src/tests/rpp/test_with_latest_from.cpp index 44a4a8133..b6bbddbdc 100644 --- a/src/tests/rpp/test_with_latest_from.cpp +++ b/src/tests/rpp/test_with_latest_from.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -204,5 +205,5 @@ TEST_CASE("with_latest_from satisfies disposable contracts") test_operator_finish_before_dispose(op); } - CHECK(observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2); + CHECK((observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2)); } diff --git a/src/tests/rpp/test_zip.cpp b/src/tests/rpp/test_zip.cpp index 206db4c79..aaec6a20b 100644 --- a/src/tests/rpp/test_zip.cpp +++ b/src/tests/rpp/test_zip.cpp @@ -8,7 +8,8 @@ // Project home: https://github.com/victimsnino/ReactivePlusPlus // -#include +#include +#include #include #include @@ -186,5 +187,5 @@ TEST_CASE("zip satisfies disposable contracts") test_operator_finish_before_dispose(op); } - CHECK(observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2); + CHECK((observable_disposable.is_disposed() || observable_disposable.lock().use_count() == 2)); } diff --git a/src/tests/rppqt/test_from_signal.cpp b/src/tests/rppqt/test_from_signal.cpp index 04242cd48..e83aa45af 100644 --- a/src/tests/rppqt/test_from_signal.cpp +++ b/src/tests/rppqt/test_from_signal.cpp @@ -38,7 +38,8 @@ struct TestQObject : public QObject void NoValueSignal(); }; -#include +#include +#include #include diff --git a/src/tests/rppqt/test_main_thread_scheduler.cpp b/src/tests/rppqt/test_main_thread_scheduler.cpp index 393a765d9..f2fa25c0e 100644 --- a/src/tests/rppqt/test_main_thread_scheduler.cpp +++ b/src/tests/rppqt/test_main_thread_scheduler.cpp @@ -7,7 +7,8 @@ // // Project home: https://github.com/victimsnino/ReactivePlusPlus -#include +#include +#include #include #include @@ -20,6 +21,7 @@ #include #include #include +#include TEST_CASE("main_thread_scheduler schedules actions to main thread") { @@ -47,7 +49,7 @@ TEST_CASE("main_thread_scheduler schedules actions to main thread") { auto future = execution_thread.get_future(); REQUIRE(future.wait_for(std::chrono::seconds{1}) == std::future_status::ready); - CHECK(future.get() == std::this_thread::get_id()); + CHECK((future.get() == std::this_thread::get_id())); } } diff --git a/src/tests/utils/copy_count_tracker.hpp b/src/tests/utils/copy_count_tracker.hpp index 77810a148..05ccee242 100644 --- a/src/tests/utils/copy_count_tracker.hpp +++ b/src/tests/utils/copy_count_tracker.hpp @@ -10,7 +10,8 @@ #pragma once -#include +#include +#include #include #include diff --git a/src/tests/utils/disposable_observable.hpp b/src/tests/utils/disposable_observable.hpp index 573c62fb2..826c9f918 100644 --- a/src/tests/utils/disposable_observable.hpp +++ b/src/tests/utils/disposable_observable.hpp @@ -10,7 +10,8 @@ #pragma once -#include +#include +#include #include #include diff --git a/src/tests/utils/rpp_trompeloil.hpp b/src/tests/utils/rpp_trompeloil.hpp index 6018c97c6..edd7bebc4 100644 --- a/src/tests/utils/rpp_trompeloil.hpp +++ b/src/tests/utils/rpp_trompeloil.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include +#include #include @@ -42,8 +42,8 @@ class mock_observer { impl_t() = default; - MAKE_MOCK1(on_next, void(const T&), const); - MAKE_MOCK1(on_next, void(T&&), const); + MAKE_MOCK1(on_next_lvalue, void(const T&), const); + MAKE_MOCK1(on_next_rvalue, void(T&&), const); MAKE_MOCK1(on_error, void(const std::exception_ptr& err), const); MAKE_MOCK0(on_completed, void(), const); }; @@ -52,12 +52,12 @@ class mock_observer void on_next(const T& v) const noexcept { - impl->on_next(v); + impl->on_next_lvalue(v); } void on_next(T&& v) const noexcept { - impl->on_next(std::move(v)); + impl->on_next_rvalue(std::move(v)); } void on_error(const std::exception_ptr& err) const noexcept { impl->on_error(err); } diff --git a/src/tests/utils/snitch_logging.hpp b/src/tests/utils/snitch_logging.hpp deleted file mode 100644 index 20d6c0ebb..000000000 --- a/src/tests/utils/snitch_logging.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once -#include -#include - -#include - -#include -#include - -template -concept appendable = requires(snitch::small_string_span ss, const T& v) { append(ss, v); }; - -namespace rpp -{ - inline bool append(snitch::small_string_span ss, rpp::schedulers::time_point& v) - { - return append(ss, v.time_since_epoch().count()); - } -} // namespace rpp - -namespace std -{ - template - bool append(snitch::small_string_span ss, const std::vector& v) - { - return append(ss, "{") - && std::all_of(v.cbegin(), v.cend(), [&ss](const T& vv) { return append(ss, vv) && append(ss, ", "); }) - && append(ss, "}"); - } - - template - bool append(snitch::small_string_span ss, const std::tuple& v) - { - return append(ss, "{") - && std::apply([&ss](const auto&... vv) { return ((append(ss, vv) && append(ss, ", ")) && ...); }, v) - && append(ss, "}"); - } - - template - bool append(snitch::small_string_span ss, const std::chrono::time_point& v) - { - return append(ss, v.time_since_epoch().count()); - } -} // namespace std