From b8f482b9aa4f274bdc7f4e840283db05a5ebfe2e Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 17 Aug 2017 16:48:46 +0100 Subject: [PATCH] Added test comparing non-copyable values --- .../Baselines/console.std.approved.txt | 4 +- .../Baselines/console.sw.approved.txt | 16 +- .../SelfTest/Baselines/junit.sw.approved.txt | 3 +- .../SelfTest/Baselines/xml.sw.approved.txt | 15 +- .../SelfTest/Baselines/xml.sw.unapproved.txt | 8293 +++++++++++++++++ projects/SelfTest/TrickyTests.cpp | 6 + 6 files changed, 8330 insertions(+), 7 deletions(-) create mode 100644 projects/SelfTest/Baselines/xml.sw.unapproved.txt diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 42d62c9c..50991312 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1020,6 +1020,6 @@ with expansion: "{?}" == "1" =============================================================================== -test cases: 182 | 131 passed | 47 failed | 4 failed as expected -assertions: 881 | 764 passed | 96 failed | 21 failed as expected +test cases: 183 | 132 passed | 47 failed | 4 failed as expected +assertions: 882 | 765 passed | 96 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 1d228de6..ae2f6928 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -6672,6 +6672,18 @@ PASSED: with expansion: "7" == "7" +------------------------------------------------------------------------------- +non-copyable objects +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + CHECK( ti == typeid(int) ) +with expansion: + {?} == {?} + ------------------------------------------------------------------------------- not allowed ------------------------------------------------------------------------------- @@ -7523,6 +7535,6 @@ MiscTests.cpp:: PASSED: =============================================================================== -test cases: 182 | 128 passed | 50 failed | 4 failed as expected -assertions: 883 | 760 passed | 102 failed | 21 failed as expected +test cases: 183 | 129 passed | 50 failed | 4 failed as expected +assertions: 884 | 761 passed | 102 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 6e3607a8..e49e19e4 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -725,6 +725,7 @@ MiscTests.cpp: + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index f290b1de..685e21bc 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -7433,6 +7433,17 @@ loose text artifact + + + + ti == typeid(int) + + + {?} == {?} + + + + @@ -8276,7 +8287,7 @@ loose text artifact - + - + diff --git a/projects/SelfTest/Baselines/xml.sw.unapproved.txt b/projects/SelfTest/Baselines/xml.sw.unapproved.txt new file mode 100644 index 00000000..edabc05e --- /dev/null +++ b/projects/SelfTest/Baselines/xml.sw.unapproved.txt @@ -0,0 +1,8293 @@ + + + + + + + +
+ + answer := 42 + + + expected exception + + +
+
+ + answer := 42 + + + + thisThrows() + + + thisThrows() + + + expected exception + + + +
+
+ + answer := 42 + + + + thisThrows() + + + thisThrows() + + + +
+ +
+ + + + 42 == f + + + 42 == {?} + + + + + + + + a == t + + + 3 == 3 + + + + + a == t + + + 3 == 3 + + + + + throws_int(true) + + + throws_int(true) + + + + + throws_int(true), int + + + throws_int(true), int + + + + + throws_int(false) + + + throws_int(false) + + + + + "aaa", Catch::EndsWith("aaa") + + + "aaa" ends with: "aaa" + + + + + templated_tests<int>(3) + + + true + + + + + + + + f() == 0 + + + 1 == 0 + + + + + errno == 1 + + + 1 == 1 + + + + + + + dummy := 0 + + + + x == 4 + + + {?} == 4 + + + + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ + + + false != false + + + false != false + + + + + true != true + + + true != true + + + + + !true + + + false + + + + + !true + + + !true + + + + + !trueValue + + + false + + + + + !trueValue + + + !true + + + + + !(1 == 1) + + + false + + + + + !1 == 1 + + + !(1 == 1) + + + + + + + + false == false + + + false == false + + + + + true == true + + + true == true + + + + + !false + + + true + + + + + !false + + + !false + + + + + !falseValue + + + true + + + + + !falseValue + + + !false + + + + + !(1 == 2) + + + true + + + + + !1 == 2 + + + !(1 == 2) + + + + + +
+ + + is_true<true>::value == true + + + true == true + + + + + true == is_true<true>::value + + + true == true + + + +
+
+ + + is_true<false>::value == false + + + false == false + + + + + false == is_true<false>::value + + + false == false + + + +
+
+ + + !is_true<false>::value + + + true + + + +
+
+ + + !!is_true<true>::value + + + true + + + +
+
+ + + is_true<true>::value + + + true + + + + + !is_true<false>::value + + + !false + + + +
+ +
+ + + + s == "world" + + + "hello" == "world" + + + + + + + + s == "hello" + + + "hello" == "hello" + + + + + + + + m_a == 2 + + + 1 == 2 + + + + + + + + m_a == 1 + + + 1 == 1 + + + + + +
+
+ +
+ +
+ + to infinity and beyond + + +
+ + + + &o1 == &o2 + + + 0x == 0x + + + + + o1 == o2 + + + {?} == {?} + + + + + + + + 104.0 != Approx(100.0) + + + 104.0 != Approx( 100.0 ) + + + + + 104.0 == Approx(100.0).margin(5) + + + 104.0 == Approx( 100.0 ) + + + + + 104.0 != Approx(100.0).margin(3) + + + 104.0 != Approx( 100.0 ) + + + + + 100.3 != Approx(100.0) + + + 100.3 != Approx( 100.0 ) + + + + + 100.3 == Approx(100.0).margin(0.5) + + + 100.3 == Approx( 100.0 ) + + + + + + + + testStringForMatching(), AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) + + + "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" ) + + + + + + + + + + + i++ == 7 + + + 7 == 7 + + + + + i++ == 8 + + + 8 == 8 + + + + + + + + 1 == 1 + + + 1 == 1 + + + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + unexpected exception + + + + + + + + + + + testStringForMatching(), AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) + + + "this string contains 'abc' as a substring" ( contains: "string" or contains: "not there" ) + + + + + testStringForMatching(), AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) + + + "this string contains 'abc' as a substring" ( contains: "not there" or contains: "string" ) + + + + + + + + divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) + + + 3.1428571429 == Approx( 3.141 ) + + + + + divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) + + + 3.1428571429 != Approx( 3.141 ) + + + + + + + + d != Approx( 1.231 ) + + + 1.23 != Approx( 1.231 ) + + + + + d == Approx( 1.231 ).epsilon( 0.1 ) + + + 1.23 == Approx( 1.231 ) + + + + + + + + 1.23f == Approx( 1.23f ) + + + 1.23f == Approx( 1.2300000191 ) + + + + + 0.0f == Approx( 0.0f ) + + + 0.0f == Approx( 0.0 ) + + + + + + + + 1 == Approx( 1 ) + + + 1 == Approx( 1.0 ) + + + + + 0 == Approx( 0 ) + + + 0 == Approx( 0.0 ) + + + + + + + + 1.0f == Approx( 1 ) + + + 1.0f == Approx( 1.0 ) + + + + + 0 == Approx( dZero) + + + 0 == Approx( 0.0 ) + + + + + 0 == Approx( dSmall ).epsilon( 0.001 ) + + + 0 == Approx( 0.00001 ) + + + + + 1.234f == Approx( dMedium ) + + + 1.234f == Approx( 1.234 ) + + + + + dMedium == Approx( 1.234f ) + + + 1.234 == Approx( 1.2339999676 ) + + + + + + + + Catch::alwaysTrue() + + + true + + +
+ + + Catch::alwaysTrue() + + + true + + +
+ + + Catch::alwaysTrue() + + + true + + + +
+ +
+ + + Catch::alwaysTrue() + + + true + + +
+ + + Catch::alwaysTrue() + + + true + + +
+ + + Catch::alwaysTrue() + + + true + + + +
+ +
+ +
+ +
+ + i := 2 + + + + true + + + true + + + +
+
+ + 3 + + + + true + + + true + + + +
+ +
+ +
+ + + tab == '\t' + + + '\t' == '\t' + + + + + newline == '\n' + + + '\n' == '\n' + + + + + carr_return == '\r' + + + '\r' == '\r' + + + + + form_feed == '\f' + + + '\f' == '\f' + + + +
+
+ + + space == ' ' + + + ' ' == ' ' + + + + + c == chars[i] + + + 'a' == 'a' + + + + + c == chars[i] + + + 'z' == 'z' + + + + + c == chars[i] + + + 'A' == 'A' + + + + + c == chars[i] + + + 'Z' == 'Z' + + + +
+
+ + + null_terminator == '\0' + + + 0 == 0 + + + + + c == i + + + 2 == 2 + + + + + c == i + + + 3 == 3 + + + + + c == i + + + 4 == 4 + + + + + c == i + + + 5 == 5 + + + +
+ +
+ + + + std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} + + + std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} + + + + + std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} + + + std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} + + + + + std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} + + + std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} + + + + + std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} + + + std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + !std::vector<int>{1, 2} == std::vector<int>{1, 2, 3} + + + !({ 1, 2 } == { 1, 2, 3 }) + + + + + !std::vector<int>{1, 2} == std::vector<int>{1, 2, 3} + + + !({ 1, 2 } == { 1, 2, 3 }) + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + true + + + true + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + + + + a + + + 0x + + + + + a == &foo + + + 0x == 0x + + + + + + + + m == &S::f + + + 0x +== +0x + + + + + + + + td == Approx(10.0) + + + StrongDoubleTypedef(10) == Approx( 10.0 ) + + + + + Approx(10.0) == td + + + Approx( 10.0 ) == StrongDoubleTypedef(10) + + + + + td != Approx(11.0) + + + StrongDoubleTypedef(10) != Approx( 11.0 ) + + + + + Approx(11.0) != td + + + Approx( 11.0 ) != StrongDoubleTypedef(10) + + + + + td <= Approx(10.0) + + + StrongDoubleTypedef(10) <= Approx( 10.0 ) + + + + + td <= Approx(11.0) + + + StrongDoubleTypedef(10) <= Approx( 11.0 ) + + + + + Approx(10.0) <= td + + + Approx( 10.0 ) <= StrongDoubleTypedef(10) + + + + + Approx(9.0) <= td + + + Approx( 9.0 ) <= StrongDoubleTypedef(10) + + + + + td >= Approx(9.0) + + + StrongDoubleTypedef(10) >= Approx( 9.0 ) + + + + + td >= Approx(10.0) + + + StrongDoubleTypedef(10) >= Approx( 10.0 ) + + + + + Approx(10.0) >= td + + + Approx( 10.0 ) >= StrongDoubleTypedef(10) + + + + + Approx(11.0) >= td + + + Approx( 11.0 ) >= StrongDoubleTypedef(10) + + + + + + + + 54 == 6*9 + + + 54 == 54 + + + + + + + + ( -1 > 2u ) + + + true + + + + + -1 > 2u + + + -1 > 2 + + + + + ( 2u < -1 ) + + + true + + + + + 2u < -1 + + + 2 < -1 + + + + + ( minInt > 2u ) + + + true + + + + + minInt > 2u + + + -2147483648 > 2 + + + + + + + + i == 1 + + + 1 == 1 + + + + + ui == 2 + + + 2 == 2 + + + + + l == 3 + + + 3 == 3 + + + + + ul == 4 + + + 4 == 4 + + + + + c == 5 + + + 5 == 5 + + + + + uc == 6 + + + 6 == 6 + + + + + 1 == i + + + 1 == 1 + + + + + 2 == ui + + + 2 == 2 + + + + + 3 == l + + + 3 == 3 + + + + + 4 == ul + + + 4 == 4 + + + + + 5 == c + + + 5 == 5 + + + + + 6 == uc + + + 6 == 6 + + + + + (std::numeric_limits<unsigned long>::max)() > ul + + + 18446744073709551615 (0x) +> +4 + + + + + + + + testStringForMatching(), Contains( "not there" ) + + + "this string contains 'abc' as a substring" contains: "not there" + + + + + + + + throwCustom() + + + throwCustom() + + + custom exception - not std + + + + + + + + throwCustom(), std::exception + + + throwCustom(), std::exception + + + custom exception - not std + + + + + + + custom std exception + + + + + + + t == 1u + + + {?} == 1 + + + + + + + + testStringForMatching(), EndsWith( "this" ) + + + "this string contains 'abc' as a substring" ends with: "this" + + + + + + + + data.int_seven == 6 + + + 7 == 6 + + + + + data.int_seven == 8 + + + 7 == 8 + + + + + data.int_seven == 0 + + + 7 == 0 + + + + + data.float_nine_point_one == Approx( 9.11f ) + + + 9.1f == Approx( 9.1099996567 ) + + + + + data.float_nine_point_one == Approx( 9.0f ) + + + 9.1f == Approx( 9.0 ) + + + + + data.float_nine_point_one == Approx( 1 ) + + + 9.1f == Approx( 1.0 ) + + + + + data.float_nine_point_one == Approx( 0 ) + + + 9.1f == Approx( 0.0 ) + + + + + data.double_pi == Approx( 3.1415 ) + + + 3.1415926535 == Approx( 3.1415 ) + + + + + data.str_hello == "goodbye" + + + "hello" == "goodbye" + + + + + data.str_hello == "hell" + + + "hello" == "hell" + + + + + data.str_hello == "hello1" + + + "hello" == "hello1" + + + + + data.str_hello.size() == 6 + + + 5 == 6 + + + + + x == Approx( 1.301 ) + + + 1.3 == Approx( 1.301 ) + + + + + + + + data.int_seven == 7 + + + 7 == 7 + + + + + data.float_nine_point_one == Approx( 9.1f ) + + + 9.1f == Approx( 9.1000003815 ) + + + + + data.double_pi == Approx( 3.1415926535 ) + + + 3.1415926535 == Approx( 3.1415926535 ) + + + + + data.str_hello == "hello" + + + "hello" == "hello" + + + + + "hello" == data.str_hello + + + "hello" == "hello" + + + + + data.str_hello.size() == 5 + + + 5 == 5 + + + + + x == Approx( 1.3 ) + + + 1.3 == Approx( 1.3 ) + + + + + + + + testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) + + + "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" + + + + + + + + testStringForMatching(), Equals( "something else" ) + + + "this string contains 'abc' as a substring" equals: "something else" + + + + + +
+ + + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } + + + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } + + + + + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } + + + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } + + + +
+
+ + + throwsAsInt(1), SpecialException, ExceptionMatcher{ 1 } + + + throwsAsInt(1), SpecialException, ExceptionMatcher{ 1 } + + + Unknown exception + + + + + throwsAsInt(1), SpecialException, ExceptionMatcher{ 1 } + + + throwsAsInt(1), SpecialException, ExceptionMatcher{ 1 } + + + Unknown exception + + + +
+
+ + + throws(3), SpecialException, ExceptionMatcher{ 1 } + + + {?} special exception has value of 1 + + + + + throws(4), SpecialException, ExceptionMatcher{ 1 } + + + {?} special exception has value of 1 + + + +
+ +
+ + + + throws(1), SpecialException, ExceptionMatcher{ 1 } + + + {?} special exception has value of 1 + + + + + throws(2), SpecialException, ExceptionMatcher{ 2 } + + + {?} special exception has value of 2 + + + + + +
+ + + thisThrows(), "expected exception" + + + "expected exception" equals: "expected exception" + + + +
+
+ + + thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) + + + "expected exception" equals: "expected exception" (case insensitive) + + + +
+
+ + + thisThrows(), StartsWith( "expected" ) + + + "expected exception" starts with: "expected" + + + + + thisThrows(), EndsWith( "exception" ) + + + "expected exception" ends with: "exception" + + + + + thisThrows(), Contains( "except" ) + + + "expected exception" contains: "except" + + + + + thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) + + + "expected exception" contains: "except" (case insensitive) + + + +
+ +
+ + + + thisThrows(), std::string + + + thisThrows(), std::string + + + expected exception + + + + + thisDoesntThrow(), std::domain_error + + + thisDoesntThrow(), std::domain_error + + + + + thisThrows() + + + thisThrows() + + + expected exception + + + + + + + This is a failure + + + + + + + + + + This is a failure + + + This message appears in the output + + + + + + + Factorial(0) == 1 + + + 1 == 1 + + + + + Factorial(1) == 1 + + + 1 == 1 + + + + + Factorial(2) == 2 + + + 2 == 2 + + + + + Factorial(3) == 6 + + + 6 == 6 + + + + + Factorial(10) == 3628800 + + + 3628800 (0x) == 3628800 (0x) + + + + + + + + d >= Approx( 1.22 ) + + + 1.23 >= Approx( 1.22 ) + + + + + d >= Approx( 1.23 ) + + + 1.23 >= Approx( 1.23 ) + + + + + !d >= Approx( 1.24 ) + + + !(1.23 >= Approx( 1.24 )) + + + + + d >= Approx( 1.24 ).epsilon(0.1) + + + 1.23 >= Approx( 1.24 ) + + + + + + + this is a message + + + this is a warning + + + + + + this message should be logged + + + so should this + + + + a == 1 + + + 2 == 1 + + + + + + + this message may be logged later + + + + a == 2 + + + 2 == 2 + + + + this message may be logged later + + + this message should be logged + + + + a == 1 + + + 2 == 1 + + + + this message may be logged later + + + this message should be logged + + + and this, but later + + + + a == 0 + + + 2 == 0 + + + + this message may be logged later + + + this message should be logged + + + and this, but later + + + but not this + + + + a == 2 + + + 2 == 2 + + + + + + + current counter 0 + + + i := 0 + + + + i < 10 + + + 0 < 10 + + + + current counter 1 + + + i := 1 + + + + i < 10 + + + 1 < 10 + + + + current counter 2 + + + i := 2 + + + + i < 10 + + + 2 < 10 + + + + current counter 3 + + + i := 3 + + + + i < 10 + + + 3 < 10 + + + + current counter 4 + + + i := 4 + + + + i < 10 + + + 4 < 10 + + + + current counter 5 + + + i := 5 + + + + i < 10 + + + 5 < 10 + + + + current counter 6 + + + i := 6 + + + + i < 10 + + + 6 < 10 + + + + current counter 7 + + + i := 7 + + + + i < 10 + + + 7 < 10 + + + + current counter 8 + + + i := 8 + + + + i < 10 + + + 8 < 10 + + + + current counter 9 + + + i := 9 + + + + i < 10 + + + 9 < 10 + + + + current counter 10 + + + i := 10 + + + + i < 10 + + + 10 < 10 + + + + + + + + data.int_seven != 7 + + + 7 != 7 + + + + + data.float_nine_point_one != Approx( 9.1f ) + + + 9.1f != Approx( 9.1000003815 ) + + + + + data.double_pi != Approx( 3.1415926535 ) + + + 3.1415926535 != Approx( 3.1415926535 ) + + + + + data.str_hello != "hello" + + + "hello" != "hello" + + + + + data.str_hello.size() != 5 + + + 5 != 5 + + + + + + + + data.int_seven != 6 + + + 7 != 6 + + + + + data.int_seven != 8 + + + 7 != 8 + + + + + data.float_nine_point_one != Approx( 9.11f ) + + + 9.1f != Approx( 9.1099996567 ) + + + + + data.float_nine_point_one != Approx( 9.0f ) + + + 9.1f != Approx( 9.0 ) + + + + + data.float_nine_point_one != Approx( 1 ) + + + 9.1f != Approx( 1.0 ) + + + + + data.float_nine_point_one != Approx( 0 ) + + + 9.1f != Approx( 0.0 ) + + + + + data.double_pi != Approx( 3.1415 ) + + + 3.1415926535 != Approx( 3.1415 ) + + + + + data.str_hello != "goodbye" + + + "hello" != "goodbye" + + + + + data.str_hello != "hell" + + + "hello" != "hell" + + + + + data.str_hello != "hello1" + + + "hello" != "hello1" + + + + + data.str_hello.size() != 6 + + + 5 != 6 + + + + + + + + d <= Approx( 1.24 ) + + + 1.23 <= Approx( 1.24 ) + + + + + d <= Approx( 1.23 ) + + + 1.23 <= Approx( 1.23 ) + + + + + !d <= Approx( 1.22 ) + + + !(1.23 <= Approx( 1.22 )) + + + + + d <= Approx( 1.22 ).epsilon(0.1) + + + 1.23 <= Approx( 1.22 ) + + + + + + + + + + + testStringForMatching(), Contains( "string" ) && Contains( "abc" ) && Contains( "substring" ) && Contains( "contains" ) + + + "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) + + + + + + + + testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) + + + "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) + + + + + testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) + + + "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) + + + + + + + + testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) + + + "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) + + + + + + + + testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) + + + "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) + + + + + + + + testStringForMatching(), !Contains( "different" ) + + + "this string contains 'abc' as a substring" not contains: "different" + + + + + + + + testStringForMatching(), !Contains( "substring" ) + + + "this string contains 'abc' as a substring" not contains: "substring" + + + + + + + + thisThrows(), "expected exception" + + + "expected exception" equals: "expected exception" + + + + + thisThrows(), "should fail" + + + "expected exception" equals: "should fail" + + + + + + + This one ran + + + + + + custom exception + + + + + + + True + + + {?} + + + + + !False + + + true + + + + + !False + + + !{?} + + + + + + + + 0x == o + + + 3221225472 (0x) == {?} + + + + + + + + data.int_seven > 7 + + + 7 > 7 + + + + + data.int_seven < 7 + + + 7 < 7 + + + + + data.int_seven > 8 + + + 7 > 8 + + + + + data.int_seven < 6 + + + 7 < 6 + + + + + data.int_seven < 0 + + + 7 < 0 + + + + + data.int_seven < -1 + + + 7 < -1 + + + + + data.int_seven >= 8 + + + 7 >= 8 + + + + + data.int_seven <= 6 + + + 7 <= 6 + + + + + data.float_nine_point_one < 9 + + + 9.1f < 9 + + + + + data.float_nine_point_one > 10 + + + 9.1f > 10 + + + + + data.float_nine_point_one > 9.2 + + + 9.1f > 9.2 + + + + + data.str_hello > "hello" + + + "hello" > "hello" + + + + + data.str_hello < "hello" + + + "hello" < "hello" + + + + + data.str_hello > "hellp" + + + "hello" > "hellp" + + + + + data.str_hello > "z" + + + "hello" > "z" + + + + + data.str_hello < "hellm" + + + "hello" < "hellm" + + + + + data.str_hello < "a" + + + "hello" < "a" + + + + + data.str_hello >= "z" + + + "hello" >= "z" + + + + + data.str_hello <= "a" + + + "hello" <= "a" + + + + + + + + data.int_seven < 8 + + + 7 < 8 + + + + + data.int_seven > 6 + + + 7 > 6 + + + + + data.int_seven > 0 + + + 7 > 0 + + + + + data.int_seven > -1 + + + 7 > -1 + + + + + data.int_seven >= 7 + + + 7 >= 7 + + + + + data.int_seven >= 6 + + + 7 >= 6 + + + + + data.int_seven <= 7 + + + 7 <= 7 + + + + + data.int_seven <= 8 + + + 7 <= 8 + + + + + data.float_nine_point_one > 9 + + + 9.1f > 9 + + + + + data.float_nine_point_one < 10 + + + 9.1f < 10 + + + + + data.float_nine_point_one < 9.2 + + + 9.1f < 9.2 + + + + + data.str_hello <= "hello" + + + "hello" <= "hello" + + + + + data.str_hello >= "hello" + + + "hello" >= "hello" + + + + + data.str_hello < "hellp" + + + "hello" < "hellp" + + + + + data.str_hello < "zebra" + + + "hello" < "zebra" + + + + + data.str_hello > "hellm" + + + "hello" > "hellm" + + + + + data.str_hello > "a" + + + "hello" > "a" + + + + + +
+ + Message from section one + + +
+
+ + Message from section two + + +
+ +
+ +
+ + + spec.hasFilters() == false + + + false == false + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == false + + + false == false + + + + + spec.matches(tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == false + + + false == false + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == true + + + true == true + + + + + spec.matches( tcC ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == false + + + false == false + + + + + parseTestSpec( "*a" ).matches( tcA ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == false + + + false == false + + + + + parseTestSpec( "a*" ).matches( tcA ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == true + + + true == true + + + + + parseTestSpec( "*a*" ).matches( tcA ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == true + + + true == true + + + + + spec.matches( tcB ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == true + + + true == true + + + + + spec.matches( tcB ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == true + + + true == true + + + + + spec.matches( tcB ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == true + + + true == true + + + + + spec.matches( tcB ) == true + + + true == true + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == true + + + true == true + + + + + spec.matches( tcC ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == true + + + true == true + + + + + spec.matches( tcC ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == true + + + true == true + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == true + + + true == true + + + + + spec.matches( tcC ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == false + + + false == false + + + + + spec.matches( tcD ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == false + + + false == false + + + + + spec.matches( tcD ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == true + + + true == true + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == true + + + true == true + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == true + + + true == true + + + + + spec.matches( tcB ) == true + + + true == true + + + + + spec.matches( tcC ) == false + + + false == false + + + + + spec.matches( tcD ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == true + + + true == true + + + + + spec.matches( tcB ) == true + + + true == true + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == true + + + true == true + + + + + spec.matches( tcB ) == true + + + true == true + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == true + + + true == true + + + + + spec.matches( tcD ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == false + + + false == false + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == false + + + false == false + + + + + spec.matches( tcD ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == false + + + false == false + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == false + + + false == false + + + + + spec.matches( tcD ) == false + + + false == false + + + +
+
+ + + spec.hasFilters() == true + + + true == true + + + + + spec.matches( tcA ) == false + + + false == false + + + + + spec.matches( tcB ) == false + + + false == false + + + + + spec.matches( tcC ) == false + + + false == false + + + + + spec.matches( tcD ) == true + + + true == true + + + +
+ +
+ + + + (std::pair<int, int>( 1, 2 )) == aNicePair + + + { 1, 2 } == { 1, 2 } + + + + + + + + p == 0 + + + 0 == 0 + + + + + p == pNULL + + + 0 == 0 + + + + + p != 0 + + + 0x != 0 + + + + + cp != 0 + + + 0x != 0 + + + + + cpc != 0 + + + 0x != 0 + + + + + returnsNull() == 0 + + + {null string} == 0 + + + + + returnsConstNull() == 0 + + + {null string} == 0 + + + + + 0 != p + + + 0 != 0x + + + + + + + actual address of p: 0x + + + toString(p): 0x + + + + +
+ + + result + + + {?} + + + + + config.processName == "" + + + "" == "" + + + +
+
+ + + result + + + {?} + + + + + config.processName == "test" + + + "test" == "test" + + + + + config.shouldDebugBreak == false + + + false == false + + + + + config.abortAfter == -1 + + + -1 == -1 + + + + + config.noThrow == false + + + false == false + + + + + config.reporterNames.empty() + + + true + + + +
+
+
+ + + result + + + {?} + + + + + cfg.testSpec().matches(fakeTestCase("notIncluded")) == false + + + false == false + + + + + cfg.testSpec().matches(fakeTestCase("test1")) + + + true + + + +
+ +
+
+
+ + + result + + + {?} + + + + + cfg.testSpec().matches(fakeTestCase("test1")) == false + + + false == false + + + + + cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) + + + true + + + +
+ +
+
+
+ + + result + + + {?} + + + + + cfg.testSpec().matches(fakeTestCase("test1")) == false + + + false == false + + + + + cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) + + + true + + + +
+ +
+
+
+ + + cli.parse({"test", "-r", "console"}) + + + {?} + + + + + config.reporterNames[0] == "console" + + + "console" == "console" + + + +
+ +
+
+
+ + + cli.parse({"test", "-r", "xml"}) + + + {?} + + + + + config.reporterNames[0] == "xml" + + + "xml" == "xml" + + + +
+ +
+
+
+ + + cli.parse({"test", "-r", "xml", "-r", "junit"}) + + + {?} + + + + + config.reporterNames.size() == 2 + + + 2 == 2 + + + + + config.reporterNames[0] == "xml" + + + "xml" == "xml" + + + + + config.reporterNames[1] == "junit" + + + "junit" == "junit" + + + +
+ +
+
+
+ + + cli.parse({"test", "--reporter", "junit"}) + + + {?} + + + + + config.reporterNames[0] == "junit" + + + "junit" == "junit" + + + +
+ +
+
+
+ + + cli.parse({"test", "-b"}) + + + {?} + + + + + config.shouldDebugBreak == true + + + true == true + + + +
+ +
+
+
+ + + cli.parse({"test", "--break"}) + + + {?} + + + + + config.shouldDebugBreak + + + true + + + +
+ +
+
+
+ + + cli.parse({"test", "-a"}) + + + {?} + + + + + config.abortAfter == 1 + + + 1 == 1 + + + +
+ +
+
+
+ + + cli.parse({"test", "-x", "2"}) + + + {?} + + + + + config.abortAfter == 2 + + + 2 == 2 + + + +
+ +
+
+
+ + + !result + + + true + + + + + result.errorMessage(), Contains("convert") && Contains("oops") + + + "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) + + + +
+ +
+
+
+ + + cli.parse({"test", "-e"}) + + + {?} + + + + + config.noThrow + + + true + + + +
+ +
+
+
+ + + cli.parse({"test", "--nothrow"}) + + + {?} + + + + + config.noThrow + + + true + + + +
+ +
+
+
+ + + cli.parse({"test", "-o", "filename.ext"}) + + + {?} + + + + + config.outputFilename == "filename.ext" + + + "filename.ext" == "filename.ext" + + + +
+ +
+
+
+ + + cli.parse({"test", "--out", "filename.ext"}) + + + {?} + + + + + config.outputFilename == "filename.ext" + + + "filename.ext" == "filename.ext" + + + +
+ +
+
+
+ + + cli.parse({"test", "-abe"}) + + + {?} + + + + + config.abortAfter == 1 + + + 1 == 1 + + + + + config.shouldDebugBreak + + + true + + + + + config.noThrow == true + + + true == true + + + +
+ +
+
+
+ + + cli.parse({"test"}) + + + {?} + + + + + config.useColour == UseColour::Auto + + + 0 == 0 + + + +
+ +
+
+
+ + + cli.parse({"test", "--use-colour", "auto"}) + + + {?} + + + + + config.useColour == UseColour::Auto + + + 0 == 0 + + + +
+ +
+
+
+ + + cli.parse({"test", "--use-colour", "yes"}) + + + {?} + + + + + config.useColour == UseColour::Yes + + + 1 == 1 + + + +
+ +
+
+
+ + + cli.parse({"test", "--use-colour", "no"}) + + + {?} + + + + + config.useColour == UseColour::No + + + 2 == 2 + + + +
+ +
+
+
+ + + !result + + + true + + + + + result.errorMessage(), Contains( "colour mode must be one of" ) + + + "colour mode must be one of: auto, yes or no. 'wrong' not recognised" contains: "colour mode must be one of" + + + +
+ +
+ +
+ + + + truthy(false) + + + Hey, its truthy! + + + + + + + + + + + +
+ + + before == 0 + + + 0 == 0 + + +
+
+ + + after > before + + + 1 > 0 + + + +
+ +
+ +
+ +
+ +
+
+
+ + + itDoesThis() + + + true + + +
+ + + itDoesThat() + + + true + + + +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ + + v.size() == 0 + + + 0 == 0 + + +
+
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + +
+
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ +
+ +
+ +
+ +
+
+ + + v.size() == 0 + + + 0 == 0 + + +
+
+ + + v.capacity() >= 10 + + + 10 >= 10 + + + + + v.size() == 0 + + + 0 == 0 + + + +
+ +
+ +
+ +
+ + + +A string sent directly to stdout + + +A string sent directly to stderr + + + + + + + d == Approx( 1.23 ) + + + 1.23 == Approx( 1.23 ) + + + + + d != Approx( 1.22 ) + + + 1.23 != Approx( 1.22 ) + + + + + d != Approx( 1.24 ) + + + 1.23 != Approx( 1.24 ) + + + + + Approx( d ) == 1.23 + + + Approx( 1.23 ) == 1.23 + + + + + Approx( d ) != 1.22 + + + Approx( 1.23 ) != 1.22 + + + + + Approx( d ) != 1.24 + + + Approx( 1.23 ) != 1.24 + + + + + +
+ +
+
+ +
+
+ +
+ + +Write to std::cerr +Write to std::clog +Interleaved writes to error streams + + +
+ +
+ +
+
+ +
+ + +Message from section one +Message from section two + + +
+ + + + testStringForMatching(), StartsWith( "string" ) + + + "this string contains 'abc' as a substring" starts with: "string" + + + + + + + + testStringForMatching(), Contains( "string" ) + + + "this string contains 'abc' as a substring" contains: "string" + + + + + testStringForMatching(), Contains( "abc" ) + + + "this string contains 'abc' as a substring" contains: "abc" + + + + + testStringForMatching(), StartsWith( "this" ) + + + "this string contains 'abc' as a substring" starts with: "this" + + + + + testStringForMatching(), EndsWith( "substring" ) + + + "this string contains 'abc' as a substring" ends with: "substring" + + + + + +
+ + + empty.empty() + + + true + + + + + empty.size() == 0 + + + 0 == 0 + + + + + std::strcmp( empty.c_str(), "" ) == 0 + + + 0 == 0 + + + +
+
+ + + s.empty() == false + + + false == false + + + + + s.size() == 5 + + + 5 == 5 + + + + + isSubstring( s ) == false + + + false == false + + + + + std::strcmp( rawChars, "hello" ) == 0 + + + 0 == 0 + + +
+ + + isOwned( s ) == false + + + false == false + + + + + s.c_str() == rawChars + + + "hello" == "hello" + + + + + isOwned( s ) == false + + + false == false + + + +
+ +
+
+ + + original == "original" + + + original == "original" + + + + + isSubstring( original ) + + + false + + + +
+
+
+ + + ss.empty() == false + + + false == false + + + + + ss.size() == 5 + + + 5 == 5 + + + + + std::strcmp( ss.c_str(), "hello" ) == 0 + + + 0 == 0 + + + + + ss == "hello" + + + hello == "hello" + + + +
+ +
+
+
+ + + isSubstring( ss ) + + + true + + + + + isOwned( ss ) == false + + + false == false + + + + + rawChars == data( s ) + + + "hello world!" == "hello world!" + + + + + ss.c_str() != rawChars + + + "hello" != "hello world!" + + + + + isSubstring( ss ) == false + + + false == false + + + + + isOwned( ss ) + + + true + + + + + data( ss ) != data( s ) + + + "hello" != "hello world!" + + + +
+ +
+
+
+ + + ss.size() == 6 + + + 6 == 6 + + + + + std::strcmp( ss.c_str(), "world!" ) == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + s.c_str() == s2.c_str() + + + "hello world!" == "hello world!" + + + +
+ +
+
+
+ + + s.c_str() != ss.c_str() + + + "hello world!" != "hello" + + + +
+ +
+
+ + + StringRef("hello") == StringRef("hello") + + + hello == hello + + + + + StringRef("hello") != StringRef("cello") + + + hello != cello + + + +
+
+
+ + + sr == "a standard string" + + + a standard string == "a standard string" + + + + + sr.size() == stdStr.size() + + + 17 == 17 + + + +
+ +
+
+
+ + + sr == "a standard string" + + + a standard string == "a standard string" + + + + + sr.size() == stdStr.size() + + + 17 == 17 + + + +
+ +
+
+
+ + + sr == "a standard string" + + + a standard string == "a standard string" + + + + + sr.size() == stdStr.size() + + + 17 == 17 + + + +
+ +
+
+
+ + + stdStr == "a stringref" + + + "a stringref" == "a stringref" + + + + + stdStr.size() == sr.size() + + + 11 == 11 + + + +
+ +
+
+
+ + + stdStr == "a stringref" + + + "a stringref" == "a stringref" + + + + + stdStr.size() == sr.size() + + + 11 == 11 + + + +
+ +
+
+
+ + + stdStr == "a stringref" + + + "a stringref" == "a stringref" + + + + + stdStr.size() == sr.size() + + + 11 == 11 + + + +
+ +
+ +
+ + + + s1 == s2 + + + "if ($b == 10) { + $a = 20; +}" +== +"if ($b == 10) { + $a = 20; +} +" + + + + + +
+ + + what, Contains( "[@zzz]" ) + + + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "[@zzz]" + + + + + what, Contains( "file" ) + + + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "file" + + + + + what, Contains( "2" ) + + + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "2" + + + + + what, Contains( "10" ) + + + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "10" + + + +
+
+ + + registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + + + registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + + + registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + + + registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) + + + registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) + + + +
+ +
+ + + + + + + 0x == bit30and31 + + + 3221225472 (0x) == 3221225472 + + + + + + + + 1 == 2 + + + 1 == 2 + + + + + + + + + + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s1.isSuccessfullyCompleted() + + + true + + + + + testCase.isComplete() == false + + + false == false + + + + + ctx.completedCycle() + + + true + + + + + testCase.isSuccessfullyCompleted() + + + true + + + +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s1.isComplete() + + + true + + + + + s1.isSuccessfullyCompleted() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + + + + ctx.completedCycle() + + + true + + + + + testCase.isSuccessfullyCompleted() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() == false + + + false == false + + + + + ctx.completedCycle() + + + true + + + + + testCase.isComplete() + + + true + + + + + testCase.isSuccessfullyCompleted() + + + true + + + +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s1.isComplete() + + + true + + + + + s1.isSuccessfullyCompleted() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + + + + ctx.completedCycle() + + + true + + + + + testCase.isSuccessfullyCompleted() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() == false + + + false == false + + + + + s2.isOpen() + + + true + + + + + ctx.completedCycle() + + + true + + + + + testCase.isComplete() + + + true + + + + + testCase.isSuccessfullyCompleted() + + + true + + + +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s2.isOpen() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() == false + + + false == false + + + + + s2b.isOpen() + + + true + + + + + ctx.completedCycle() == false + + + false == false + + +
+ + + ctx.completedCycle() + + + true + + + + + s2b.isSuccessfullyCompleted() + + + true + + + + + testCase2.isComplete() == false + + + false == false + + + + + testCase2.isSuccessfullyCompleted() + + + true + + + +
+ +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s2.isOpen() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() == false + + + false == false + + + + + s2b.isOpen() + + + true + + + + + ctx.completedCycle() == false + + + false == false + + +
+ + + ctx.completedCycle() + + + true + + + + + s2b.isComplete() + + + true + + + + + s2b.isSuccessfullyCompleted() == false + + + false == false + + + + + testCase2.isSuccessfullyCompleted() == false + + + false == false + + + + + testCase3.isOpen() + + + true + + + + + s1c.isOpen() == false + + + false == false + + + + + s2c.isOpen() == false + + + false == false + + + + + testCase3.isSuccessfullyCompleted() + + + true + + + +
+ +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s2.isOpen() + + + true + + + + + s2.isComplete() + + + true + + + + + s1.isComplete() == false + + + false == false + + + + + s1.isComplete() + + + true + + + + + testCase.isComplete() == false + + + false == false + + + + + testCase.isComplete() + + + true + + + +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + g1.isOpen() + + + true + + + + + g1.index() == 0 + + + 0 == 0 + + + + + g1.isComplete() == false + + + false == false + + + + + s1.isComplete() == false + + + false == false + + +
+ + + s1.isComplete() == false + + + false == false + + + + + testCase.isSuccessfullyCompleted() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() + + + true + + + + + g1b.isOpen() + + + true + + + + + g1b.index() == 1 + + + 1 == 1 + + + + + s1.isComplete() == false + + + false == false + + + + + s1b.isComplete() + + + true + + + + + g1b.isComplete() + + + true + + + + + testCase2.isComplete() + + + true + + + +
+ +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + g1.isOpen() + + + true + + + + + g1.index() == 0 + + + 0 == 0 + + + + + g1.isComplete() == false + + + false == false + + + + + s1.isComplete() == false + + + false == false + + +
+ + + s2.isOpen() + + + true + + + + + s2.isComplete() + + + true + + + + + s1.isComplete() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() + + + true + + + + + g1b.isOpen() + + + true + + + + + g1b.index() == 1 + + + 1 == 1 + + + + + s2b.isOpen() + + + true + + + + + s2b.isComplete() + + + true + + + + + g1b.isComplete() + + + true + + + + + s1b.isComplete() + + + true + + + + + testCase2.isComplete() + + + true + + + +
+ +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + g1.isOpen() + + + true + + + + + g1.index() == 0 + + + 0 == 0 + + + + + g1.isComplete() == false + + + false == false + + + + + s1.isComplete() == false + + + false == false + + +
+ + + s2.isOpen() + + + true + + + + + s2.isComplete() + + + true + + + + + s2.isSuccessfullyCompleted() == false + + + false == false + + + + + s1.isComplete() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() + + + true + + + + + g1b.isOpen() + + + true + + + + + g1b.index() == 0 + + + 0 == 0 + + + + + s2b.isOpen() == false + + + false == false + + + + + g1b.isComplete() == false + + + false == false + + + + + s1b.isComplete() == false + + + false == false + + + + + testCase2.isComplete() == false + + + false == false + + + + + testCase3.isOpen() + + + true + + + + + s1c.isOpen() + + + true + + + + + g1c.isOpen() + + + true + + + + + g1c.index() == 1 + + + 1 == 1 + + + + + s2c.isOpen() + + + true + + + + + s2c.isComplete() + + + true + + + + + g1c.isComplete() + + + true + + + + + s1c.isComplete() + + + true + + + + + testCase3.isComplete() + + + true + + + +
+ +
+ +
+ +
+ + + 3.14 + + + + + + + d == approx( 1.23 ) + + + 1.23 == Approx( 1.23 ) + + + + + d == approx( 1.22 ) + + + 1.23 == Approx( 1.22 ) + + + + + d == approx( 1.24 ) + + + 1.23 == Approx( 1.24 ) + + + + + d != approx( 1.25 ) + + + 1.23 != Approx( 1.25 ) + + + + + approx( d ) == 1.23 + + + Approx( 1.23 ) == 1.23 + + + + + approx( d ) == 1.22 + + + Approx( 1.23 ) == 1.22 + + + + + approx( d ) == 1.24 + + + Approx( 1.23 ) == 1.24 + + + + + approx( d ) != 1.25 + + + Approx( 1.23 ) != 1.25 + + + + + +
+ +
+ +
+ +
+ + + v, VectorContains( 1 ) + + + { 1, 2, 3 } Contains: 1 + + + + + v, VectorContains( 2 ) + + + { 1, 2, 3 } Contains: 2 + + + +
+
+ + + v, Contains( v2 ) + + + { 1, 2, 3 } Contains: { 1, 2 } + + + + + v, Contains( v2 ) + + + { 1, 2, 3 } Contains: { 1, 2, 3 } + + + + + v, Contains( empty) + + + { 1, 2, 3 } Contains: { } + + + + + empty, Contains( empty) + + + { } Contains: { } + + + +
+
+ + + v, Equals( v ) + + + { 1, 2, 3 } Equals: { 1, 2, 3 } + + + + + empty, Equals( empty ) + + + { } Equals: { } + + + + + v, Equals( v2 ) + + + { 1, 2, 3 } Equals: { 1, 2, 3 } + + + +
+ +
+ +
+ + + v, VectorContains( -1 ) + + + { 1, 2, 3 } Contains: -1 + + + + + empty, VectorContains( 1 ) + + + { } Contains: 1 + + + +
+
+ + + empty, Contains( v) + + + { } Contains: { 1, 2, 3 } + + + + + v, Contains( v2 ) + + + { 1, 2, 3 } Contains: { 1, 2, 4 } + + + +
+
+ + + v, Equals( v2 ) + + + { 1, 2, 3 } Equals: { 1, 2 } + + + + + v2, Equals( v ) + + + { 1, 2 } Equals: { 1, 2, 3 } + + + + + empty, Equals( v ) + + + { } Equals: { 1, 2, 3 } + + + + + v, Equals( empty ) + + + { 1, 2, 3 } Equals: { } + + + +
+ +
+ + + + thisThrows(), std::domain_error + + + thisThrows(), std::domain_error + + + + + thisDoesntThrow() + + + thisDoesntThrow() + + + + + thisThrows() + + + thisThrows() + + + + + + + unexpected exception + + + + + + + thisThrows() == 0 + + + thisThrows() == 0 + + + expected exception + + + + + + + + thisThrows() == 0 + + + thisThrows() == 0 + + + expected exception + + + + + + + + thisThrows() == 0 + + + thisThrows() == 0 + + + expected exception + + + + + +
+ + unexpected exception + + +
+ +
+ + + + + + Uncomment the code in this test to check that it gives a sensible compiler error + + + + + + Uncomment the code in this test to check that it gives a sensible compiler error + + + + + + + + + + + + + + + + +
+ + + encode( "normal string" ) == "normal string" + + + "normal string" == "normal string" + + + +
+
+ + + encode( "" ) == "" + + + "" == "" + + + +
+
+ + + encode( "smith & jones" ) == "smith &amp; jones" + + + "smith &amp; jones" == "smith &amp; jones" + + + +
+
+ + + encode( "smith < jones" ) == "smith &lt; jones" + + + "smith &lt; jones" == "smith &lt; jones" + + + +
+
+ + + encode( "smith > jones" ) == "smith > jones" + + + "smith > jones" == "smith > jones" + + + + + encode( "smith ]]> jones" ) == "smith ]]&gt; jones" + + + "smith ]]&gt; jones" +== +"smith ]]&gt; jones" + + + +
+
+ + + encode( stringWithQuotes ) == stringWithQuotes + + + "don't "quote" me on that" +== +"don't "quote" me on that" + + + + + encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't &quot;quote&quot; me on that" + + + "don't &quot;quote&quot; me on that" +== +"don't &quot;quote&quot; me on that" + + + +
+
+ + + encode( "[\x01]" ) == "[\\x01]" + + + "[\x01]" == "[\x01]" + + + +
+
+ + + encode( "[\x7F]" ) == "[\\x7F]" + + + "[\x7F]" == "[\x7F]" + + + +
+ +
+ + + + + + + x == 0 + + + 0 == 0 + + + + + + + + obj.prop != 0 + + + 0x != 0 + + + + + + + + flag + + + true + + + + + testCheckedElse( true ) + + + true + + + + + + + + flag + + + false + + + + + testCheckedElse( false ) + + + false + + + + + + + + flag + + + true + + + + + testCheckedIf( true ) + + + true + + + + + + + + flag + + + false + + + + + testCheckedIf( false ) + + + false + + + + + + + + unsigned_char_var == 1 + + + 1 == 1 + + + + + unsigned_short_var == 1 + + + 1 == 1 + + + + + unsigned_int_var == 1 + + + 1 == 1 + + + + + unsigned_long_var == 1 + + + 1 == 1 + + + + + + + + long_var == unsigned_char_var + + + 1 == 1 + + + + + long_var == unsigned_short_var + + + 1 == 1 + + + + + long_var == unsigned_int_var + + + 1 == 1 + + + + + long_var == unsigned_long_var + + + 1 == 1 + + + + + +
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ + + + +loose text artifact + + + + + Previous info should not be seen + + + + + + + + + + l == std::numeric_limits<long long>::max() + + + 9223372036854775807 (0x) +== +9223372036854775807 (0x) + + + + + +
+ + + b > a + + + 0 > 1 + + + +
+ +
+ + + Testing if fib[0] (1) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[1] (1) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[2] (2) is even + + + + ( fib[i] % 2 ) == 0 + + + 0 == 0 + + + + Testing if fib[3] (3) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[4] (5) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[5] (8) is even + + + + ( fib[i] % 2 ) == 0 + + + 0 == 0 + + + + Testing if fib[6] (13) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[7] (21) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + + +
+
+ + + a == b + + + 1 == 2 + + + +
+ +
+
+
+ + + a != b + + + 1 != 2 + + + +
+ +
+
+
+ + + a < b + + + 1 < 2 + + + +
+ +
+ +
+ +
+ + + a != b + + + 1 != 2 + + + + + b != a + + + 2 != 1 + + +
+ + + a != b + + + 1 != 2 + + + +
+ +
+ +
+ + + + s == "7" + + + "7" == "7" + + + + + + + + ti == typeid(int) + + + {?} == {?} + + + + + + + + + + + makeString( false ) != static_cast<char*>(0) + + + "valid string" != {null string} + + + + + makeString( true ) == static_cast<char*>(0) + + + {null string} == {null string} + + + + + + + + ptr.get() == 0 + + + 0 == 0 + + + + + + + + ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" + + + "{ { 42, "Arthur" }, { "Ford", 24 } }" +== +"{ { 42, "Arthur" }, { "Ford", 24 } }" + + + + + + + + p == 0 + + + 0 == 0 + + + + + +
+ + + a != b + + + 1 != 2 + + + + + b != a + + + 2 != 1 + + + +
+
+ + + a != b + + + 1 != 2 + + + +
+ +
+ +
+ + + Catch::replaceInPlace( letters, "b", "z" ) + + + true + + + + + letters == "azcdefcg" + + + "azcdefcg" == "azcdefcg" + + + +
+
+ + + Catch::replaceInPlace( letters, "c", "z" ) + + + true + + + + + letters == "abzdefzg" + + + "abzdefzg" == "abzdefzg" + + + +
+
+ + + Catch::replaceInPlace( letters, "a", "z" ) + + + true + + + + + letters == "zbcdefcg" + + + "zbcdefcg" == "zbcdefcg" + + + +
+
+ + + Catch::replaceInPlace( letters, "g", "z" ) + + + true + + + + + letters == "abcdefcz" + + + "abcdefcz" == "abcdefcz" + + + +
+
+ + + Catch::replaceInPlace( letters, letters, "replaced" ) + + + true + + + + + letters == "replaced" + + + "replaced" == "replaced" + + + +
+
+ + + !Catch::replaceInPlace( letters, "x", "z" ) + + + !false + + + + + letters == letters + + + "abcdefcg" == "abcdefcg" + + + +
+
+ + + Catch::replaceInPlace( s, "'", "|'" ) + + + true + + + + + s == "didn|'t" + + + "didn|'t" == "didn|'t" + + + +
+ +
+ + + + + + 3 + + + + false + + + false + + + + + + + hi + + + i := 7 + + + + false + + + false + + + + + + + + ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }" + + + "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" + + + + + + + + ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }" + + + "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" + + + + + + + + ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" + + + "{ { "green", 55 } }" +== +"{ { "green", 55 } }" + + + + + + + + std::string( "first" ) == "second" + + + "first" == "second" + + + + + + + + ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" + + + "StringMaker<has_maker>" +== +"StringMaker<has_maker>" + + + + + + + + ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" + + + "StringMaker<has_maker_and_operator>" +== +"StringMaker<has_maker_and_operator>" + + + + + + + + ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" + + + "operator<<( has_operator )" +== +"operator<<( has_operator )" + + + + + + + + result == "\"wide load\"" + + + ""wide load"" == ""wide load"" + + + + + + + + result == "\"wide load\"" + + + ""wide load"" == ""wide load"" + + + + + + + + result == "\"wide load\"" + + + ""wide load"" == ""wide load"" + + + + + + + + result == "\"wide load\"" + + + ""wide load"" == ""wide load"" + + + + + + + + ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" + + + "{ StringMaker<has_maker> }" +== +"{ StringMaker<has_maker> }" + + + + + + + + ::Catch::Detail::stringify(e0) == "E2/V0" + + + "E2/V0" == "E2/V0" + + + + + ::Catch::Detail::stringify(e1) == "E2/V1" + + + "E2/V1" == "E2/V1" + + + + + ::Catch::Detail::stringify(e3) == "Unknown enum value 10" + + + "Unknown enum value 10" +== +"Unknown enum value 10" + + + + + + + + ::Catch::Detail::stringify(e0) == "0" + + + "{?}" == "0" + + + + + ::Catch::Detail::stringify(e1) == "1" + + + "{?}" == "1" + + + + + + + + ::Catch::Detail::stringify(e0) == "E2{0}" + + + "E2{0}" == "E2{0}" + + + + + ::Catch::Detail::stringify(e1) == "E2{1}" + + + "E2{1}" == "E2{1}" + + + + + + + + ::Catch::Detail::stringify(e0) == "0" + + + "0" == "0" + + + + + ::Catch::Detail::stringify(e1) == "1" + + + "1" == "1" + + + + + + + + "{ }" == ::Catch::Detail::stringify(type{}) + + + "{ }" == "{ }" + + + + + "{ }" == ::Catch::Detail::stringify(value) + + + "{ }" == "{ }" + + + + + + + + "1.2f" == ::Catch::Detail::stringify(float(1.2)) + + + "1.2f" == "1.2f" + + + + + "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0}) + + + "{ 1.2f, 0 }" == "{ 1.2f, 0 }" + + + + + + + + "{ 0 }" == ::Catch::Detail::stringify(type{0}) + + + "{ 0 }" == "{ 0 }" + + + + + + + + "{ 0, 42, \"Catch me\" }" == ::Catch::Detail::stringify(value) + + + "{ 0, 42, "Catch me" }" +== +"{ 0, 42, "Catch me" }" + + + + + + + + "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) + + + "{ "hello", "world" }" +== +"{ "hello", "world" }" + + + + + + + + "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) + + + "{ { 42 }, { }, 1.2f }" +== +"{ { 42 }, { }, 1.2f }" + + + + + + + + ::Catch::Detail::stringify(v) == "{ }" + + + "{ }" == "{ }" + + + + + ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }" + + + "{ { "hello" }, { "world" } }" +== +"{ { "hello" }, { "world" } }" + + + + + + + + ::Catch::Detail::stringify(vv) == "{ }" + + + "{ }" == "{ }" + + + + + ::Catch::Detail::stringify(vv) == "{ 42 }" + + + "{ 42 }" == "{ 42 }" + + + + + ::Catch::Detail::stringify(vv) == "{ 42, 250 }" + + + "{ 42, 250 }" == "{ 42, 250 }" + + + + + + + + ::Catch::Detail::stringify(vv) == "{ }" + + + "{ }" == "{ }" + + + + + ::Catch::Detail::stringify(vv) == "{ 42 }" + + + "{ 42 }" == "{ 42 }" + + + + + ::Catch::Detail::stringify(vv) == "{ 42, 250 }" + + + "{ 42, 250 }" == "{ 42, 250 }" + + + + + + + + ::Catch::Detail::stringify(vv) == "{ }" + + + "{ }" == "{ }" + + + + + ::Catch::Detail::stringify(vv) == "{ \"hello\" }" + + + "{ "hello" }" == "{ "hello" }" + + + + + ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }" + + + "{ "hello", "world" }" +== +"{ "hello", "world" }" + + + + + + + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index a03b21ff..8d15c6a4 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -435,3 +435,9 @@ TEST_CASE( "null deref", "[.][failing][!nonportable]" ) { int *x = NULL; *x = 1; } + +TEST_CASE( "non-copyable objects", "[.]" ) { + // Thanks to Agustin Bergé (@k-ballo on the cpplang Slack) for raising this + std::type_info const& ti = typeid(int); + CHECK( ti == typeid(int) ); +}