diff --git a/examples/Finalizers.cpp b/examples/Finalizers.cpp index 3a2532279..c3cfc1d8e 100644 --- a/examples/Finalizers.cpp +++ b/examples/Finalizers.cpp @@ -20,7 +20,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | finally::returns(42); + and finally::returns(42); REQUIRE(42 == mock()); //! [finally::returns] @@ -38,7 +38,7 @@ TEST_CASE( int myReturn{42}; SCOPED_EXP mock.expect_call() - | finally::returns(std::ref(myReturn)); + and finally::returns(std::ref(myReturn)); REQUIRE(&myReturn == &mock()); //! [finally::returns std::ref] @@ -56,8 +56,8 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | expect::twice() // we call the mock two times - | finally::returns(42); + and expect::twice() // we call the mock two times + and finally::returns(42); int& result = mock(); REQUIRE(42 == result); // fine @@ -78,7 +78,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | finally::throws(std::runtime_error{"Something happened."}); + and finally::throws(std::runtime_error{"Something happened."}); REQUIRE_THROWS_AS( mock(), @@ -97,7 +97,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | finally::returns_result_of([] { return "Hello, World!"; }); + and finally::returns_result_of([] { return "Hello, World!"; }); REQUIRE("Hello, World!" == mock()); //! [finally::returns_result_of] @@ -114,7 +114,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call(1337, 42) - | finally::returns_arg<1>(); + and finally::returns_arg<1>(); REQUIRE(42 == mock(1337, 42)); //! [finally::returns_param] @@ -131,7 +131,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call(1337, 42) - | finally::returns_apply_result_of<0, 1>(std::plus{}); + and finally::returns_apply_result_of<0, 1>(std::plus{}); REQUIRE(1379 == mock(1337, 42)); //! [finally::returns_apply_result_of] @@ -148,7 +148,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call(1337, 42) - | finally::returns_apply_all_result_of(std::plus{}); + and finally::returns_apply_all_result_of(std::plus{}); REQUIRE(1379 == mock(1337, 42)); //! [finally::returns_apply_all_result_of] @@ -172,7 +172,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | MyFinalizer{}; + and MyFinalizer{}; REQUIRE(1337 == mock()); //! [custom finalizer] diff --git a/examples/Mock.cpp b/examples/Mock.cpp index bac292b1f..129bb3862 100644 --- a/examples/Mock.cpp +++ b/examples/Mock.cpp @@ -118,8 +118,8 @@ TEST_CASE( SECTION("Throws, when inner container is empty.") { SCOPED_EXP innerContainer.empty.expect_call() - | expect::times(2) // we test both, the const and non-const top() overload - | finally::returns(true); + and expect::times(2) // we test both, the const and non-const top() overload + and finally::returns(true); MyStack stack{std::move(innerContainer)}; @@ -130,12 +130,12 @@ TEST_CASE( SECTION("Returns a reference to the top element otherwise.") { SCOPED_EXP innerContainer.empty.expect_call() - | finally::returns(false); + and finally::returns(false); SECTION("A const-ref, when accessed via const.") { SCOPED_EXP std::as_const(innerContainer).back.expect_call() - | finally::returns(42); + and finally::returns(42); MyStack stack{std::move(innerContainer)}; @@ -145,7 +145,7 @@ TEST_CASE( SECTION("A mutable ref, when accessed via non-const.") { SCOPED_EXP innerContainer.back.expect_call() - | finally::returns(42); + and finally::returns(42); MyStack stack{std::move(innerContainer)}; @@ -162,7 +162,7 @@ TEST_CASE( { ContainerMock innerContainer{}; SCOPED_EXP innerContainer.empty.expect_call() - | finally::returns(true); + and finally::returns(true); MyStack stack{std::move(innerContainer)}; REQUIRE_THROWS_AS(stack.pop(), std::runtime_error); @@ -172,7 +172,7 @@ TEST_CASE( { ContainerMock innerContainer{}; SCOPED_EXP innerContainer.empty.expect_call() - | finally::returns(false); + and finally::returns(false); SCOPED_EXP innerContainer.pop_back.expect_call(); MyStack container{std::move(innerContainer)}; diff --git a/examples/Requirements.cpp b/examples/Requirements.cpp index ab593de86..14def968c 100644 --- a/examples/Requirements.cpp +++ b/examples/Requirements.cpp @@ -63,7 +63,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call(_) - | expect::arg<0>(matches::gt(42)); + and expect::arg<0>(matches::gt(42)); mock(1337); //! [expect::arg] } @@ -80,7 +80,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call(le(1337)) - | expect::arg<0>(matches::gt(42)); + and expect::arg<0>(matches::gt(42)); mock(1337); } @@ -97,7 +97,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call(_) // in fact, the _ is the only built-in matcher, which isn't invertible - | expect::arg<0>(!matches::le(42)); // note the !, as this makes it an actual > test + and expect::arg<0>(!matches::le(42)); // note the !, as this makes it an actual > test mock(1337); //! [matcher inverted] } @@ -117,7 +117,7 @@ TEST_CASE( constexpr auto isOdd = [](int val) { return 0 != val % 2; }; SCOPED_EXP mock.expect_call(_) - | expect::arg<0>(matches::predicate(isOdd)); + and expect::arg<0>(matches::predicate(isOdd)); mock(1337); //! [matcher predicate] } @@ -135,7 +135,7 @@ TEST_CASE( mimicpp::Mock)> mock{}; SCOPED_EXP mock.expect_call(_) - | expect::arg<0>(matches::range::is_sorted()); + and expect::arg<0>(matches::range::is_sorted()); std::vector collection{42, 1337}; mock(collection); @@ -169,7 +169,7 @@ TEST_CASE( mimicpp::Mock)> mock{}; SCOPED_EXP mock.expect_call(_) - | expect::arg<0>(containsMatcher); + and expect::arg<0>(containsMatcher); std::vector collection{42, 1337}; mock(collection); diff --git a/examples/Sequences.cpp b/examples/Sequences.cpp index f8bf6d2c7..2287eb589 100644 --- a/examples/Sequences.cpp +++ b/examples/Sequences.cpp @@ -21,9 +21,9 @@ TEST_CASE( mimicpp::SequenceT sequence{}; SCOPED_EXP mock.expect_call(matches::ne(0)) - | expect::in_sequence(sequence); + and expect::in_sequence(sequence); SCOPED_EXP mock.expect_call(matches::le(42)) - | expect::in_sequence(sequence); + and expect::in_sequence(sequence); // a call with arg != 0 is expected before a call with arg <= 42 mock(42); // matches the first expectation @@ -47,9 +47,9 @@ TEST_CASE( mimicpp::SequenceT sequence{}; SCOPED_EXP mock2.expect_call(_) // mock2 must go first - | expect::in_sequence(sequence); + and expect::in_sequence(sequence); SCOPED_EXP mock1.expect_call(_) // mock1 must go second - | expect::in_sequence(sequence); + and expect::in_sequence(sequence); mock2(42); mock1(1337); @@ -73,12 +73,12 @@ TEST_CASE( mimicpp::SequenceT sequence{}; SCOPED_EXP mock.expect_call(1337) // (3) - | expect::in_sequence(sequence); + and expect::in_sequence(sequence); SCOPED_EXP mock.expect_call(1337); // (4) SCOPED_EXP mock.expect_call(42) // (5) - | expect::in_sequence(sequence); + and expect::in_sequence(sequence); mock(42); // matches (1), because (5) is the second element of the sequence mock(1337); // matches (4), because it's the "youngest" available alternative @@ -102,11 +102,11 @@ TEST_CASE( mimicpp::SequenceT sequence1{}; mimicpp::SequenceT sequence2{}; SCOPED_EXP mock.expect_call() // (1) - | expect::in_sequence(sequence1); + and expect::in_sequence(sequence1); SCOPED_EXP mock.expect_call() // (2) - | expect::in_sequences(sequence1, sequence2); + and expect::in_sequences(sequence1, sequence2); SCOPED_EXP mock.expect_call() // (3) - | expect::in_sequence(sequence2); + and expect::in_sequence(sequence2); mock(); // (1) is used here, because (3) is second in sequence2 and (2) is second in sequence1 mock(); // (2) is used here, because it's the first in both sequences now @@ -127,10 +127,10 @@ TEST_CASE( mimicpp::LazySequence sequence{}; SCOPED_EXP mock.expect_call() // (1) - | expect::in_sequence(sequence) - | expect::at_most(1); + and expect::in_sequence(sequence) + and expect::at_most(1); SCOPED_EXP mock.expect_call() // (2) - | expect::in_sequence(sequence); + and expect::in_sequence(sequence); mock(); // matches (1) mock(); // matches (2) @@ -150,10 +150,10 @@ TEST_CASE( mimicpp::GreedySequence sequence{}; SCOPED_EXP mock.expect_call() // (1) - | expect::in_sequence(sequence) - | expect::at_most(1); + and expect::in_sequence(sequence) + and expect::at_most(1); SCOPED_EXP mock.expect_call() // (2) - | expect::in_sequence(sequence); + and expect::in_sequence(sequence); mock(); // matches (2) // no further call possible, because that would be out of sequence and will lead to an inapplicable match report! diff --git a/examples/SideEffects.cpp b/examples/SideEffects.cpp index 1c90d90bd..30375da10 100644 --- a/examples/SideEffects.cpp +++ b/examples/SideEffects.cpp @@ -18,7 +18,7 @@ TEST_CASE( std::string outText{}; SCOPED_EXP mock.expect_call(42) - | then::invoke([&] { outText = "Hello, mimic++!"; }); + and then::invoke([&] { outText = "Hello, mimic++!"; }); mock(42); @@ -36,7 +36,7 @@ TEST_CASE( int value{42}; SCOPED_EXP mock.expect_call(42) - | then::apply_arg<0>([](auto& v) { v = 1337; }); + and then::apply_arg<0>([](auto& v) { v = 1337; }); mock(value); @@ -54,8 +54,8 @@ TEST_CASE( int value{42}; SCOPED_EXP mock.expect_call(42) - | then::apply_arg<0>([](auto& v) { v = 1337; }) - | then::apply_arg<0>([](auto& v) { v = (v == 1337 ? -1337 : -42); }); + and then::apply_arg<0>([](auto& v) { v = 1337; }) + and then::apply_arg<0>([](auto& v) { v = (v == 1337 ? -1337 : -42); }); mock(value); @@ -73,9 +73,9 @@ TEST_CASE( int outResult{}; SCOPED_EXP mock.expect_call(0, 1, 2) - | then::apply_args<1, 2, 0>( // note the index order: - // outResult is invoked as left-most param, but applied as right-most - [](int lhs, int rhs, int& out) { out = lhs + rhs; }); + and then::apply_args<1, 2, 0>( // note the index order: + // outResult is invoked as left-most param, but applied as right-most + [](int lhs, int rhs, int& out) { out = lhs + rhs; }); mock(outResult, 1, 2); @@ -93,8 +93,8 @@ TEST_CASE( int outResult{}; SCOPED_EXP mock.expect_call(0, 42) - | then::apply_args<1, 1, 0>( // note the indices: second param is applied twice - [](int lhs, int rhs, int& out) { out = lhs + rhs; }); + and then::apply_args<1, 1, 0>( // note the indices: second param is applied twice + [](int lhs, int rhs, int& out) { out = lhs + rhs; }); mock(outResult, 42); diff --git a/examples/Times.cpp b/examples/Times.cpp index 8333f2e51..f7dc3ead7 100644 --- a/examples/Times.cpp +++ b/examples/Times.cpp @@ -18,7 +18,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | expect::once(); + and expect::once(); mock(); //! [once] @@ -34,7 +34,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | expect::twice(); + and expect::twice(); mock(); // not enough mock(); // fine! @@ -51,7 +51,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | expect::at_least(2u); + and expect::at_least(2u); mock(); // not enough mock(); // fine @@ -69,7 +69,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | expect::at_most(2u); + and expect::at_most(2u); mock(); // fine mock(); // fine but exhausted! @@ -86,7 +86,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | expect::times(2u); // equivalent to twice() + and expect::times(2u); // equivalent to twice() mock(); // not enough mock(); //fine @@ -103,7 +103,7 @@ TEST_CASE( mimicpp::Mock mock{}; SCOPED_EXP mock.expect_call() - | expect::times(1u, 3u); // between 1 and 3 matches + and expect::times(1u, 3u); // between 1 and 3 matches mock(); // fine mock(); // fine