From bf61a418cbc4d3b430e3d258c5287780944ad505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 20 Jun 2021 16:25:57 +0200 Subject: [PATCH] Remove the ill-conceived compilation perf tests using real tests --- .../Baselines/compact.sw.approved.txt | 370 ++-- .../Baselines/console.std.approved.txt | 66 +- .../Baselines/console.sw.approved.txt | 402 ++-- .../SelfTest/Baselines/junit.sw.approved.txt | 132 +- .../Baselines/sonarqube.sw.approved.txt | 132 +- tests/SelfTest/Baselines/tap.sw.approved.txt | 370 ++-- .../Baselines/teamcity.sw.approved.txt | 66 +- tests/SelfTest/Baselines/xml.sw.approved.txt | 382 ++-- .../CompileTimePerfTests/10.tests.cpp | 13 - .../CompileTimePerfTests/100.tests.cpp | 13 - .../CompileTimePerfTests/All.tests.cpp | 15 - tests/SelfTest/UsageTests/Approx.tests.cpp | 17 +- tests/SelfTest/UsageTests/BDD.tests.cpp | 140 +- tests/SelfTest/UsageTests/Class.tests.cpp | 81 +- .../SelfTest/UsageTests/Compilation.tests.cpp | 223 +- tests/SelfTest/UsageTests/Condition.tests.cpp | 41 +- tests/SelfTest/UsageTests/Exception.tests.cpp | 79 +- tests/SelfTest/UsageTests/Matchers.tests.cpp | 1864 +++++++++-------- tests/SelfTest/UsageTests/Misc.tests.cpp | 98 +- 19 files changed, 2228 insertions(+), 2276 deletions(-) delete mode 100644 tests/SelfTest/CompileTimePerfTests/10.tests.cpp delete mode 100644 tests/SelfTest/CompileTimePerfTests/100.tests.cpp delete mode 100644 tests/SelfTest/CompileTimePerfTests/All.tests.cpp diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 4fd35284..11e0ac04 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -290,10 +290,10 @@ Approx.tests.cpp:: passed: 0 == Approx( dZero) for: 0 == Approx( 0. Approx.tests.cpp:: passed: 0 == Approx( dSmall ).margin( 0.001 ) for: 0 == Approx( 0.00001 ) Approx.tests.cpp:: passed: 1.234f == Approx( dMedium ) for: 1.234f == Approx( 1.234 ) Approx.tests.cpp:: passed: dMedium == Approx( 1.234f ) for: 1.234 == Approx( 1.2339999676 ) -Matchers.tests.cpp:: passed: 1, Predicate(alwaysTrue, "always true") for: 1 matches predicate: "always true" -Matchers.tests.cpp:: passed: 1, !Predicate(alwaysFalse, "always false") for: 1 not matches predicate: "always false" -Matchers.tests.cpp:: passed: "Hello olleH", Predicate( [] (std::string const& str) -> bool { return str.front() == str.back(); }, "First and last character should be equal") for: "Hello olleH" matches predicate: "First and last character should be equal" -Matchers.tests.cpp:: passed: "This wouldn't pass", !Predicate( [] (std::string const& str) -> bool { return str.front() == str.back(); } ) for: "This wouldn't pass" not matches undescribed predicate +Matchers.tests.cpp:: passed: 1, Predicate( alwaysTrue, "always true" ) for: 1 matches predicate: "always true" +Matchers.tests.cpp:: passed: 1, !Predicate( alwaysFalse, "always false" ) for: 1 not matches predicate: "always false" +Matchers.tests.cpp:: passed: "Hello olleH", Predicate( []( std::string const& str ) -> bool { return str.front() == str.back(); }, "First and last character should be equal" ) for: "Hello olleH" matches predicate: "First and last character should be equal" +Matchers.tests.cpp:: passed: "This wouldn't pass", !Predicate( []( std::string const& str ) -> bool { return str.front() == str.back(); } ) for: "This wouldn't pass" not matches undescribed predicate Compilation.tests.cpp:: passed: lhs | rhs for: Val: 1 | Val: 2 Compilation.tests.cpp:: passed: !(lhs & rhs) for: !(Val: 1 & Val: 2) Compilation.tests.cpp:: passed: HasBitOperators{ 1 } & HasBitOperators{ 1 } for: Val: 1 & Val: 1 @@ -346,41 +346,41 @@ ToStringGeneral.tests.cpp:: passed: c == i for: 4 == 4 ToStringGeneral.tests.cpp:: passed: c == i for: 5 == 5 Clara.tests.cpp:: passed: name.empty() for: true Clara.tests.cpp:: passed: name == "foo" for: "foo" == "foo" -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && MatcherC()), Catch::Matchers::Detail::MatchAllOfGeneric >::value' -Matchers.tests.cpp:: passed: 1, (MatcherA() && MatcherB()) && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch::Matchers::Detail::MatchAllOfGeneric >::value' -Matchers.tests.cpp:: passed: 1, MatcherA() && (MatcherB() && MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD())), Catch::Matchers::Detail::MatchAllOfGeneric >::value' -Matchers.tests.cpp:: passed: 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || MatcherC()), Catch::Matchers::Detail::MatchAnyOfGeneric >::value' -Matchers.tests.cpp:: passed: 1, (MatcherA() || MatcherB()) || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch::Matchers::Detail::MatchAnyOfGeneric >::value' -Matchers.tests.cpp:: passed: 1, MatcherA() || (MatcherB() || MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD())), Catch::Matchers::Detail::MatchAnyOfGeneric >::value' -Matchers.tests.cpp:: passed: 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric >::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +Matchers.tests.cpp:: passed: 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +Matchers.tests.cpp:: passed: 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>:: value' +Matchers.tests.cpp:: passed: 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +Matchers.tests.cpp:: passed: 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +Matchers.tests.cpp:: passed: 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>:: value' +Matchers.tests.cpp:: passed: 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' Matchers.tests.cpp:: passed: 0, !MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(!!MatcherA()), MatcherA const& >::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same::value' Matchers.tests.cpp:: passed: 1, !!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(!!!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric >::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' Matchers.tests.cpp:: passed: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(!!!!MatcherA()), MatcherA const & >::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same::value' Matchers.tests.cpp:: passed: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(StartsWith("foo") || (StartsWith("bar") && EndsWith("bar") && !EndsWith("foo"))), Catch::Matchers::Detail::MatchAnyOf >::value' -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(MatcherA() || MatcherB()), Catch::Matchers::Detail::MatchAnyOfGeneric >::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same>::value' Matchers.tests.cpp:: passed: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(MatcherA() && MatcherB()), Catch::Matchers::Detail::MatchAllOfGeneric >::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same>::value' Matchers.tests.cpp:: passed: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype(MatcherA() || !MatcherB()), Catch::Matchers::Detail::MatchAnyOfGeneric> >::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>::value' Matchers.tests.cpp:: passed: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) -Matchers.tests.cpp:: passed: vec, Predicate>([](auto const& v) { return std::all_of(v.begin(), v.end(), [](int elem) { return elem % 2 == 1; }); }, "All elements are odd") && !EqualsRange(a) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) -Matchers.tests.cpp:: passed: str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar") for: "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) -Matchers.tests.cpp:: passed: str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar") for: "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) -Matchers.tests.cpp:: passed: str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar") for: "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) -Matchers.tests.cpp:: passed: str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar") for: "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) -Matchers.tests.cpp:: passed: str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar")) for: "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) -Matchers.tests.cpp:: passed: str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr) for: "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) -Matchers.tests.cpp:: passed: container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c) for: { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) +Matchers.tests.cpp:: passed: vec, Predicate>( []( auto const& v ) { return std::all_of( v.begin(), v.end(), []( int elem ) { return elem % 2 == 1; } ); }, "All elements are odd" ) && !EqualsRange( a ) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) +Matchers.tests.cpp:: passed: str, StartsWith( "foo" ) && EqualsRange( arr ) && EndsWith( "bar" ) for: "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) +Matchers.tests.cpp:: passed: str, StartsWith( "foo" ) && !EqualsRange( bad_arr ) && EndsWith( "bar" ) for: "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) +Matchers.tests.cpp:: passed: str, EqualsRange( arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) for: "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) +Matchers.tests.cpp:: passed: str, !EqualsRange( bad_arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) for: "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) +Matchers.tests.cpp:: passed: str, EqualsRange( bad_arr ) || ( StartsWith( "foo" ) && EndsWith( "bar" ) ) for: "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) +Matchers.tests.cpp:: passed: str, ( StartsWith( "foo" ) && EndsWith( "bar" ) ) || EqualsRange( bad_arr ) for: "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) +Matchers.tests.cpp:: passed: container, EqualsRange( a ) || EqualsRange( b ) || EqualsRange( c ) for: { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) Tricky.tests.cpp:: passed: std::vector{constructor_throws{}, constructor_throws{}} Tricky.tests.cpp:: passed: std::vector{constructor_throws{}, constructor_throws{}} Tricky.tests.cpp:: passed: std::vector{1, 2, 3} == std::vector{1, 2, 3} @@ -434,7 +434,7 @@ Condition.tests.cpp:: passed: (std::numeric_limits::max)( Matchers.tests.cpp:: passed: !(matcher.match( 1 )) for: !false Matchers.tests.cpp:: passed: first.matchCalled for: true Matchers.tests.cpp:: passed: !second.matchCalled for: true -Matchers.tests.cpp:: passed: matcher.match(1) for: true +Matchers.tests.cpp:: passed: matcher.match( 1 ) for: true Matchers.tests.cpp:: passed: first.matchCalled for: true Matchers.tests.cpp:: passed: !second.matchCalled for: true Matchers.tests.cpp:: passed: !(matcher.match( 1 )) for: !false @@ -443,8 +443,8 @@ Matchers.tests.cpp:: passed: !second.matchCalled for: true Matchers.tests.cpp:: passed: matcher.match( 1 ) for: true Matchers.tests.cpp:: passed: first.matchCalled for: true Matchers.tests.cpp:: passed: !second.matchCalled for: true -Matchers.tests.cpp:: failed: testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) -Matchers.tests.cpp:: failed: testStringForMatching(), Contains("STRING") for: "this string contains 'abc' as a substring" contains: "STRING" +Matchers.tests.cpp:: failed: testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) +Matchers.tests.cpp:: failed: testStringForMatching(), Contains( "STRING" ) for: "this string contains 'abc' as a substring" contains: "STRING" Generators.tests.cpp:: passed: elem % 2 == 1 for: 1 == 1 Generators.tests.cpp:: passed: elem % 2 == 1 for: 1 == 1 Generators.tests.cpp:: passed: elem % 2 == 1 for: 1 == 1 @@ -469,8 +469,8 @@ ToString.tests.cpp:: passed: enumInfo->lookup(1) == "Value2" for: V ToString.tests.cpp:: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}" -Matchers.tests.cpp:: failed: testStringForMatching(), EndsWith("Substring") for: "this string contains 'abc' as a substring" ends with: "Substring" -Matchers.tests.cpp:: failed: testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) +Matchers.tests.cpp:: failed: testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring" +Matchers.tests.cpp:: failed: testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) EnumToString.tests.cpp:: passed: stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1" EnumToString.tests.cpp:: passed: stringify( EnumClass3::Value2 ) == "Value2" for: "Value2" == "Value2" EnumToString.tests.cpp:: passed: stringify( EnumClass3::Value3 ) == "Value3" for: "Value3" == "Value3" @@ -501,10 +501,10 @@ Condition.tests.cpp:: passed: data.str_hello == "hello" for: "hello Condition.tests.cpp:: passed: "hello" == data.str_hello for: "hello" == "hello" Condition.tests.cpp:: passed: data.str_hello.size() == 5 for: 5 == 5 Condition.tests.cpp:: passed: x == Approx( 1.3 ) for: 1.3 == Approx( 1.3 ) -Matchers.tests.cpp:: passed: testStringForMatching(), Equals("this string contains 'abc' as a substring") for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" -Matchers.tests.cpp:: passed: testStringForMatching(), Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) -Matchers.tests.cpp:: failed: testStringForMatching(), Equals("this string contains 'ABC' as a substring") for: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" -Matchers.tests.cpp:: failed: testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) +Matchers.tests.cpp:: passed: testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" +Matchers.tests.cpp:: passed: testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) +Matchers.tests.cpp:: failed: testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) for: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" +Matchers.tests.cpp:: failed: testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) ToStringGeneral.tests.cpp:: passed: ::Catch::Detail::stringify(WhatException{}) == "This exception has overridden what() method" for: "This exception has overridden what() method" == "This exception has overridden what() method" @@ -512,24 +512,24 @@ ToStringGeneral.tests.cpp:: passed: ::Catch::Detail::stringify(Oper ToStringGeneral.tests.cpp:: passed: ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" for: "StringMakerException" == "StringMakerException" -Matchers.tests.cpp:: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1} -Matchers.tests.cpp:: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1} -Matchers.tests.cpp:: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} -Matchers.tests.cpp:: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} -Matchers.tests.cpp:: failed: throwsSpecialException(3), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:: failed: throwsSpecialException(4), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:: passed: throwsSpecialException(1), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:: passed: throwsSpecialException(2), SpecialException, ExceptionMatcher{2} for: SpecialException::what special exception has value of 2 +Matchers.tests.cpp:: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } +Matchers.tests.cpp:: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } +Matchers.tests.cpp:: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } +Matchers.tests.cpp:: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } +Matchers.tests.cpp:: failed: throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:: failed: throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:: passed: throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:: passed: throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } for: SpecialException::what special exception has value of 2 Exception.tests.cpp:: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" Exception.tests.cpp:: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive) Exception.tests.cpp:: passed: thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected" Exception.tests.cpp:: passed: thisThrows(), EndsWith( "exception" ) for: "expected exception" ends with: "exception" Exception.tests.cpp:: passed: thisThrows(), Contains( "except" ) for: "expected exception" contains: "except" Exception.tests.cpp:: passed: thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) for: "expected exception" contains: "except" (case insensitive) -Matchers.tests.cpp:: passed: throwsDerivedException(), DerivedException, Message("DerivedException::what") for: DerivedException::what exception message matches "DerivedException::what" -Matchers.tests.cpp:: passed: throwsDerivedException(), DerivedException, !Message("derivedexception::what") for: DerivedException::what not exception message matches "derivedexception::what" -Matchers.tests.cpp:: passed: throwsSpecialException(2), SpecialException, !Message("DerivedException::what") for: SpecialException::what not exception message matches "DerivedException::what" -Matchers.tests.cpp:: passed: throwsSpecialException(2), SpecialException, Message("SpecialException::what") for: SpecialException::what exception message matches "SpecialException::what" +Matchers.tests.cpp:: passed: throwsDerivedException(), DerivedException, Message( "DerivedException::what" ) for: DerivedException::what exception message matches "DerivedException::what" +Matchers.tests.cpp:: passed: throwsDerivedException(), DerivedException, !Message( "derivedexception::what" ) for: DerivedException::what not exception message matches "derivedexception::what" +Matchers.tests.cpp:: passed: throwsSpecialException( 2 ), SpecialException, !Message( "DerivedException::what" ) for: SpecialException::what not exception message matches "DerivedException::what" +Matchers.tests.cpp:: passed: throwsSpecialException( 2 ), SpecialException, Message( "SpecialException::what" ) for: SpecialException::what exception message matches "SpecialException::what" Exception.tests.cpp:: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows(), std::string Exception.tests.cpp:: failed: expected exception, got none; expression was: thisDoesntThrow(), std::domain_error Exception.tests.cpp:: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() @@ -542,66 +542,66 @@ Misc.tests.cpp:: passed: Factorial(1) == 1 for: 1 == 1 Misc.tests.cpp:: passed: Factorial(2) == 2 for: 2 == 2 Misc.tests.cpp:: passed: Factorial(3) == 6 for: 6 == 6 Misc.tests.cpp:: passed: Factorial(10) == 3628800 for: 3628800 (0x) == 3628800 (0x) -Matchers.tests.cpp:: passed: 10., WithinRel(11.1, 0.1) for: 10.0 and 11.1 are within 10% of each other -Matchers.tests.cpp:: passed: 10., !WithinRel(11.2, 0.1) for: 10.0 not and 11.2 are within 10% of each other -Matchers.tests.cpp:: passed: 1., !WithinRel(0., 0.99) for: 1.0 not and 0 are within 99% of each other -Matchers.tests.cpp:: passed: -0., WithinRel(0.) for: -0.0 and 0 are within 2.22045e-12% of each other -Matchers.tests.cpp:: passed: v1, WithinRel(v2) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other -Matchers.tests.cpp:: passed: 1., WithinAbs(1., 0) for: 1.0 is within 0.0 of 1.0 -Matchers.tests.cpp:: passed: 0., WithinAbs(1., 1) for: 0.0 is within 1.0 of 1.0 -Matchers.tests.cpp:: passed: 0., !WithinAbs(1., 0.99) for: 0.0 not is within 0.99 of 1.0 -Matchers.tests.cpp:: passed: 0., !WithinAbs(1., 0.99) for: 0.0 not is within 0.99 of 1.0 -Matchers.tests.cpp:: passed: 11., !WithinAbs(10., 0.5) for: 11.0 not is within 0.5 of 10.0 -Matchers.tests.cpp:: passed: 10., !WithinAbs(11., 0.5) for: 10.0 not is within 0.5 of 11.0 -Matchers.tests.cpp:: passed: -10., WithinAbs(-10., 0.5) for: -10.0 is within 0.5 of -10.0 -Matchers.tests.cpp:: passed: -10., WithinAbs(-9.6, 0.5) for: -10.0 is within 0.5 of -9.6 -Matchers.tests.cpp:: passed: 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) -Matchers.tests.cpp:: passed: nextafter(1., 2.), WithinULP(1., 1) for: 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) -Matchers.tests.cpp:: passed: 0., WithinULP(nextafter(0., 1.), 1) for: 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) -Matchers.tests.cpp:: passed: 1., WithinULP(nextafter(1., 0.), 1) for: 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) -Matchers.tests.cpp:: passed: 1., !WithinULP(nextafter(1., 2.), 0) for: 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) -Matchers.tests.cpp:: passed: 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) -Matchers.tests.cpp:: passed: -0., WithinULP(0., 0) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) -Matchers.tests.cpp:: passed: 1., WithinAbs(1., 0.5) || WithinULP(2., 1) for: 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) -Matchers.tests.cpp:: passed: 1., WithinAbs(2., 0.5) || WithinULP(1., 0) for: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) -Matchers.tests.cpp:: passed: 0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) -Matchers.tests.cpp:: passed: WithinAbs(1., 0.) -Matchers.tests.cpp:: passed: WithinAbs(1., -1.), std::domain_error -Matchers.tests.cpp:: passed: WithinULP(1., 0) -Matchers.tests.cpp:: passed: WithinRel(1., 0.) -Matchers.tests.cpp:: passed: WithinRel(1., -0.2), std::domain_error -Matchers.tests.cpp:: passed: WithinRel(1., 1.), std::domain_error -Matchers.tests.cpp:: passed: 10.f, WithinRel(11.1f, 0.1f) for: 10.0f and 11.1 are within 10% of each other -Matchers.tests.cpp:: passed: 10.f, !WithinRel(11.2f, 0.1f) for: 10.0f not and 11.2 are within 10% of each other -Matchers.tests.cpp:: passed: 1.f, !WithinRel(0.f, 0.99f) for: 1.0f not and 0 are within 99% of each other -Matchers.tests.cpp:: passed: -0.f, WithinRel(0.f) for: -0.0f and 0 are within 0.00119209% of each other -Matchers.tests.cpp:: passed: v1, WithinRel(v2) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other -Matchers.tests.cpp:: passed: 1.f, WithinAbs(1.f, 0) for: 1.0f is within 0.0 of 1.0 -Matchers.tests.cpp:: passed: 0.f, WithinAbs(1.f, 1) for: 0.0f is within 1.0 of 1.0 -Matchers.tests.cpp:: passed: 0.f, !WithinAbs(1.f, 0.99f) for: 0.0f not is within 0.9900000095 of 1.0 -Matchers.tests.cpp:: passed: 0.f, !WithinAbs(1.f, 0.99f) for: 0.0f not is within 0.9900000095 of 1.0 -Matchers.tests.cpp:: passed: 0.f, WithinAbs(-0.f, 0) for: 0.0f is within 0.0 of -0.0 -Matchers.tests.cpp:: passed: 11.f, !WithinAbs(10.f, 0.5f) for: 11.0f not is within 0.5 of 10.0 -Matchers.tests.cpp:: passed: 10.f, !WithinAbs(11.f, 0.5f) for: 10.0f not is within 0.5 of 11.0 -Matchers.tests.cpp:: passed: -10.f, WithinAbs(-10.f, 0.5f) for: -10.0f is within 0.5 of -10.0 -Matchers.tests.cpp:: passed: -10.f, WithinAbs(-9.6f, 0.5f) for: -10.0f is within 0.5 of -9.6000003815 -Matchers.tests.cpp:: passed: 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) -Matchers.tests.cpp:: passed: nextafter(1.f, 2.f), WithinULP(1.f, 1) for: 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) -Matchers.tests.cpp:: passed: 0.f, WithinULP(nextafter(0.f, 1.f), 1) for: 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) -Matchers.tests.cpp:: passed: 1.f, WithinULP(nextafter(1.f, 0.f), 1) for: 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) -Matchers.tests.cpp:: passed: 1.f, !WithinULP(nextafter(1.f, 2.f), 0) for: 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) -Matchers.tests.cpp:: passed: 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) -Matchers.tests.cpp:: passed: -0.f, WithinULP(0.f, 0) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) -Matchers.tests.cpp:: passed: 1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1) for: 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) -Matchers.tests.cpp:: passed: 1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0) for: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) -Matchers.tests.cpp:: passed: 0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) -Matchers.tests.cpp:: passed: WithinAbs(1.f, 0.f) -Matchers.tests.cpp:: passed: WithinAbs(1.f, -1.f), std::domain_error -Matchers.tests.cpp:: passed: WithinULP(1.f, 0) -Matchers.tests.cpp:: passed: WithinULP(1.f, static_cast(-1)), std::domain_error -Matchers.tests.cpp:: passed: WithinRel(1.f, 0.f) -Matchers.tests.cpp:: passed: WithinRel(1.f, -0.2f), std::domain_error -Matchers.tests.cpp:: passed: WithinRel(1.f, 1.f), std::domain_error +Matchers.tests.cpp:: passed: 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other +Matchers.tests.cpp:: passed: 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other +Matchers.tests.cpp:: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other +Matchers.tests.cpp:: passed: -0., WithinRel( 0. ) for: -0.0 and 0 are within 2.22045e-12% of each other +Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other +Matchers.tests.cpp:: passed: 1., WithinAbs( 1., 0 ) for: 1.0 is within 0.0 of 1.0 +Matchers.tests.cpp:: passed: 0., WithinAbs( 1., 1 ) for: 0.0 is within 1.0 of 1.0 +Matchers.tests.cpp:: passed: 0., !WithinAbs( 1., 0.99 ) for: 0.0 not is within 0.99 of 1.0 +Matchers.tests.cpp:: passed: 0., !WithinAbs( 1., 0.99 ) for: 0.0 not is within 0.99 of 1.0 +Matchers.tests.cpp:: passed: 11., !WithinAbs( 10., 0.5 ) for: 11.0 not is within 0.5 of 10.0 +Matchers.tests.cpp:: passed: 10., !WithinAbs( 11., 0.5 ) for: 10.0 not is within 0.5 of 11.0 +Matchers.tests.cpp:: passed: -10., WithinAbs( -10., 0.5 ) for: -10.0 is within 0.5 of -10.0 +Matchers.tests.cpp:: passed: -10., WithinAbs( -9.6, 0.5 ) for: -10.0 is within 0.5 of -9.6 +Matchers.tests.cpp:: passed: 1., WithinULP( 1., 0 ) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) +Matchers.tests.cpp:: passed: nextafter( 1., 2. ), WithinULP( 1., 1 ) for: 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) +Matchers.tests.cpp:: passed: 0., WithinULP( nextafter( 0., 1. ), 1 ) for: 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) +Matchers.tests.cpp:: passed: 1., WithinULP( nextafter( 1., 0. ), 1 ) for: 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) +Matchers.tests.cpp:: passed: 1., !WithinULP( nextafter( 1., 2. ), 0 ) for: 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) +Matchers.tests.cpp:: passed: 1., WithinULP( 1., 0 ) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) +Matchers.tests.cpp:: passed: -0., WithinULP( 0., 0 ) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) +Matchers.tests.cpp:: passed: 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) for: 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) +Matchers.tests.cpp:: passed: 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) for: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) +Matchers.tests.cpp:: passed: 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +Matchers.tests.cpp:: passed: WithinAbs( 1., 0. ) +Matchers.tests.cpp:: passed: WithinAbs( 1., -1. ), std::domain_error +Matchers.tests.cpp:: passed: WithinULP( 1., 0 ) +Matchers.tests.cpp:: passed: WithinRel( 1., 0. ) +Matchers.tests.cpp:: passed: WithinRel( 1., -0.2 ), std::domain_error +Matchers.tests.cpp:: passed: WithinRel( 1., 1. ), std::domain_error +Matchers.tests.cpp:: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other +Matchers.tests.cpp:: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other +Matchers.tests.cpp:: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other +Matchers.tests.cpp:: passed: -0.f, WithinRel( 0.f ) for: -0.0f and 0 are within 0.00119209% of each other +Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other +Matchers.tests.cpp:: passed: 1.f, WithinAbs( 1.f, 0 ) for: 1.0f is within 0.0 of 1.0 +Matchers.tests.cpp:: passed: 0.f, WithinAbs( 1.f, 1 ) for: 0.0f is within 1.0 of 1.0 +Matchers.tests.cpp:: passed: 0.f, !WithinAbs( 1.f, 0.99f ) for: 0.0f not is within 0.9900000095 of 1.0 +Matchers.tests.cpp:: passed: 0.f, !WithinAbs( 1.f, 0.99f ) for: 0.0f not is within 0.9900000095 of 1.0 +Matchers.tests.cpp:: passed: 0.f, WithinAbs( -0.f, 0 ) for: 0.0f is within 0.0 of -0.0 +Matchers.tests.cpp:: passed: 11.f, !WithinAbs( 10.f, 0.5f ) for: 11.0f not is within 0.5 of 10.0 +Matchers.tests.cpp:: passed: 10.f, !WithinAbs( 11.f, 0.5f ) for: 10.0f not is within 0.5 of 11.0 +Matchers.tests.cpp:: passed: -10.f, WithinAbs( -10.f, 0.5f ) for: -10.0f is within 0.5 of -10.0 +Matchers.tests.cpp:: passed: -10.f, WithinAbs( -9.6f, 0.5f ) for: -10.0f is within 0.5 of -9.6000003815 +Matchers.tests.cpp:: passed: 1.f, WithinULP( 1.f, 0 ) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) +Matchers.tests.cpp:: passed: nextafter( 1.f, 2.f ), WithinULP( 1.f, 1 ) for: 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) +Matchers.tests.cpp:: passed: 0.f, WithinULP( nextafter( 0.f, 1.f ), 1 ) for: 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) +Matchers.tests.cpp:: passed: 1.f, WithinULP( nextafter( 1.f, 0.f ), 1 ) for: 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) +Matchers.tests.cpp:: passed: 1.f, !WithinULP( nextafter( 1.f, 2.f ), 0 ) for: 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) +Matchers.tests.cpp:: passed: 1.f, WithinULP( 1.f, 0 ) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) +Matchers.tests.cpp:: passed: -0.f, WithinULP( 0.f, 0 ) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) +Matchers.tests.cpp:: passed: 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) for: 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) +Matchers.tests.cpp:: passed: 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) for: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) +Matchers.tests.cpp:: passed: 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +Matchers.tests.cpp:: passed: WithinAbs( 1.f, 0.f ) +Matchers.tests.cpp:: passed: WithinAbs( 1.f, -1.f ), std::domain_error +Matchers.tests.cpp:: passed: WithinULP( 1.f, 0 ) +Matchers.tests.cpp:: passed: WithinULP( 1.f, static_cast( -1 ) ), std::domain_error +Matchers.tests.cpp:: passed: WithinRel( 1.f, 0.f ) +Matchers.tests.cpp:: passed: WithinRel( 1.f, -0.2f ), std::domain_error +Matchers.tests.cpp:: passed: WithinRel( 1.f, 1.f ), std::domain_error Generators.tests.cpp:: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:: passed: i % 2 == 0 for: 0 == 0 @@ -899,13 +899,13 @@ Approx.tests.cpp:: passed: d <= Approx( 1.23 ) for: 1.23 <= Approx( Approx.tests.cpp:: passed: !(d <= Approx( 1.22 )) for: !(1.23 <= Approx( 1.22 )) Approx.tests.cpp:: passed: d <= Approx( 1.22 ).epsilon(0.1) for: 1.23 <= Approx( 1.22 ) Misc.tests.cpp:: passed: with 1 message: 'was called' -Matchers.tests.cpp:: passed: testStringForMatching(), Contains("string") && Contains("abc") && Contains("substring") && Contains("contains") for: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) -Matchers.tests.cpp:: passed: testStringForMatching(), Contains("string") || Contains("different") || Contains("random") for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) -Matchers.tests.cpp:: passed: testStringForMatching2(), Contains("string") || Contains("different") || Contains("random") for: "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) -Matchers.tests.cpp:: passed: testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring") for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) -Matchers.tests.cpp:: failed: testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) -Matchers.tests.cpp:: passed: testStringForMatching(), !Contains("different") for: "this string contains 'abc' as a substring" not contains: "different" -Matchers.tests.cpp:: failed: testStringForMatching(), !Contains("substring") for: "this string contains 'abc' as a substring" not contains: "substring" +Matchers.tests.cpp:: passed: testStringForMatching(), Contains( "string" ) && Contains( "abc" ) && Contains( "substring" ) && Contains( "contains" ) for: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) +Matchers.tests.cpp:: passed: testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) +Matchers.tests.cpp:: passed: testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) for: "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) +Matchers.tests.cpp:: passed: testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) +Matchers.tests.cpp:: failed: testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) +Matchers.tests.cpp:: passed: testStringForMatching(), !Contains( "different" ) for: "this string contains 'abc' as a substring" not contains: "different" +Matchers.tests.cpp:: failed: testStringForMatching(), !Contains( "substring" ) for: "this string contains 'abc' as a substring" not contains: "substring" Exception.tests.cpp:: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" Exception.tests.cpp:: failed: thisThrows(), "should fail" for: "expected exception" equals: "should fail" Generators.tests.cpp:: passed: values > -6 for: 3 > -6 @@ -1014,10 +1014,10 @@ RandomNumberGeneration.tests.cpp:: passed: rng() == 0x 4261393167 (0x) Message.tests.cpp:: failed: explicitly with 1 message: 'Message from section one' Message.tests.cpp:: failed: explicitly with 1 message: 'Message from section two' -Matchers.tests.cpp:: passed: (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed +Matchers.tests.cpp:: passed: ( EvilMatcher(), EvilMatcher() ), EvilCommaOperatorUsed Matchers.tests.cpp:: passed: &EvilMatcher(), EvilAddressOfOperatorUsed -Matchers.tests.cpp:: passed: EvilMatcher() || (EvilMatcher() && !EvilMatcher()) -Matchers.tests.cpp:: passed: (EvilMatcher() && EvilMatcher()) || !EvilMatcher() +Matchers.tests.cpp:: passed: EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) +Matchers.tests.cpp:: passed: ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() CmdLine.tests.cpp:: passed: spec.hasFilters() == false for: false == false CmdLine.tests.cpp:: passed: spec.matches( *tcA ) == false for: false == false CmdLine.tests.cpp:: passed: spec.matches( *tcB ) == false for: false == false @@ -1181,7 +1181,7 @@ ToStringGeneral.tests.cpp:: passed: str1.size() == 3 + 5 for: 8 == ToStringGeneral.tests.cpp:: passed: str2.size() == 3 + 10 for: 13 == 13 ToStringGeneral.tests.cpp:: passed: str1.size() == 2 + 5 for: 7 == 7 ToStringGeneral.tests.cpp:: passed: str2.size() == 2 + 15 for: 17 == 17 -Matchers.tests.cpp:: passed: "foo", Predicate([] (const char* const&) { return true; }) for: "foo" matches undescribed predicate +Matchers.tests.cpp:: passed: "foo", Predicate( []( const char* const& ) { return true; } ) for: "foo" matches undescribed predicate CmdLine.tests.cpp:: passed: result for: {?} CmdLine.tests.cpp:: passed: config.processName == "" for: "" == "" CmdLine.tests.cpp:: passed: result for: {?} @@ -1269,10 +1269,10 @@ Misc.tests.cpp:: passed: std::tuple_size::value >= 1 for: Misc.tests.cpp:: passed: std::tuple_size::value >= 1 for: 1 >= 1 ToString.tests.cpp:: passed: Catch::Detail::stringify(UsesSentinel{}) == "{ }" for: "{ }" == "{ }" Decomposition.tests.cpp:: failed: truthy(false) for: Hey, its truthy! -Matchers.tests.cpp:: failed: testStringForMatching(), Matches("this STRING contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:: failed: testStringForMatching(), Matches("contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:: failed: testStringForMatching(), Matches("this string contains 'abc' as a") for: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively -Matchers.tests.cpp:: passed: actual, !UnorderedEquals(expected) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } +Matchers.tests.cpp:: failed: testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively +Matchers.tests.cpp:: failed: testStringForMatching(), Matches( "contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively +Matchers.tests.cpp:: failed: testStringForMatching(), Matches( "this string contains 'abc' as a" ) for: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively +Matchers.tests.cpp:: passed: actual, !UnorderedEquals( expected ) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } Reporters.tests.cpp:: passed: !(factories.empty()) for: !false Reporters.tests.cpp:: passed: listingString, Contains("fakeTag"s) for: "All available tags: 1 [fakeTag] @@ -1464,21 +1464,21 @@ Approx.tests.cpp:: passed: Approx( d ) != 1.22 for: Approx( 1.23 ) Approx.tests.cpp:: passed: Approx( d ) != 1.24 for: Approx( 1.23 ) != 1.24 Message from section one Message from section two -Matchers.tests.cpp:: failed: testStringForMatching(), StartsWith("This String") for: "this string contains 'abc' as a substring" starts with: "This String" -Matchers.tests.cpp:: failed: testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) +Matchers.tests.cpp:: failed: testStringForMatching(), StartsWith( "This String" ) for: "this string contains 'abc' as a substring" starts with: "This String" +Matchers.tests.cpp:: failed: testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) ToStringGeneral.tests.cpp:: passed: Catch::Detail::stringify(singular) == "{ 1 }" for: "{ 1 }" == "{ 1 }" ToStringGeneral.tests.cpp:: passed: Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" for: "{ 3, 2, 1 }" == "{ 3, 2, 1 }" ToStringGeneral.tests.cpp:: passed: Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" for: "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" == "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" -Matchers.tests.cpp:: passed: testStringForMatching(), Contains("string") for: "this string contains 'abc' as a substring" contains: "string" -Matchers.tests.cpp:: passed: testStringForMatching(), Contains("string", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "string" (case insensitive) -Matchers.tests.cpp:: passed: testStringForMatching(), Contains("abc") for: "this string contains 'abc' as a substring" contains: "abc" -Matchers.tests.cpp:: passed: testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "abc" (case insensitive) -Matchers.tests.cpp:: passed: testStringForMatching(), StartsWith("this") for: "this string contains 'abc' as a substring" starts with: "this" -Matchers.tests.cpp:: passed: testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" starts with: "this" (case insensitive) -Matchers.tests.cpp:: passed: testStringForMatching(), EndsWith("substring") for: "this string contains 'abc' as a substring" ends with: "substring" -Matchers.tests.cpp:: passed: testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) +Matchers.tests.cpp:: passed: testStringForMatching(), Contains( "string" ) for: "this string contains 'abc' as a substring" contains: "string" +Matchers.tests.cpp:: passed: testStringForMatching(), Contains( "string", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "string" (case insensitive) +Matchers.tests.cpp:: passed: testStringForMatching(), Contains( "abc" ) for: "this string contains 'abc' as a substring" contains: "abc" +Matchers.tests.cpp:: passed: testStringForMatching(), Contains( "aBC", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "abc" (case insensitive) +Matchers.tests.cpp:: passed: testStringForMatching(), StartsWith( "this" ) for: "this string contains 'abc' as a substring" starts with: "this" +Matchers.tests.cpp:: passed: testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" starts with: "this" (case insensitive) +Matchers.tests.cpp:: passed: testStringForMatching(), EndsWith( "substring" ) for: "this string contains 'abc' as a substring" ends with: "substring" +Matchers.tests.cpp:: passed: testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) String.tests.cpp:: passed: empty.empty() for: true String.tests.cpp:: passed: empty.size() == 0 for: 0 == 0 String.tests.cpp:: passed: std::strcmp( empty.data(), "" ) == 0 for: 0 == 0 @@ -1905,53 +1905,53 @@ Approx.tests.cpp:: passed: approx( d ) == 1.22 for: Approx( 1.23 ) Approx.tests.cpp:: passed: approx( d ) == 1.24 for: Approx( 1.23 ) == 1.24 Approx.tests.cpp:: passed: approx( d ) != 1.25 for: Approx( 1.23 ) != 1.25 VariadicMacros.tests.cpp:: passed: with 1 message: 'no assertions' -Matchers.tests.cpp:: passed: empty, Approx(empty) for: { } is approx: { } -Matchers.tests.cpp:: passed: v1, Approx(v1) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } -Matchers.tests.cpp:: passed: v1, Approx({ 1., 2., 3. }) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } -Matchers.tests.cpp:: passed: v1, !Approx(temp) for: { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } -Matchers.tests.cpp:: passed: v1, !Approx(v2) for: { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } -Matchers.tests.cpp:: passed: v1, Approx(v2).margin(0.5) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } -Matchers.tests.cpp:: passed: v1, Approx(v2).epsilon(0.5) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } -Matchers.tests.cpp:: passed: v1, Approx(v2).epsilon(0.1).scale(500) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } -Matchers.tests.cpp:: failed: empty, Approx(t1) for: { } is approx: { 1.0, 2.0 } -Matchers.tests.cpp:: failed: v1, Approx(v2) for: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } -Matchers.tests.cpp:: passed: v, VectorContains(1) for: { 1, 2, 3 } Contains: 1 -Matchers.tests.cpp:: passed: v, VectorContains(2) for: { 1, 2, 3 } Contains: 2 -Matchers.tests.cpp:: passed: v5, (VectorContains>(2)) for: { 1, 2, 3 } Contains: 2 -Matchers.tests.cpp:: passed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2 } -Matchers.tests.cpp:: passed: v, Contains({ 1, 2 }) for: { 1, 2, 3 } Contains: { 1, 2 } -Matchers.tests.cpp:: passed: v5, (Contains, CustomAllocator>(v2)) for: { 1, 2, 3 } Contains: { 1, 2 } -Matchers.tests.cpp:: passed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 3 } -Matchers.tests.cpp:: passed: v, Contains(empty) for: { 1, 2, 3 } Contains: { } -Matchers.tests.cpp:: passed: empty, Contains(empty) for: { } Contains: { } -Matchers.tests.cpp:: passed: v5, (Contains, CustomAllocator>(v2)) for: { 1, 2, 3 } Contains: { 1, 2, 3 } -Matchers.tests.cpp:: passed: v5, Contains(v6) for: { 1, 2, 3 } Contains: { 1, 2 } -Matchers.tests.cpp:: passed: v, VectorContains(1) && VectorContains(2) for: { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) -Matchers.tests.cpp:: passed: v, Equals(v) for: { 1, 2, 3 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:: passed: empty, Equals(empty) for: { } Equals: { } -Matchers.tests.cpp:: passed: v, Equals({ 1, 2, 3 }) for: { 1, 2, 3 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:: passed: v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:: passed: v5, (Equals, CustomAllocator>(v2)) for: { 1, 2, 3 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:: passed: v5, Equals(v6) for: { 1, 2, 3 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:: passed: v, UnorderedEquals(v) for: { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:: passed: v, UnorderedEquals({ 3, 2, 1 }) for: { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } -Matchers.tests.cpp:: passed: empty, UnorderedEquals(empty) for: { } UnorderedEquals: { } -Matchers.tests.cpp:: passed: permuted, UnorderedEquals(v) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:: passed: permuted, UnorderedEquals(v) for: { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:: passed: v5, (UnorderedEquals, CustomAllocator>(permuted)) for: { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } -Matchers.tests.cpp:: passed: v5_permuted, UnorderedEquals(v5) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:: failed: v, VectorContains(-1) for: { 1, 2, 3 } Contains: -1 -Matchers.tests.cpp:: failed: empty, VectorContains(1) for: { } Contains: 1 -Matchers.tests.cpp:: failed: empty, Contains(v) for: { } Contains: { 1, 2, 3 } -Matchers.tests.cpp:: failed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 4 } -Matchers.tests.cpp:: failed: v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2 } -Matchers.tests.cpp:: failed: v2, Equals(v) for: { 1, 2 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:: failed: empty, Equals(v) for: { } Equals: { 1, 2, 3 } -Matchers.tests.cpp:: failed: v, Equals(empty) for: { 1, 2, 3 } Equals: { } -Matchers.tests.cpp:: failed: v, UnorderedEquals(empty) for: { 1, 2, 3 } UnorderedEquals: { } -Matchers.tests.cpp:: failed: empty, UnorderedEquals(v) for: { } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:: failed: permuted, UnorderedEquals(v) for: { 1, 3 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:: failed: permuted, UnorderedEquals(v) for: { 3, 1 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:: passed: empty, Approx( empty ) for: { } is approx: { } +Matchers.tests.cpp:: passed: v1, Approx( v1 ) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } +Matchers.tests.cpp:: passed: v1, Approx( { 1., 2., 3. } ) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } +Matchers.tests.cpp:: passed: v1, !Approx( temp ) for: { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } +Matchers.tests.cpp:: passed: v1, !Approx( v2 ) for: { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } +Matchers.tests.cpp:: passed: v1, Approx( v2 ).margin( 0.5 ) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +Matchers.tests.cpp:: passed: v1, Approx( v2 ).epsilon( 0.5 ) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +Matchers.tests.cpp:: passed: v1, Approx( v2 ).epsilon( 0.1 ).scale( 500 ) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +Matchers.tests.cpp:: failed: empty, Approx( t1 ) for: { } is approx: { 1.0, 2.0 } +Matchers.tests.cpp:: failed: v1, Approx( v2 ) for: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } +Matchers.tests.cpp:: passed: v, VectorContains( 1 ) for: { 1, 2, 3 } Contains: 1 +Matchers.tests.cpp:: passed: v, VectorContains( 2 ) for: { 1, 2, 3 } Contains: 2 +Matchers.tests.cpp:: passed: v5, ( VectorContains>( 2 ) ) for: { 1, 2, 3 } Contains: 2 +Matchers.tests.cpp:: passed: v, Contains( v2 ) for: { 1, 2, 3 } Contains: { 1, 2 } +Matchers.tests.cpp:: passed: v, Contains( { 1, 2 } ) for: { 1, 2, 3 } Contains: { 1, 2 } +Matchers.tests.cpp:: passed: v5, ( Contains, CustomAllocator>( v2 ) ) for: { 1, 2, 3 } Contains: { 1, 2 } +Matchers.tests.cpp:: passed: v, Contains( v2 ) for: { 1, 2, 3 } Contains: { 1, 2, 3 } +Matchers.tests.cpp:: passed: v, Contains( empty ) for: { 1, 2, 3 } Contains: { } +Matchers.tests.cpp:: passed: empty, Contains( empty ) for: { } Contains: { } +Matchers.tests.cpp:: passed: v5, ( Contains, CustomAllocator>( v2 ) ) for: { 1, 2, 3 } Contains: { 1, 2, 3 } +Matchers.tests.cpp:: passed: v5, Contains( v6 ) for: { 1, 2, 3 } Contains: { 1, 2 } +Matchers.tests.cpp:: passed: v, VectorContains( 1 ) && VectorContains( 2 ) for: { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) +Matchers.tests.cpp:: passed: v, Equals( v ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:: passed: empty, Equals( empty ) for: { } Equals: { } +Matchers.tests.cpp:: passed: v, Equals( { 1, 2, 3 } ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:: passed: v, Equals( v2 ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:: passed: v5, ( Equals, CustomAllocator>( v2 ) ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:: passed: v5, Equals( v6 ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:: passed: v, UnorderedEquals( v ) for: { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:: passed: v, UnorderedEquals( { 3, 2, 1 } ) for: { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } +Matchers.tests.cpp:: passed: empty, UnorderedEquals( empty ) for: { } UnorderedEquals: { } +Matchers.tests.cpp:: passed: permuted, UnorderedEquals( v ) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:: passed: permuted, UnorderedEquals( v ) for: { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:: passed: v5, ( UnorderedEquals, CustomAllocator>( permuted ) ) for: { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } +Matchers.tests.cpp:: passed: v5_permuted, UnorderedEquals( v5 ) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:: failed: v, VectorContains( -1 ) for: { 1, 2, 3 } Contains: -1 +Matchers.tests.cpp:: failed: empty, VectorContains( 1 ) for: { } Contains: 1 +Matchers.tests.cpp:: failed: empty, Contains( v ) for: { } Contains: { 1, 2, 3 } +Matchers.tests.cpp:: failed: v, Contains( v2 ) for: { 1, 2, 3 } Contains: { 1, 2, 4 } +Matchers.tests.cpp:: failed: v, Equals( v2 ) for: { 1, 2, 3 } Equals: { 1, 2 } +Matchers.tests.cpp:: failed: v2, Equals( v ) for: { 1, 2 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:: failed: empty, Equals( v ) for: { } Equals: { 1, 2, 3 } +Matchers.tests.cpp:: failed: v, Equals( empty ) for: { 1, 2, 3 } Equals: { } +Matchers.tests.cpp:: failed: v, UnorderedEquals( empty ) for: { 1, 2, 3 } UnorderedEquals: { } +Matchers.tests.cpp:: failed: empty, UnorderedEquals( v ) for: { } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:: failed: permuted, UnorderedEquals( v ) for: { 1, 3 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:: failed: permuted, UnorderedEquals( v ) for: { 3, 1 } UnorderedEquals: { 1, 2, 3 } Exception.tests.cpp:: passed: thisThrows(), std::domain_error Exception.tests.cpp:: passed: thisDoesntThrow() Exception.tests.cpp:: passed: thisThrows() diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 15076a7b..f38cedfe 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -332,13 +332,13 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Contains("STRING") ) + CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" @@ -381,12 +381,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), EndsWith("Substring") ) + CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "Substring" Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) @@ -469,13 +469,13 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring") ) + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) @@ -488,11 +488,11 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) because no exception was thrown where one was expected: Matchers.tests.cpp:: FAILED: - REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) because no exception was thrown where one was expected: ------------------------------------------------------------------------------- @@ -503,12 +503,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) due to unexpected exception with message: Unknown exception Matchers.tests.cpp:: FAILED: - REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) due to unexpected exception with message: Unknown exception @@ -520,12 +520,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THROWS_MATCHES( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 Matchers.tests.cpp:: FAILED: - REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 @@ -678,7 +678,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") ) + CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) @@ -690,7 +690,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), !Contains("substring") ) + CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" @@ -865,19 +865,19 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Matches("this STRING contains 'abc' as a substring") ) + CHECK_THAT( testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Matches("contains 'abc' as a substring") ) + CHECK_THAT( testStringForMatching(), Matches( "contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Matches("this string contains 'abc' as a") ) + CHECK_THAT( testStringForMatching(), Matches( "this string contains 'abc' as a" ) ) with expansion: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively @@ -894,12 +894,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith("This String") ) + CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "This String" Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) @@ -966,7 +966,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, Approx(t1) ) + CHECK_THAT( empty, Approx( t1 ) ) with expansion: { } is approx: { 1.0, 2.0 } @@ -978,7 +978,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( v1, Approx(v2) ) + CHECK_THAT( v1, Approx( v2 ) ) with expansion: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } @@ -990,12 +990,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, VectorContains(-1) ) + CHECK_THAT( v, VectorContains( -1 ) ) with expansion: { 1, 2, 3 } Contains: -1 Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, VectorContains(1) ) + CHECK_THAT( empty, VectorContains( 1 ) ) with expansion: { } Contains: 1 @@ -1007,12 +1007,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, Contains(v) ) + CHECK_THAT( empty, Contains( v ) ) with expansion: { } Contains: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, Contains(v2) ) + CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 4 } @@ -1024,22 +1024,22 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, Equals(v2) ) + CHECK_THAT( v, Equals( v2 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( v2, Equals(v) ) + CHECK_THAT( v2, Equals( v ) ) with expansion: { 1, 2 } Equals: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, Equals(v) ) + CHECK_THAT( empty, Equals( v ) ) with expansion: { } Equals: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, Equals(empty) ) + CHECK_THAT( v, Equals( empty ) ) with expansion: { 1, 2, 3 } Equals: { } @@ -1051,22 +1051,22 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, UnorderedEquals(empty) ) + CHECK_THAT( v, UnorderedEquals( empty ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { } Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, UnorderedEquals(v) ) + CHECK_THAT( empty, UnorderedEquals( v ) ) with expansion: { } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( permuted, UnorderedEquals(v) ) + CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 1, 3 } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( permuted, UnorderedEquals(v) ) + CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 3, 1 } UnorderedEquals: { 1, 2, 3 } diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 080ed71f..bcf0a3ab 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -2409,12 +2409,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1, Predicate(alwaysTrue, "always true") ) + REQUIRE_THAT( 1, Predicate( alwaysTrue, "always true" ) ) with expansion: 1 matches predicate: "always true" Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1, !Predicate(alwaysFalse, "always false") ) + REQUIRE_THAT( 1, !Predicate( alwaysFalse, "always false" ) ) with expansion: 1 not matches predicate: "always false" @@ -2426,12 +2426,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( "Hello olleH", Predicate( [] (std::string const& str) -> bool { return str.front() == str.back(); }, "First and last character should be equal") ) + REQUIRE_THAT( "Hello olleH", Predicate( []( std::string const& str ) -> bool { return str.front() == str.back(); }, "First and last character should be equal" ) ) with expansion: "Hello olleH" matches predicate: "First and last character should be equal" Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( "This wouldn't pass", !Predicate( [] (std::string const& str) -> bool { return str.front() == str.back(); } ) ) + REQUIRE_THAT( "This wouldn't pass", !Predicate( []( std::string const& str ) -> bool { return str.front() == str.back(); } ) ) with expansion: "This wouldn't pass" not matches undescribed predicate @@ -2881,34 +2881,34 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype((MatcherA() && MatcherB()) && MatcherC()), Catch:: - Matchers::Detail::MatchAllOfGeneric >::value + std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch:: + Matchers::Detail:: MatchAllOfGeneric>::value Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1, (MatcherA() && MatcherB()) && MatcherC() ) + REQUIRE_THAT( 1, ( MatcherA() && MatcherB() ) && MatcherC() ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch:: - Matchers::Detail::MatchAllOfGeneric >::value + std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch:: + Matchers::Detail:: MatchAllOfGeneric>::value Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1, MatcherA() && (MatcherB() && MatcherC()) ) + REQUIRE_THAT( 1, MatcherA() && ( MatcherB() && MatcherC() ) ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD - ())), Catch::Matchers::Detail::MatchAllOfGeneric >::value + std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && + MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>:: value Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) ) + REQUIRE_THAT( 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) @@ -2921,34 +2921,34 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype((MatcherA() || MatcherB()) || MatcherC()), Catch:: - Matchers::Detail::MatchAnyOfGeneric >::value + std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch:: + Matchers::Detail:: MatchAnyOfGeneric>::value Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1, (MatcherA() || MatcherB()) || MatcherC() ) + REQUIRE_THAT( 1, ( MatcherA() || MatcherB() ) || MatcherC() ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch:: - Matchers::Detail::MatchAnyOfGeneric >::value + std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch:: + Matchers::Detail:: MatchAnyOfGeneric>::value Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1, MatcherA() || (MatcherB() || MatcherC()) ) + REQUIRE_THAT( 1, MatcherA() || ( MatcherB() || MatcherC() ) ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD - ())), Catch::Matchers::Detail::MatchAnyOfGeneric >::value + std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || + MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>:: value Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) ) + REQUIRE_THAT( 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) @@ -2961,8 +2961,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail:: - MatchNotOfGeneric >::value + std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail:: + MatchNotOfGeneric>::value Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !MatcherA() ) @@ -2971,7 +2971,7 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(!!MatcherA()), MatcherA const& >::value + std::is_same::value Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!MatcherA() ) @@ -2980,8 +2980,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(!!!MatcherA()), Catch::Matchers::Detail:: - MatchNotOfGeneric >::value + std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail:: + MatchNotOfGeneric>::value Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !!!MatcherA() ) @@ -2990,7 +2990,7 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(!!!!MatcherA()), MatcherA const & >::value + std::is_same::value Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!!!MatcherA() ) @@ -3005,9 +3005,9 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(StartsWith("foo") || (StartsWith("bar") && EndsWith - ("bar") && !EndsWith("foo"))), Catch::Matchers::Detail::MatchAnyOf >::value + std::is_same>::value ------------------------------------------------------------------------------- Combining only templated matchers @@ -3017,8 +3017,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(MatcherA() || MatcherB()), Catch::Matchers::Detail:: - MatchAnyOfGeneric >::value + std::is_same>::value Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || MatcherB() ) @@ -3027,8 +3027,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(MatcherA() && MatcherB()), Catch::Matchers::Detail:: - MatchAllOfGeneric >::value + std::is_same>::value Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() && MatcherB() ) @@ -3037,9 +3037,9 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype(MatcherA() || !MatcherB()), Catch::Matchers::Detail:: - MatchAnyOfGeneric> >::value + std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail: + :MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric + >>::value Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || !MatcherB() ) @@ -3053,43 +3053,43 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( vec, Predicate>([](auto const& v) { return std::all_of(v.begin(), v.end(), [](int elem) { return elem % 2 == 1; }); }, "All elements are odd") && !EqualsRange(a) ) + REQUIRE_THAT( vec, Predicate>( []( auto const& v ) { return std::all_of( v.begin(), v.end(), []( int elem ) { return elem % 2 == 1; } ); }, "All elements are odd" ) && !EqualsRange( a ) ) with expansion: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar") ) + REQUIRE_THAT( str, StartsWith( "foo" ) && EqualsRange( arr ) && EndsWith( "bar" ) ) with expansion: "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar") ) + REQUIRE_THAT( str, StartsWith( "foo" ) && !EqualsRange( bad_arr ) && EndsWith( "bar" ) ) with expansion: "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar") ) + REQUIRE_THAT( str, EqualsRange( arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) ) with expansion: "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar") ) + REQUIRE_THAT( str, !EqualsRange( bad_arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) ) with expansion: "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar")) ) + REQUIRE_THAT( str, EqualsRange( bad_arr ) || ( StartsWith( "foo" ) && EndsWith( "bar" ) ) ) with expansion: "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr) ) + REQUIRE_THAT( str, ( StartsWith( "foo" ) && EndsWith( "bar" ) ) || EqualsRange( bad_arr ) ) with expansion: "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) @@ -3101,7 +3101,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c) ) + REQUIRE_THAT( container, EqualsRange( a ) || EqualsRange( b ) || EqualsRange( c ) ) with expansion: { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) @@ -3419,7 +3419,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK( matcher.match(1) ) + CHECK( matcher.match( 1 ) ) with expansion: true @@ -3484,13 +3484,13 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Contains("STRING") ) + CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" @@ -3733,12 +3733,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), EndsWith("Substring") ) + CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "Substring" Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) @@ -3923,13 +3923,13 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), Equals("this string contains 'abc' as a substring") ) + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) @@ -3941,13 +3941,13 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring") ) + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) @@ -3985,11 +3985,11 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) because no exception was thrown where one was expected: Matchers.tests.cpp:: FAILED: - REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) because no exception was thrown where one was expected: ------------------------------------------------------------------------------- @@ -4000,12 +4000,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) due to unexpected exception with message: Unknown exception Matchers.tests.cpp:: FAILED: - REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) due to unexpected exception with message: Unknown exception @@ -4017,12 +4017,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THROWS_MATCHES( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 Matchers.tests.cpp:: FAILED: - REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 @@ -4033,12 +4033,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THROWS_MATCHES( throwsSpecialException(1), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_MATCHES( throwsSpecialException(2), SpecialException, ExceptionMatcher{2} ) + REQUIRE_THROWS_MATCHES( throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } ) with expansion: SpecialException::what special exception has value of 2 @@ -4100,22 +4100,22 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, Message("DerivedException::what") ) + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, Message( "DerivedException::what" ) ) with expansion: DerivedException::what exception message matches "DerivedException::what" Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, !Message("derivedexception::what") ) + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, !Message( "derivedexception::what" ) ) with expansion: DerivedException::what not exception message matches "derivedexception::what" Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_MATCHES( throwsSpecialException(2), SpecialException, !Message("DerivedException::what") ) + REQUIRE_THROWS_MATCHES( throwsSpecialException( 2 ), SpecialException, !Message( "DerivedException::what" ) ) with expansion: SpecialException::what not exception message matches "DerivedException::what" Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_MATCHES( throwsSpecialException(2), SpecialException, Message("SpecialException::what") ) + REQUIRE_THROWS_MATCHES( throwsSpecialException( 2 ), SpecialException, Message( "SpecialException::what" ) ) with expansion: SpecialException::what exception message matches "SpecialException::what" @@ -4209,22 +4209,22 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 10., WithinRel(11.1, 0.1) ) + REQUIRE_THAT( 10., WithinRel( 11.1, 0.1 ) ) with expansion: 10.0 and 11.1 are within 10% of each other Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 10., !WithinRel(11.2, 0.1) ) + REQUIRE_THAT( 10., !WithinRel( 11.2, 0.1 ) ) with expansion: 10.0 not and 11.2 are within 10% of each other Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1., !WithinRel(0., 0.99) ) + REQUIRE_THAT( 1., !WithinRel( 0., 0.99 ) ) with expansion: 1.0 not and 0 are within 99% of each other Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( -0., WithinRel(0.) ) + REQUIRE_THAT( -0., WithinRel( 0. ) ) with expansion: -0.0 and 0 are within 2.22045e-12% of each other @@ -4237,7 +4237,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( v1, WithinRel(v2) ) + REQUIRE_THAT( v1, WithinRel( v2 ) ) with expansion: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other @@ -4249,42 +4249,42 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1., WithinAbs(1., 0) ) + REQUIRE_THAT( 1., WithinAbs( 1., 0 ) ) with expansion: 1.0 is within 0.0 of 1.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0., WithinAbs(1., 1) ) + REQUIRE_THAT( 0., WithinAbs( 1., 1 ) ) with expansion: 0.0 is within 1.0 of 1.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0., !WithinAbs(1., 0.99) ) + REQUIRE_THAT( 0., !WithinAbs( 1., 0.99 ) ) with expansion: 0.0 not is within 0.99 of 1.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0., !WithinAbs(1., 0.99) ) + REQUIRE_THAT( 0., !WithinAbs( 1., 0.99 ) ) with expansion: 0.0 not is within 0.99 of 1.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 11., !WithinAbs(10., 0.5) ) + REQUIRE_THAT( 11., !WithinAbs( 10., 0.5 ) ) with expansion: 11.0 not is within 0.5 of 10.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 10., !WithinAbs(11., 0.5) ) + REQUIRE_THAT( 10., !WithinAbs( 11., 0.5 ) ) with expansion: 10.0 not is within 0.5 of 11.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( -10., WithinAbs(-10., 0.5) ) + REQUIRE_THAT( -10., WithinAbs( -10., 0.5 ) ) with expansion: -10.0 is within 0.5 of -10.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( -10., WithinAbs(-9.6, 0.5) ) + REQUIRE_THAT( -10., WithinAbs( -9.6, 0.5 ) ) with expansion: -10.0 is within 0.5 of -9.6 @@ -4296,43 +4296,43 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1., WithinULP(1., 0) ) + REQUIRE_THAT( 1., WithinULP( 1., 0 ) ) with expansion: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1. 0000000000000000e+00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( nextafter(1., 2.), WithinULP(1., 1) ) + REQUIRE_THAT( nextafter( 1., 2. ), WithinULP( 1., 1 ) ) with expansion: 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1. 0000000000000002e+00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0., WithinULP(nextafter(0., 1.), 1) ) + REQUIRE_THAT( 0., WithinULP( nextafter( 0., 1. ), 1 ) ) with expansion: 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9. 8813129168249309e-324]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1., WithinULP(nextafter(1., 0.), 1) ) + REQUIRE_THAT( 1., WithinULP( nextafter( 1., 0. ), 1 ) ) with expansion: 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1. 0000000000000000e+00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1., !WithinULP(nextafter(1., 2.), 0) ) + REQUIRE_THAT( 1., !WithinULP( nextafter( 1., 2. ), 0 ) ) with expansion: 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1., WithinULP(1., 0) ) + REQUIRE_THAT( 1., WithinULP( 1., 0 ) ) with expansion: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1. 0000000000000000e+00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( -0., WithinULP(0., 0) ) + REQUIRE_THAT( -0., WithinULP( 0., 0 ) ) with expansion: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0. 0000000000000000e+00]) @@ -4345,19 +4345,19 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1., WithinAbs(1., 0.5) || WithinULP(2., 1) ) + REQUIRE_THAT( 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) ) with expansion: 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1. 9999999999999998e+00, 2.0000000000000004e+00]) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1., WithinAbs(2., 0.5) || WithinULP(1., 0) ) + REQUIRE_THAT( 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) ) with expansion: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1. 0000000000000000e+00, 1.0000000000000000e+00]) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1) ) + REQUIRE_THAT( 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) ) with expansion: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) @@ -4369,22 +4369,22 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_NOTHROW( WithinAbs(1., 0.) ) + REQUIRE_NOTHROW( WithinAbs( 1., 0. ) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_AS( WithinAbs(1., -1.), std::domain_error ) + REQUIRE_THROWS_AS( WithinAbs( 1., -1. ), std::domain_error ) Matchers.tests.cpp:: PASSED: - REQUIRE_NOTHROW( WithinULP(1., 0) ) + REQUIRE_NOTHROW( WithinULP( 1., 0 ) ) Matchers.tests.cpp:: PASSED: - REQUIRE_NOTHROW( WithinRel(1., 0.) ) + REQUIRE_NOTHROW( WithinRel( 1., 0. ) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_AS( WithinRel(1., -0.2), std::domain_error ) + REQUIRE_THROWS_AS( WithinRel( 1., -0.2 ), std::domain_error ) Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_AS( WithinRel(1., 1.), std::domain_error ) + REQUIRE_THROWS_AS( WithinRel( 1., 1. ), std::domain_error ) ------------------------------------------------------------------------------- Floating point matchers: float @@ -4394,22 +4394,22 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 10.f, WithinRel(11.1f, 0.1f) ) + REQUIRE_THAT( 10.f, WithinRel( 11.1f, 0.1f ) ) with expansion: 10.0f and 11.1 are within 10% of each other Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 10.f, !WithinRel(11.2f, 0.1f) ) + REQUIRE_THAT( 10.f, !WithinRel( 11.2f, 0.1f ) ) with expansion: 10.0f not and 11.2 are within 10% of each other Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1.f, !WithinRel(0.f, 0.99f) ) + REQUIRE_THAT( 1.f, !WithinRel( 0.f, 0.99f ) ) with expansion: 1.0f not and 0 are within 99% of each other Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( -0.f, WithinRel(0.f) ) + REQUIRE_THAT( -0.f, WithinRel( 0.f ) ) with expansion: -0.0f and 0 are within 0.00119209% of each other @@ -4422,7 +4422,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( v1, WithinRel(v2) ) + REQUIRE_THAT( v1, WithinRel( v2 ) ) with expansion: 0.0f and 1.17549e-38 are within 0.00119209% of each other @@ -4434,47 +4434,47 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1.f, WithinAbs(1.f, 0) ) + REQUIRE_THAT( 1.f, WithinAbs( 1.f, 0 ) ) with expansion: 1.0f is within 0.0 of 1.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0.f, WithinAbs(1.f, 1) ) + REQUIRE_THAT( 0.f, WithinAbs( 1.f, 1 ) ) with expansion: 0.0f is within 1.0 of 1.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0.f, !WithinAbs(1.f, 0.99f) ) + REQUIRE_THAT( 0.f, !WithinAbs( 1.f, 0.99f ) ) with expansion: 0.0f not is within 0.9900000095 of 1.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0.f, !WithinAbs(1.f, 0.99f) ) + REQUIRE_THAT( 0.f, !WithinAbs( 1.f, 0.99f ) ) with expansion: 0.0f not is within 0.9900000095 of 1.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0.f, WithinAbs(-0.f, 0) ) + REQUIRE_THAT( 0.f, WithinAbs( -0.f, 0 ) ) with expansion: 0.0f is within 0.0 of -0.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 11.f, !WithinAbs(10.f, 0.5f) ) + REQUIRE_THAT( 11.f, !WithinAbs( 10.f, 0.5f ) ) with expansion: 11.0f not is within 0.5 of 10.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 10.f, !WithinAbs(11.f, 0.5f) ) + REQUIRE_THAT( 10.f, !WithinAbs( 11.f, 0.5f ) ) with expansion: 10.0f not is within 0.5 of 11.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( -10.f, WithinAbs(-10.f, 0.5f) ) + REQUIRE_THAT( -10.f, WithinAbs( -10.f, 0.5f ) ) with expansion: -10.0f is within 0.5 of -10.0 Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( -10.f, WithinAbs(-9.6f, 0.5f) ) + REQUIRE_THAT( -10.f, WithinAbs( -9.6f, 0.5f ) ) with expansion: -10.0f is within 0.5 of -9.6000003815 @@ -4486,38 +4486,38 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1.f, WithinULP(1.f, 0) ) + REQUIRE_THAT( 1.f, WithinULP( 1.f, 0 ) ) with expansion: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( nextafter(1.f, 2.f), WithinULP(1.f, 1) ) + REQUIRE_THAT( nextafter( 1.f, 2.f ), WithinULP( 1.f, 1 ) ) with expansion: 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0.f, WithinULP(nextafter(0.f, 1.f), 1) ) + REQUIRE_THAT( 0.f, WithinULP( nextafter( 0.f, 1.f ), 1 ) ) with expansion: 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1.f, WithinULP(nextafter(1.f, 0.f), 1) ) + REQUIRE_THAT( 1.f, WithinULP( nextafter( 1.f, 0.f ), 1 ) ) with expansion: 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1.f, !WithinULP(nextafter(1.f, 2.f), 0) ) + REQUIRE_THAT( 1.f, !WithinULP( nextafter( 1.f, 2.f ), 0 ) ) with expansion: 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+ 00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1.f, WithinULP(1.f, 0) ) + REQUIRE_THAT( 1.f, WithinULP( 1.f, 0 ) ) with expansion: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( -0.f, WithinULP(0.f, 0) ) + REQUIRE_THAT( -0.f, WithinULP( 0.f, 0 ) ) with expansion: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) @@ -4529,19 +4529,19 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1) ) + REQUIRE_THAT( 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) ) with expansion: 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9. 99999940e-01, 1.00000012e+00]) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0) ) + REQUIRE_THAT( 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) ) with expansion: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1. 00000000e+00, 1.00000000e+00]) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( 0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f) ) + REQUIRE_THAT( 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) ) with expansion: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) @@ -4553,25 +4553,25 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_NOTHROW( WithinAbs(1.f, 0.f) ) + REQUIRE_NOTHROW( WithinAbs( 1.f, 0.f ) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_AS( WithinAbs(1.f, -1.f), std::domain_error ) + REQUIRE_THROWS_AS( WithinAbs( 1.f, -1.f ), std::domain_error ) Matchers.tests.cpp:: PASSED: - REQUIRE_NOTHROW( WithinULP(1.f, 0) ) + REQUIRE_NOTHROW( WithinULP( 1.f, 0 ) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_AS( WithinULP(1.f, static_cast(-1)), std::domain_error ) + REQUIRE_THROWS_AS( WithinULP( 1.f, static_cast( -1 ) ), std::domain_error ) Matchers.tests.cpp:: PASSED: - REQUIRE_NOTHROW( WithinRel(1.f, 0.f) ) + REQUIRE_NOTHROW( WithinRel( 1.f, 0.f ) ) Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_AS( WithinRel(1.f, -0.2f), std::domain_error ) + REQUIRE_THROWS_AS( WithinRel( 1.f, -0.2f ), std::domain_error ) Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_AS( WithinRel(1.f, 1.f), std::domain_error ) + REQUIRE_THROWS_AS( WithinRel( 1.f, 1.f ), std::domain_error ) ------------------------------------------------------------------------------- Generators -- adapters @@ -6852,7 +6852,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), Contains("string") && Contains("abc") && Contains("substring") && Contains("contains") ) + CHECK_THAT( testStringForMatching(), Contains( "string" ) && Contains( "abc" ) && Contains( "substring" ) && Contains( "contains" ) ) with expansion: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) @@ -6864,13 +6864,13 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), Contains("string") || Contains("different") || Contains("random") ) + CHECK_THAT( testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching2(), Contains("string") || Contains("different") || Contains("random") ) + CHECK_THAT( testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) ) with expansion: "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) @@ -6882,7 +6882,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring") ) + CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) @@ -6894,7 +6894,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") ) + CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) @@ -6906,7 +6906,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), !Contains("different") ) + CHECK_THAT( testStringForMatching(), !Contains( "different" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "different" @@ -6917,7 +6917,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), !Contains("substring") ) + CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" @@ -7510,16 +7510,16 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THROWS_AS( (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed ) + REQUIRE_THROWS_AS( ( EvilMatcher(), EvilMatcher() ), EvilCommaOperatorUsed ) Matchers.tests.cpp:: PASSED: REQUIRE_THROWS_AS( &EvilMatcher(), EvilAddressOfOperatorUsed ) Matchers.tests.cpp:: PASSED: - REQUIRE_NOTHROW( EvilMatcher() || (EvilMatcher() && !EvilMatcher()) ) + REQUIRE_NOTHROW( EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) ) Matchers.tests.cpp:: PASSED: - REQUIRE_NOTHROW( (EvilMatcher() && EvilMatcher()) || !EvilMatcher() ) + REQUIRE_NOTHROW( ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() ) ------------------------------------------------------------------------------- Parse test names and tags @@ -8608,7 +8608,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( "foo", Predicate([] (const char* const&) { return true; }) ) + REQUIRE_THAT( "foo", Predicate( []( const char* const& ) { return true; } ) ) with expansion: "foo" matches undescribed predicate @@ -9371,19 +9371,19 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Matches("this STRING contains 'abc' as a substring") ) + CHECK_THAT( testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Matches("contains 'abc' as a substring") ) + CHECK_THAT( testStringForMatching(), Matches( "contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Matches("this string contains 'abc' as a") ) + CHECK_THAT( testStringForMatching(), Matches( "this string contains 'abc' as a" ) ) with expansion: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively @@ -9395,7 +9395,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( actual, !UnorderedEquals(expected) ) + CHECK_THAT( actual, !UnorderedEquals( expected ) ) with expansion: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } @@ -10378,12 +10378,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith("This String") ) + CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "This String" Matchers.tests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) @@ -10433,45 +10433,45 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( testStringForMatching(), Contains("string") ) + REQUIRE_THAT( testStringForMatching(), Contains( "string" ) ) with expansion: "this string contains 'abc' as a substring" contains: "string" Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( testStringForMatching(), Contains("string", Catch::CaseSensitive::No) ) + REQUIRE_THAT( testStringForMatching(), Contains( "string", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" contains: "string" (case insensitive) Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), Contains("abc") ) + CHECK_THAT( testStringForMatching(), Contains( "abc" ) ) with expansion: "this string contains 'abc' as a substring" contains: "abc" Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Contains( "aBC", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" contains: "abc" (case insensitive) Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), StartsWith("this") ) + CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "this" Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" starts with: "this" (case insensitive) Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), EndsWith("substring") ) + CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "substring" Matchers.tests.cpp:: PASSED: - CHECK_THAT( testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) @@ -13484,7 +13484,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( empty, Approx(empty) ) + REQUIRE_THAT( empty, Approx( empty ) ) with expansion: { } is approx: { } @@ -13497,12 +13497,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( v1, Approx(v1) ) + REQUIRE_THAT( v1, Approx( v1 ) ) with expansion: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( v1, Approx({ 1., 2., 3. }) ) + REQUIRE_THAT( v1, Approx( { 1., 2., 3. } ) ) with expansion: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } @@ -13515,7 +13515,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( v1, !Approx(temp) ) + REQUIRE_THAT( v1, !Approx( temp ) ) with expansion: { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } @@ -13528,22 +13528,22 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( v1, !Approx(v2) ) + REQUIRE_THAT( v1, !Approx( v2 ) ) with expansion: { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( v1, Approx(v2).margin(0.5) ) + REQUIRE_THAT( v1, Approx( v2 ).margin( 0.5 ) ) with expansion: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( v1, Approx(v2).epsilon(0.5) ) + REQUIRE_THAT( v1, Approx( v2 ).epsilon( 0.5 ) ) with expansion: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( v1, Approx(v2).epsilon(0.1).scale(500) ) + REQUIRE_THAT( v1, Approx( v2 ).epsilon( 0.1 ).scale( 500 ) ) with expansion: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } @@ -13555,7 +13555,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, Approx(t1) ) + CHECK_THAT( empty, Approx( t1 ) ) with expansion: { } is approx: { 1.0, 2.0 } @@ -13567,7 +13567,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( v1, Approx(v2) ) + CHECK_THAT( v1, Approx( v2 ) ) with expansion: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } @@ -13579,17 +13579,17 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, VectorContains(1) ) + CHECK_THAT( v, VectorContains( 1 ) ) with expansion: { 1, 2, 3 } Contains: 1 Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, VectorContains(2) ) + CHECK_THAT( v, VectorContains( 2 ) ) with expansion: { 1, 2, 3 } Contains: 2 Matchers.tests.cpp:: PASSED: - CHECK_THAT( v5, (VectorContains>(2)) ) + CHECK_THAT( v5, ( VectorContains>( 2 ) ) ) with expansion: { 1, 2, 3 } Contains: 2 @@ -13601,42 +13601,42 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, Contains(v2) ) + CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, Contains({ 1, 2 }) ) + CHECK_THAT( v, Contains( { 1, 2 } ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v5, (Contains, CustomAllocator>(v2)) ) + CHECK_THAT( v5, ( Contains, CustomAllocator>( v2 ) ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, Contains(v2) ) + CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 3 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, Contains(empty) ) + CHECK_THAT( v, Contains( empty ) ) with expansion: { 1, 2, 3 } Contains: { } Matchers.tests.cpp:: PASSED: - CHECK_THAT( empty, Contains(empty) ) + CHECK_THAT( empty, Contains( empty ) ) with expansion: { } Contains: { } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v5, (Contains, CustomAllocator>(v2)) ) + CHECK_THAT( v5, ( Contains, CustomAllocator>( v2 ) ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 3 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v5, Contains(v6) ) + CHECK_THAT( v5, Contains( v6 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2 } @@ -13648,7 +13648,7 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, VectorContains(1) && VectorContains(2) ) + CHECK_THAT( v, VectorContains( 1 ) && VectorContains( 2 ) ) with expansion: { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) @@ -13660,32 +13660,32 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, Equals(v) ) + CHECK_THAT( v, Equals( v ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2, 3 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( empty, Equals(empty) ) + CHECK_THAT( empty, Equals( empty ) ) with expansion: { } Equals: { } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, Equals({ 1, 2, 3 }) ) + CHECK_THAT( v, Equals( { 1, 2, 3 } ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2, 3 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, Equals(v2) ) + CHECK_THAT( v, Equals( v2 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2, 3 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v5, (Equals, CustomAllocator>(v2)) ) + CHECK_THAT( v5, ( Equals, CustomAllocator>( v2 ) ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2, 3 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v5, Equals(v6) ) + CHECK_THAT( v5, Equals( v6 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2, 3 } @@ -13697,37 +13697,37 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, UnorderedEquals(v) ) + CHECK_THAT( v, UnorderedEquals( v ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v, UnorderedEquals({ 3, 2, 1 }) ) + CHECK_THAT( v, UnorderedEquals( { 3, 2, 1 } ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( empty, UnorderedEquals(empty) ) + CHECK_THAT( empty, UnorderedEquals( empty ) ) with expansion: { } UnorderedEquals: { } Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( permuted, UnorderedEquals(v) ) + REQUIRE_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp:: PASSED: - REQUIRE_THAT( permuted, UnorderedEquals(v) ) + REQUIRE_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v5, (UnorderedEquals, CustomAllocator>(permuted)) ) + CHECK_THAT( v5, ( UnorderedEquals, CustomAllocator>( permuted ) ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } Matchers.tests.cpp:: PASSED: - CHECK_THAT( v5_permuted, UnorderedEquals(v5) ) + CHECK_THAT( v5_permuted, UnorderedEquals( v5 ) ) with expansion: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } @@ -13739,12 +13739,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, VectorContains(-1) ) + CHECK_THAT( v, VectorContains( -1 ) ) with expansion: { 1, 2, 3 } Contains: -1 Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, VectorContains(1) ) + CHECK_THAT( empty, VectorContains( 1 ) ) with expansion: { } Contains: 1 @@ -13756,12 +13756,12 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, Contains(v) ) + CHECK_THAT( empty, Contains( v ) ) with expansion: { } Contains: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, Contains(v2) ) + CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 4 } @@ -13773,22 +13773,22 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, Equals(v2) ) + CHECK_THAT( v, Equals( v2 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( v2, Equals(v) ) + CHECK_THAT( v2, Equals( v ) ) with expansion: { 1, 2 } Equals: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, Equals(v) ) + CHECK_THAT( empty, Equals( v ) ) with expansion: { } Equals: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, Equals(empty) ) + CHECK_THAT( v, Equals( empty ) ) with expansion: { 1, 2, 3 } Equals: { } @@ -13800,22 +13800,22 @@ Matchers.tests.cpp: ............................................................................... Matchers.tests.cpp:: FAILED: - CHECK_THAT( v, UnorderedEquals(empty) ) + CHECK_THAT( v, UnorderedEquals( empty ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { } Matchers.tests.cpp:: FAILED: - CHECK_THAT( empty, UnorderedEquals(v) ) + CHECK_THAT( empty, UnorderedEquals( v ) ) with expansion: { } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( permuted, UnorderedEquals(v) ) + CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 1, 3 } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp:: FAILED: - CHECK_THAT( permuted, UnorderedEquals(v) ) + CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 3, 1 } UnorderedEquals: { 1, 2, 3 } diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 98d8a4d0..1edfdc93 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -396,17 +396,17 @@ Exception.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Contains("STRING") ) + CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" Matchers.tests.cpp: @@ -441,16 +441,16 @@ Exception.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), EndsWith("Substring") ) + CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "Substring" Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) @@ -556,17 +556,17 @@ Condition.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring") ) + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) @@ -575,42 +575,42 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) Matchers.tests.cpp: - + FAILED: - REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) Matchers.tests.cpp: - + FAILED: - CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception Matchers.tests.cpp: - + FAILED: - REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception Matchers.tests.cpp: - + FAILED: - CHECK_THROWS_MATCHES( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 Matchers.tests.cpp: - + FAILED: - REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 Matchers.tests.cpp: @@ -798,9 +798,9 @@ Condition.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") ) + CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) @@ -809,9 +809,9 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), !Contains("substring") ) + CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" Matchers.tests.cpp: @@ -1075,25 +1075,25 @@ Decomposition.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Matches("this STRING contains 'abc' as a substring") ) + CHECK_THAT( testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Matches("contains 'abc' as a substring") ) + CHECK_THAT( testStringForMatching(), Matches( "contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Matches("this string contains 'abc' as a") ) + CHECK_THAT( testStringForMatching(), Matches( "this string contains 'abc' as a" ) ) with expansion: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively @@ -1154,16 +1154,16 @@ Message from section two - + FAILED: - CHECK_THAT( testStringForMatching(), StartsWith("This String") ) + CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "This String" Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) @@ -1346,18 +1346,18 @@ Exception.tests.cpp: - + FAILED: - CHECK_THAT( empty, Approx(t1) ) + CHECK_THAT( empty, Approx( t1 ) ) with expansion: { } is approx: { 1.0, 2.0 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v1, Approx(v2) ) + CHECK_THAT( v1, Approx( v2 ) ) with expansion: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } Matchers.tests.cpp: @@ -1369,92 +1369,92 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, VectorContains(-1) ) + CHECK_THAT( v, VectorContains( -1 ) ) with expansion: { 1, 2, 3 } Contains: -1 Matchers.tests.cpp: - + FAILED: - CHECK_THAT( empty, VectorContains(1) ) + CHECK_THAT( empty, VectorContains( 1 ) ) with expansion: { } Contains: 1 Matchers.tests.cpp: - + FAILED: - CHECK_THAT( empty, Contains(v) ) + CHECK_THAT( empty, Contains( v ) ) with expansion: { } Contains: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, Contains(v2) ) + CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 4 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, Equals(v2) ) + CHECK_THAT( v, Equals( v2 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v2, Equals(v) ) + CHECK_THAT( v2, Equals( v ) ) with expansion: { 1, 2 } Equals: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( empty, Equals(v) ) + CHECK_THAT( empty, Equals( v ) ) with expansion: { } Equals: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, Equals(empty) ) + CHECK_THAT( v, Equals( empty ) ) with expansion: { 1, 2, 3 } Equals: { } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, UnorderedEquals(empty) ) + CHECK_THAT( v, UnorderedEquals( empty ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( empty, UnorderedEquals(v) ) + CHECK_THAT( empty, UnorderedEquals( v ) ) with expansion: { } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( permuted, UnorderedEquals(v) ) + CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 1, 3 } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( permuted, UnorderedEquals(v) ) + CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 3, 1 } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp: diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index af97d374..a36a6171 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -1002,32 +1002,32 @@ Exception.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Contains("STRING") ) + CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), EndsWith("Substring") ) + CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "Substring" Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) Matchers.tests.cpp: @@ -1035,58 +1035,58 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring") ) + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) Matchers.tests.cpp: - + FAILED: - CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) Matchers.tests.cpp: - + FAILED: - REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) Matchers.tests.cpp: - + FAILED: - CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception Matchers.tests.cpp: - + FAILED: - REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception Matchers.tests.cpp: - + FAILED: - CHECK_THROWS_MATCHES( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} ) + CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 Matchers.tests.cpp: - + FAILED: - REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} ) + REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 Matchers.tests.cpp: @@ -1110,9 +1110,9 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") ) + CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) Matchers.tests.cpp: @@ -1120,9 +1120,9 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), !Contains("substring") ) + CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" Matchers.tests.cpp: @@ -1131,23 +1131,23 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Matches("this STRING contains 'abc' as a substring") ) + CHECK_THAT( testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Matches("contains 'abc' as a substring") ) + CHECK_THAT( testStringForMatching(), Matches( "contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), Matches("this string contains 'abc' as a") ) + CHECK_THAT( testStringForMatching(), Matches( "this string contains 'abc' as a" ) ) with expansion: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively Matchers.tests.cpp: @@ -1155,16 +1155,16 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), StartsWith("This String") ) + CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "This String" Matchers.tests.cpp: - + FAILED: - CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) ) + CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) Matchers.tests.cpp: @@ -1176,18 +1176,18 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THAT( empty, Approx(t1) ) + CHECK_THAT( empty, Approx( t1 ) ) with expansion: { } is approx: { 1.0, 2.0 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v1, Approx(v2) ) + CHECK_THAT( v1, Approx( v2 ) ) with expansion: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } Matchers.tests.cpp: @@ -1199,92 +1199,92 @@ Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, VectorContains(-1) ) + CHECK_THAT( v, VectorContains( -1 ) ) with expansion: { 1, 2, 3 } Contains: -1 Matchers.tests.cpp: - + FAILED: - CHECK_THAT( empty, VectorContains(1) ) + CHECK_THAT( empty, VectorContains( 1 ) ) with expansion: { } Contains: 1 Matchers.tests.cpp: - + FAILED: - CHECK_THAT( empty, Contains(v) ) + CHECK_THAT( empty, Contains( v ) ) with expansion: { } Contains: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, Contains(v2) ) + CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 4 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, Equals(v2) ) + CHECK_THAT( v, Equals( v2 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v2, Equals(v) ) + CHECK_THAT( v2, Equals( v ) ) with expansion: { 1, 2 } Equals: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( empty, Equals(v) ) + CHECK_THAT( empty, Equals( v ) ) with expansion: { } Equals: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, Equals(empty) ) + CHECK_THAT( v, Equals( empty ) ) with expansion: { 1, 2, 3 } Equals: { } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( v, UnorderedEquals(empty) ) + CHECK_THAT( v, UnorderedEquals( empty ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( empty, UnorderedEquals(v) ) + CHECK_THAT( empty, UnorderedEquals( v ) ) with expansion: { } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( permuted, UnorderedEquals(v) ) + CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 1, 3 } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp: - + FAILED: - CHECK_THAT( permuted, UnorderedEquals(v) ) + CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 3, 1 } UnorderedEquals: { 1, 2, 3 } Matchers.tests.cpp: diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 51f8fbca..89c79973 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -579,13 +579,13 @@ ok {test-number} - 1.234f == Approx( dMedium ) for: 1.234f == Approx( 1.234 ) # Approximate comparisons with mixed numeric types ok {test-number} - dMedium == Approx( 1.234f ) for: 1.234 == Approx( 1.2339999676 ) # Arbitrary predicate matcher -ok {test-number} - 1, Predicate(alwaysTrue, "always true") for: 1 matches predicate: "always true" +ok {test-number} - 1, Predicate( alwaysTrue, "always true" ) for: 1 matches predicate: "always true" # Arbitrary predicate matcher -ok {test-number} - 1, !Predicate(alwaysFalse, "always false") for: 1 not matches predicate: "always false" +ok {test-number} - 1, !Predicate( alwaysFalse, "always false" ) for: 1 not matches predicate: "always false" # Arbitrary predicate matcher -ok {test-number} - "Hello olleH", Predicate( [] (std::string const& str) -> bool { return str.front() == str.back(); }, "First and last character should be equal") for: "Hello olleH" matches predicate: "First and last character should be equal" +ok {test-number} - "Hello olleH", Predicate( []( std::string const& str ) -> bool { return str.front() == str.back(); }, "First and last character should be equal" ) for: "Hello olleH" matches predicate: "First and last character should be equal" # Arbitrary predicate matcher -ok {test-number} - "This wouldn't pass", !Predicate( [] (std::string const& str) -> bool { return str.front() == str.back(); } ) for: "This wouldn't pass" not matches undescribed predicate +ok {test-number} - "This wouldn't pass", !Predicate( []( std::string const& str ) -> bool { return str.front() == str.back(); } ) for: "This wouldn't pass" not matches undescribed predicate # Assertion macros support bit operators and bool conversions ok {test-number} - lhs | rhs for: Val: 1 | Val: 2 # Assertion macros support bit operators and bool conversions @@ -691,75 +691,75 @@ ok {test-number} - name.empty() for: true # Clara::Arg supports single-arg parse the way Opt does ok {test-number} - name == "foo" for: "foo" == "foo" # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && MatcherC()), Catch::Matchers::Detail::MatchAllOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' # Combining MatchAllOfGeneric does not nest -ok {test-number} - 1, (MatcherA() && MatcherB()) && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +ok {test-number} - 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch::Matchers::Detail::MatchAllOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' # Combining MatchAllOfGeneric does not nest -ok {test-number} - 1, MatcherA() && (MatcherB() && MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +ok {test-number} - 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD())), Catch::Matchers::Detail::MatchAllOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>:: value' # Combining MatchAllOfGeneric does not nest -ok {test-number} - 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) +ok {test-number} - 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || MatcherC()), Catch::Matchers::Detail::MatchAnyOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' # Combining MatchAnyOfGeneric does not nest -ok {test-number} - 1, (MatcherA() || MatcherB()) || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +ok {test-number} - 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch::Matchers::Detail::MatchAnyOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' # Combining MatchAnyOfGeneric does not nest -ok {test-number} - 1, MatcherA() || (MatcherB() || MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +ok {test-number} - 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD())), Catch::Matchers::Detail::MatchAnyOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>:: value' # Combining MatchAnyOfGeneric does not nest -ok {test-number} - 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) +ok {test-number} - 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' # Combining MatchNotOfGeneric does not nest ok {test-number} - 0, !MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(!!MatcherA()), MatcherA const& >::value' +ok {test-number} - with 1 message: 'std::is_same::value' # Combining MatchNotOfGeneric does not nest ok {test-number} - 1, !!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(!!!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' # Combining MatchNotOfGeneric does not nest ok {test-number} - 0, !!!MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(!!!!MatcherA()), MatcherA const & >::value' +ok {test-number} - with 1 message: 'std::is_same::value' # Combining MatchNotOfGeneric does not nest ok {test-number} - 1, !!!!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f # Combining concrete matchers does not use templated matchers -ok {test-number} - with 1 message: 'std::is_same< decltype(StartsWith("foo") || (StartsWith("bar") && EndsWith("bar") && !EndsWith("foo"))), Catch::Matchers::Detail::MatchAnyOf >::value' +ok {test-number} - with 1 message: 'std::is_same>::value' # Combining only templated matchers -ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() || MatcherB()), Catch::Matchers::Detail::MatchAnyOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same>::value' # Combining only templated matchers ok {test-number} - 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) # Combining only templated matchers -ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() && MatcherB()), Catch::Matchers::Detail::MatchAllOfGeneric >::value' +ok {test-number} - with 1 message: 'std::is_same>::value' # Combining only templated matchers ok {test-number} - 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) # Combining only templated matchers -ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() || !MatcherB()), Catch::Matchers::Detail::MatchAnyOfGeneric> >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>::value' # Combining only templated matchers ok {test-number} - 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) # Combining templated and concrete matchers -ok {test-number} - vec, Predicate>([](auto const& v) { return std::all_of(v.begin(), v.end(), [](int elem) { return elem % 2 == 1; }); }, "All elements are odd") && !EqualsRange(a) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) +ok {test-number} - vec, Predicate>( []( auto const& v ) { return std::all_of( v.begin(), v.end(), []( int elem ) { return elem % 2 == 1; } ); }, "All elements are odd" ) && !EqualsRange( a ) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) # Combining templated and concrete matchers -ok {test-number} - str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar") for: "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) +ok {test-number} - str, StartsWith( "foo" ) && EqualsRange( arr ) && EndsWith( "bar" ) for: "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) # Combining templated and concrete matchers -ok {test-number} - str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar") for: "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) +ok {test-number} - str, StartsWith( "foo" ) && !EqualsRange( bad_arr ) && EndsWith( "bar" ) for: "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) # Combining templated and concrete matchers -ok {test-number} - str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar") for: "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) +ok {test-number} - str, EqualsRange( arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) for: "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) # Combining templated and concrete matchers -ok {test-number} - str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar") for: "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) +ok {test-number} - str, !EqualsRange( bad_arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) for: "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) # Combining templated and concrete matchers -ok {test-number} - str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar")) for: "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) +ok {test-number} - str, EqualsRange( bad_arr ) || ( StartsWith( "foo" ) && EndsWith( "bar" ) ) for: "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) # Combining templated and concrete matchers -ok {test-number} - str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr) for: "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) +ok {test-number} - str, ( StartsWith( "foo" ) && EndsWith( "bar" ) ) || EqualsRange( bad_arr ) for: "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) # Combining templated matchers -ok {test-number} - container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c) for: { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) +ok {test-number} - container, EqualsRange( a ) || EqualsRange( b ) || EqualsRange( c ) for: { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) # Commas in various macros are allowed ok {test-number} - std::vector{constructor_throws{}, constructor_throws{}} # Commas in various macros are allowed @@ -867,7 +867,7 @@ ok {test-number} - first.matchCalled for: true # Composed generic matchers shortcircuit ok {test-number} - !second.matchCalled for: true # Composed generic matchers shortcircuit -ok {test-number} - matcher.match(1) for: true +ok {test-number} - matcher.match( 1 ) for: true # Composed generic matchers shortcircuit ok {test-number} - first.matchCalled for: true # Composed generic matchers shortcircuit @@ -885,9 +885,9 @@ ok {test-number} - first.matchCalled for: true # Composed matchers shortcircuit ok {test-number} - !second.matchCalled for: true # Contains string matcher -not ok {test-number} - testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) +not ok {test-number} - testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) # Contains string matcher -not ok {test-number} - testStringForMatching(), Contains("STRING") for: "this string contains 'abc' as a substring" contains: "STRING" +not ok {test-number} - testStringForMatching(), Contains( "STRING" ) for: "this string contains 'abc' as a substring" contains: "STRING" # Copy and then generate a range ok {test-number} - elem % 2 == 1 for: 1 == 1 # Copy and then generate a range @@ -933,9 +933,9 @@ ok {test-number} - enumInfo->lookup(1) == "Value2" for: Value2 == "Value2" # Directly creating an EnumInfo ok {test-number} - enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}" # EndsWith string matcher -not ok {test-number} - testStringForMatching(), EndsWith("Substring") for: "this string contains 'abc' as a substring" ends with: "Substring" +not ok {test-number} - testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring" # EndsWith string matcher -not ok {test-number} - testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) +not ok {test-number} - testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) # Enums can quickly have stringification enabled using REGISTER_ENUM ok {test-number} - stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1" # Enums can quickly have stringification enabled using REGISTER_ENUM @@ -993,13 +993,13 @@ ok {test-number} - data.str_hello.size() == 5 for: 5 == 5 # Equality checks that should succeed ok {test-number} - x == Approx( 1.3 ) for: 1.3 == Approx( 1.3 ) # Equals -ok {test-number} - testStringForMatching(), Equals("this string contains 'abc' as a substring") for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" +ok {test-number} - testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" # Equals -ok {test-number} - testStringForMatching(), Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) +ok {test-number} - testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) # Equals string matcher -not ok {test-number} - testStringForMatching(), Equals("this string contains 'ABC' as a substring") for: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" +not ok {test-number} - testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) for: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" # Equals string matcher -not ok {test-number} - testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) +not ok {test-number} - testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) # Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified ok {test-number} - ::Catch::Detail::stringify(WhatException{}) == "This exception has overridden what() method" for: "This exception has overridden what() method" == "This exception has overridden what() method" # Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified @@ -1007,21 +1007,21 @@ ok {test-number} - ::Catch::Detail::stringify(OperatorException{}) == "OperatorE # Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified ok {test-number} - ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" for: "StringMakerException" == "StringMakerException" # Exception matchers that fail -not ok {test-number} - expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1} +not ok {test-number} - expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } # Exception matchers that fail -not ok {test-number} - expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1} +not ok {test-number} - expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } # Exception matchers that fail -not ok {test-number} - unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} +not ok {test-number} - unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } # Exception matchers that fail -not ok {test-number} - unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} +not ok {test-number} - unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } # Exception matchers that fail -not ok {test-number} - throwsSpecialException(3), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +not ok {test-number} - throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 # Exception matchers that fail -not ok {test-number} - throwsSpecialException(4), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +not ok {test-number} - throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 # Exception matchers that succeed -ok {test-number} - throwsSpecialException(1), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +ok {test-number} - throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 # Exception matchers that succeed -ok {test-number} - throwsSpecialException(2), SpecialException, ExceptionMatcher{2} for: SpecialException::what special exception has value of 2 +ok {test-number} - throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } for: SpecialException::what special exception has value of 2 # Exception messages can be tested for ok {test-number} - thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" # Exception messages can be tested for @@ -1035,13 +1035,13 @@ ok {test-number} - thisThrows(), Contains( "except" ) for: "expected exception" # Exception messages can be tested for ok {test-number} - thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) for: "expected exception" contains: "except" (case insensitive) # Exceptions matchers -ok {test-number} - throwsDerivedException(), DerivedException, Message("DerivedException::what") for: DerivedException::what exception message matches "DerivedException::what" +ok {test-number} - throwsDerivedException(), DerivedException, Message( "DerivedException::what" ) for: DerivedException::what exception message matches "DerivedException::what" # Exceptions matchers -ok {test-number} - throwsDerivedException(), DerivedException, !Message("derivedexception::what") for: DerivedException::what not exception message matches "derivedexception::what" +ok {test-number} - throwsDerivedException(), DerivedException, !Message( "derivedexception::what" ) for: DerivedException::what not exception message matches "derivedexception::what" # Exceptions matchers -ok {test-number} - throwsSpecialException(2), SpecialException, !Message("DerivedException::what") for: SpecialException::what not exception message matches "DerivedException::what" +ok {test-number} - throwsSpecialException( 2 ), SpecialException, !Message( "DerivedException::what" ) for: SpecialException::what not exception message matches "DerivedException::what" # Exceptions matchers -ok {test-number} - throwsSpecialException(2), SpecialException, Message("SpecialException::what") for: SpecialException::what exception message matches "SpecialException::what" +ok {test-number} - throwsSpecialException( 2 ), SpecialException, Message( "SpecialException::what" ) for: SpecialException::what exception message matches "SpecialException::what" # Expected exceptions that don't throw or unexpected exceptions fail the test not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: thisThrows(), std::string # Expected exceptions that don't throw or unexpected exceptions fail the test @@ -1067,125 +1067,125 @@ ok {test-number} - Factorial(3) == 6 for: 6 == 6 # Factorials are computed ok {test-number} - Factorial(10) == 3628800 for: 3628800 (0x) == 3628800 (0x) # Floating point matchers: double -ok {test-number} - 10., WithinRel(11.1, 0.1) for: 10.0 and 11.1 are within 10% of each other +ok {test-number} - 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other # Floating point matchers: double -ok {test-number} - 10., !WithinRel(11.2, 0.1) for: 10.0 not and 11.2 are within 10% of each other +ok {test-number} - 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other # Floating point matchers: double -ok {test-number} - 1., !WithinRel(0., 0.99) for: 1.0 not and 0 are within 99% of each other +ok {test-number} - 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other # Floating point matchers: double -ok {test-number} - -0., WithinRel(0.) for: -0.0 and 0 are within 2.22045e-12% of each other +ok {test-number} - -0., WithinRel( 0. ) for: -0.0 and 0 are within 2.22045e-12% of each other # Floating point matchers: double -ok {test-number} - v1, WithinRel(v2) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other +ok {test-number} - v1, WithinRel( v2 ) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other # Floating point matchers: double -ok {test-number} - 1., WithinAbs(1., 0) for: 1.0 is within 0.0 of 1.0 +ok {test-number} - 1., WithinAbs( 1., 0 ) for: 1.0 is within 0.0 of 1.0 # Floating point matchers: double -ok {test-number} - 0., WithinAbs(1., 1) for: 0.0 is within 1.0 of 1.0 +ok {test-number} - 0., WithinAbs( 1., 1 ) for: 0.0 is within 1.0 of 1.0 # Floating point matchers: double -ok {test-number} - 0., !WithinAbs(1., 0.99) for: 0.0 not is within 0.99 of 1.0 +ok {test-number} - 0., !WithinAbs( 1., 0.99 ) for: 0.0 not is within 0.99 of 1.0 # Floating point matchers: double -ok {test-number} - 0., !WithinAbs(1., 0.99) for: 0.0 not is within 0.99 of 1.0 +ok {test-number} - 0., !WithinAbs( 1., 0.99 ) for: 0.0 not is within 0.99 of 1.0 # Floating point matchers: double -ok {test-number} - 11., !WithinAbs(10., 0.5) for: 11.0 not is within 0.5 of 10.0 +ok {test-number} - 11., !WithinAbs( 10., 0.5 ) for: 11.0 not is within 0.5 of 10.0 # Floating point matchers: double -ok {test-number} - 10., !WithinAbs(11., 0.5) for: 10.0 not is within 0.5 of 11.0 +ok {test-number} - 10., !WithinAbs( 11., 0.5 ) for: 10.0 not is within 0.5 of 11.0 # Floating point matchers: double -ok {test-number} - -10., WithinAbs(-10., 0.5) for: -10.0 is within 0.5 of -10.0 +ok {test-number} - -10., WithinAbs( -10., 0.5 ) for: -10.0 is within 0.5 of -10.0 # Floating point matchers: double -ok {test-number} - -10., WithinAbs(-9.6, 0.5) for: -10.0 is within 0.5 of -9.6 +ok {test-number} - -10., WithinAbs( -9.6, 0.5 ) for: -10.0 is within 0.5 of -9.6 # Floating point matchers: double -ok {test-number} - 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) +ok {test-number} - 1., WithinULP( 1., 0 ) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) # Floating point matchers: double -ok {test-number} - nextafter(1., 2.), WithinULP(1., 1) for: 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) +ok {test-number} - nextafter( 1., 2. ), WithinULP( 1., 1 ) for: 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) # Floating point matchers: double -ok {test-number} - 0., WithinULP(nextafter(0., 1.), 1) for: 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) +ok {test-number} - 0., WithinULP( nextafter( 0., 1. ), 1 ) for: 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) # Floating point matchers: double -ok {test-number} - 1., WithinULP(nextafter(1., 0.), 1) for: 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) +ok {test-number} - 1., WithinULP( nextafter( 1., 0. ), 1 ) for: 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) # Floating point matchers: double -ok {test-number} - 1., !WithinULP(nextafter(1., 2.), 0) for: 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) +ok {test-number} - 1., !WithinULP( nextafter( 1., 2. ), 0 ) for: 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) # Floating point matchers: double -ok {test-number} - 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) +ok {test-number} - 1., WithinULP( 1., 0 ) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) # Floating point matchers: double -ok {test-number} - -0., WithinULP(0., 0) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) +ok {test-number} - -0., WithinULP( 0., 0 ) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) # Floating point matchers: double -ok {test-number} - 1., WithinAbs(1., 0.5) || WithinULP(2., 1) for: 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) +ok {test-number} - 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) for: 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) # Floating point matchers: double -ok {test-number} - 1., WithinAbs(2., 0.5) || WithinULP(1., 0) for: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) +ok {test-number} - 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) for: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) # Floating point matchers: double -ok {test-number} - 0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +ok {test-number} - 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) # Floating point matchers: double -ok {test-number} - WithinAbs(1., 0.) +ok {test-number} - WithinAbs( 1., 0. ) # Floating point matchers: double -ok {test-number} - WithinAbs(1., -1.), std::domain_error +ok {test-number} - WithinAbs( 1., -1. ), std::domain_error # Floating point matchers: double -ok {test-number} - WithinULP(1., 0) +ok {test-number} - WithinULP( 1., 0 ) # Floating point matchers: double -ok {test-number} - WithinRel(1., 0.) +ok {test-number} - WithinRel( 1., 0. ) # Floating point matchers: double -ok {test-number} - WithinRel(1., -0.2), std::domain_error +ok {test-number} - WithinRel( 1., -0.2 ), std::domain_error # Floating point matchers: double -ok {test-number} - WithinRel(1., 1.), std::domain_error +ok {test-number} - WithinRel( 1., 1. ), std::domain_error # Floating point matchers: float -ok {test-number} - 10.f, WithinRel(11.1f, 0.1f) for: 10.0f and 11.1 are within 10% of each other +ok {test-number} - 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other # Floating point matchers: float -ok {test-number} - 10.f, !WithinRel(11.2f, 0.1f) for: 10.0f not and 11.2 are within 10% of each other +ok {test-number} - 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other # Floating point matchers: float -ok {test-number} - 1.f, !WithinRel(0.f, 0.99f) for: 1.0f not and 0 are within 99% of each other +ok {test-number} - 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other # Floating point matchers: float -ok {test-number} - -0.f, WithinRel(0.f) for: -0.0f and 0 are within 0.00119209% of each other +ok {test-number} - -0.f, WithinRel( 0.f ) for: -0.0f and 0 are within 0.00119209% of each other # Floating point matchers: float -ok {test-number} - v1, WithinRel(v2) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other +ok {test-number} - v1, WithinRel( v2 ) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other # Floating point matchers: float -ok {test-number} - 1.f, WithinAbs(1.f, 0) for: 1.0f is within 0.0 of 1.0 +ok {test-number} - 1.f, WithinAbs( 1.f, 0 ) for: 1.0f is within 0.0 of 1.0 # Floating point matchers: float -ok {test-number} - 0.f, WithinAbs(1.f, 1) for: 0.0f is within 1.0 of 1.0 +ok {test-number} - 0.f, WithinAbs( 1.f, 1 ) for: 0.0f is within 1.0 of 1.0 # Floating point matchers: float -ok {test-number} - 0.f, !WithinAbs(1.f, 0.99f) for: 0.0f not is within 0.9900000095 of 1.0 +ok {test-number} - 0.f, !WithinAbs( 1.f, 0.99f ) for: 0.0f not is within 0.9900000095 of 1.0 # Floating point matchers: float -ok {test-number} - 0.f, !WithinAbs(1.f, 0.99f) for: 0.0f not is within 0.9900000095 of 1.0 +ok {test-number} - 0.f, !WithinAbs( 1.f, 0.99f ) for: 0.0f not is within 0.9900000095 of 1.0 # Floating point matchers: float -ok {test-number} - 0.f, WithinAbs(-0.f, 0) for: 0.0f is within 0.0 of -0.0 +ok {test-number} - 0.f, WithinAbs( -0.f, 0 ) for: 0.0f is within 0.0 of -0.0 # Floating point matchers: float -ok {test-number} - 11.f, !WithinAbs(10.f, 0.5f) for: 11.0f not is within 0.5 of 10.0 +ok {test-number} - 11.f, !WithinAbs( 10.f, 0.5f ) for: 11.0f not is within 0.5 of 10.0 # Floating point matchers: float -ok {test-number} - 10.f, !WithinAbs(11.f, 0.5f) for: 10.0f not is within 0.5 of 11.0 +ok {test-number} - 10.f, !WithinAbs( 11.f, 0.5f ) for: 10.0f not is within 0.5 of 11.0 # Floating point matchers: float -ok {test-number} - -10.f, WithinAbs(-10.f, 0.5f) for: -10.0f is within 0.5 of -10.0 +ok {test-number} - -10.f, WithinAbs( -10.f, 0.5f ) for: -10.0f is within 0.5 of -10.0 # Floating point matchers: float -ok {test-number} - -10.f, WithinAbs(-9.6f, 0.5f) for: -10.0f is within 0.5 of -9.6000003815 +ok {test-number} - -10.f, WithinAbs( -9.6f, 0.5f ) for: -10.0f is within 0.5 of -9.6000003815 # Floating point matchers: float -ok {test-number} - 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) +ok {test-number} - 1.f, WithinULP( 1.f, 0 ) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) # Floating point matchers: float -ok {test-number} - nextafter(1.f, 2.f), WithinULP(1.f, 1) for: 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) +ok {test-number} - nextafter( 1.f, 2.f ), WithinULP( 1.f, 1 ) for: 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) # Floating point matchers: float -ok {test-number} - 0.f, WithinULP(nextafter(0.f, 1.f), 1) for: 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) +ok {test-number} - 0.f, WithinULP( nextafter( 0.f, 1.f ), 1 ) for: 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) # Floating point matchers: float -ok {test-number} - 1.f, WithinULP(nextafter(1.f, 0.f), 1) for: 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) +ok {test-number} - 1.f, WithinULP( nextafter( 1.f, 0.f ), 1 ) for: 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) # Floating point matchers: float -ok {test-number} - 1.f, !WithinULP(nextafter(1.f, 2.f), 0) for: 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) +ok {test-number} - 1.f, !WithinULP( nextafter( 1.f, 2.f ), 0 ) for: 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) # Floating point matchers: float -ok {test-number} - 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) +ok {test-number} - 1.f, WithinULP( 1.f, 0 ) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) # Floating point matchers: float -ok {test-number} - -0.f, WithinULP(0.f, 0) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) +ok {test-number} - -0.f, WithinULP( 0.f, 0 ) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) # Floating point matchers: float -ok {test-number} - 1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1) for: 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) +ok {test-number} - 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) for: 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) # Floating point matchers: float -ok {test-number} - 1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0) for: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) +ok {test-number} - 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) for: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) # Floating point matchers: float -ok {test-number} - 0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +ok {test-number} - 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) # Floating point matchers: float -ok {test-number} - WithinAbs(1.f, 0.f) +ok {test-number} - WithinAbs( 1.f, 0.f ) # Floating point matchers: float -ok {test-number} - WithinAbs(1.f, -1.f), std::domain_error +ok {test-number} - WithinAbs( 1.f, -1.f ), std::domain_error # Floating point matchers: float -ok {test-number} - WithinULP(1.f, 0) +ok {test-number} - WithinULP( 1.f, 0 ) # Floating point matchers: float -ok {test-number} - WithinULP(1.f, static_cast(-1)), std::domain_error +ok {test-number} - WithinULP( 1.f, static_cast( -1 ) ), std::domain_error # Floating point matchers: float -ok {test-number} - WithinRel(1.f, 0.f) +ok {test-number} - WithinRel( 1.f, 0.f ) # Floating point matchers: float -ok {test-number} - WithinRel(1.f, -0.2f), std::domain_error +ok {test-number} - WithinRel( 1.f, -0.2f ), std::domain_error # Floating point matchers: float -ok {test-number} - WithinRel(1.f, 1.f), std::domain_error +ok {test-number} - WithinRel( 1.f, 1.f ), std::domain_error # Generators -- adapters ok {test-number} - i % 2 == 0 for: 0 == 0 # Generators -- adapters @@ -1781,19 +1781,19 @@ ok {test-number} - d <= Approx( 1.22 ).epsilon(0.1) for: 1.23 <= Approx( 1.22 ) # ManuallyRegistered ok {test-number} - with 1 message: 'was called' # Matchers can be (AllOf) composed with the && operator -ok {test-number} - testStringForMatching(), Contains("string") && Contains("abc") && Contains("substring") && Contains("contains") for: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) +ok {test-number} - testStringForMatching(), Contains( "string" ) && Contains( "abc" ) && Contains( "substring" ) && Contains( "contains" ) for: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) # Matchers can be (AnyOf) composed with the || operator -ok {test-number} - testStringForMatching(), Contains("string") || Contains("different") || Contains("random") for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) +ok {test-number} - testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) # Matchers can be (AnyOf) composed with the || operator -ok {test-number} - testStringForMatching2(), Contains("string") || Contains("different") || Contains("random") for: "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) +ok {test-number} - testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) for: "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) # Matchers can be composed with both && and || -ok {test-number} - testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring") for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) +ok {test-number} - testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) # Matchers can be composed with both && and || - failing -not ok {test-number} - testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) +not ok {test-number} - testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) # Matchers can be negated (Not) with the ! operator -ok {test-number} - testStringForMatching(), !Contains("different") for: "this string contains 'abc' as a substring" not contains: "different" +ok {test-number} - testStringForMatching(), !Contains( "different" ) for: "this string contains 'abc' as a substring" not contains: "different" # Matchers can be negated (Not) with the ! operator - failing -not ok {test-number} - testStringForMatching(), !Contains("substring") for: "this string contains 'abc' as a substring" not contains: "substring" +not ok {test-number} - testStringForMatching(), !Contains( "substring" ) for: "this string contains 'abc' as a substring" not contains: "substring" # Mismatching exception messages failing the test ok {test-number} - thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" # Mismatching exception messages failing the test @@ -1951,13 +1951,13 @@ not ok {test-number} - explicitly with 1 message: 'Message from section one' # Output from all sections is reported not ok {test-number} - explicitly with 1 message: 'Message from section two' # Overloaded comma or address-of operators are not used -ok {test-number} - (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed +ok {test-number} - ( EvilMatcher(), EvilMatcher() ), EvilCommaOperatorUsed # Overloaded comma or address-of operators are not used ok {test-number} - &EvilMatcher(), EvilAddressOfOperatorUsed # Overloaded comma or address-of operators are not used -ok {test-number} - EvilMatcher() || (EvilMatcher() && !EvilMatcher()) +ok {test-number} - EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) # Overloaded comma or address-of operators are not used -ok {test-number} - (EvilMatcher() && EvilMatcher()) || !EvilMatcher() +ok {test-number} - ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() # Parse test names and tags ok {test-number} - spec.hasFilters() == false for: false == false # Parse test names and tags @@ -2285,7 +2285,7 @@ ok {test-number} - str1.size() == 2 + 5 for: 7 == 7 # Precision of floating point stringification can be set ok {test-number} - str2.size() == 2 + 15 for: 17 == 17 # Predicate matcher can accept const char* -ok {test-number} - "foo", Predicate([] (const char* const&) { return true; }) for: "foo" matches undescribed predicate +ok {test-number} - "foo", Predicate( []( const char* const& ) { return true; } ) for: "foo" matches undescribed predicate # Process can be configured on command line ok {test-number} - result for: {?} # Process can be configured on command line @@ -2461,13 +2461,13 @@ ok {test-number} - Catch::Detail::stringify(UsesSentinel{}) == "{ }" for: "{ } # Reconstruction should be based on stringification: #914 not ok {test-number} - truthy(false) for: Hey, its truthy! # Regex string matcher -not ok {test-number} - testStringForMatching(), Matches("this STRING contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively +not ok {test-number} - testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively # Regex string matcher -not ok {test-number} - testStringForMatching(), Matches("contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively +not ok {test-number} - testStringForMatching(), Matches( "contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively # Regex string matcher -not ok {test-number} - testStringForMatching(), Matches("this string contains 'abc' as a") for: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively +not ok {test-number} - testStringForMatching(), Matches( "this string contains 'abc' as a" ) for: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively # Regression test #1 -ok {test-number} - actual, !UnorderedEquals(expected) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } +ok {test-number} - actual, !UnorderedEquals( expected ) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } # Reporter's write listings to provided stream ok {test-number} - !(factories.empty()) for: !false # Reporter's write listings to provided stream @@ -2616,9 +2616,9 @@ ok {test-number} - Approx( d ) != 1.24 for: Approx( 1.23 ) != 1.24 Message from section one Message from section two # StartsWith string matcher -not ok {test-number} - testStringForMatching(), StartsWith("This String") for: "this string contains 'abc' as a substring" starts with: "This String" +not ok {test-number} - testStringForMatching(), StartsWith( "This String" ) for: "this string contains 'abc' as a substring" starts with: "This String" # StartsWith string matcher -not ok {test-number} - testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) +not ok {test-number} - testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) # Static arrays are convertible to string ok {test-number} - Catch::Detail::stringify(singular) == "{ 1 }" for: "{ 1 }" == "{ 1 }" # Static arrays are convertible to string @@ -2626,21 +2626,21 @@ ok {test-number} - Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" for: "{ 3, 2, # Static arrays are convertible to string ok {test-number} - Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" for: "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" == "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" # String matchers -ok {test-number} - testStringForMatching(), Contains("string") for: "this string contains 'abc' as a substring" contains: "string" +ok {test-number} - testStringForMatching(), Contains( "string" ) for: "this string contains 'abc' as a substring" contains: "string" # String matchers -ok {test-number} - testStringForMatching(), Contains("string", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "string" (case insensitive) +ok {test-number} - testStringForMatching(), Contains( "string", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "string" (case insensitive) # String matchers -ok {test-number} - testStringForMatching(), Contains("abc") for: "this string contains 'abc' as a substring" contains: "abc" +ok {test-number} - testStringForMatching(), Contains( "abc" ) for: "this string contains 'abc' as a substring" contains: "abc" # String matchers -ok {test-number} - testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "abc" (case insensitive) +ok {test-number} - testStringForMatching(), Contains( "aBC", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "abc" (case insensitive) # String matchers -ok {test-number} - testStringForMatching(), StartsWith("this") for: "this string contains 'abc' as a substring" starts with: "this" +ok {test-number} - testStringForMatching(), StartsWith( "this" ) for: "this string contains 'abc' as a substring" starts with: "this" # String matchers -ok {test-number} - testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" starts with: "this" (case insensitive) +ok {test-number} - testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" starts with: "this" (case insensitive) # String matchers -ok {test-number} - testStringForMatching(), EndsWith("substring") for: "this string contains 'abc' as a substring" ends with: "substring" +ok {test-number} - testStringForMatching(), EndsWith( "substring" ) for: "this string contains 'abc' as a substring" ends with: "substring" # String matchers -ok {test-number} - testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) +ok {test-number} - testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) # StringRef ok {test-number} - empty.empty() for: true # StringRef @@ -3400,99 +3400,99 @@ ok {test-number} - approx( d ) != 1.25 for: Approx( 1.23 ) != 1.25 # Variadic macros ok {test-number} - with 1 message: 'no assertions' # Vector Approx matcher -ok {test-number} - empty, Approx(empty) for: { } is approx: { } +ok {test-number} - empty, Approx( empty ) for: { } is approx: { } # Vector Approx matcher -ok {test-number} - v1, Approx(v1) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } +ok {test-number} - v1, Approx( v1 ) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } # Vector Approx matcher -ok {test-number} - v1, Approx({ 1., 2., 3. }) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } +ok {test-number} - v1, Approx( { 1., 2., 3. } ) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } # Vector Approx matcher -ok {test-number} - v1, !Approx(temp) for: { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } +ok {test-number} - v1, !Approx( temp ) for: { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } # Vector Approx matcher -ok {test-number} - v1, !Approx(v2) for: { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } +ok {test-number} - v1, !Approx( v2 ) for: { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } # Vector Approx matcher -ok {test-number} - v1, Approx(v2).margin(0.5) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +ok {test-number} - v1, Approx( v2 ).margin( 0.5 ) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } # Vector Approx matcher -ok {test-number} - v1, Approx(v2).epsilon(0.5) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +ok {test-number} - v1, Approx( v2 ).epsilon( 0.5 ) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } # Vector Approx matcher -ok {test-number} - v1, Approx(v2).epsilon(0.1).scale(500) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +ok {test-number} - v1, Approx( v2 ).epsilon( 0.1 ).scale( 500 ) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } # Vector Approx matcher -- failing -not ok {test-number} - empty, Approx(t1) for: { } is approx: { 1.0, 2.0 } +not ok {test-number} - empty, Approx( t1 ) for: { } is approx: { 1.0, 2.0 } # Vector Approx matcher -- failing -not ok {test-number} - v1, Approx(v2) for: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } +not ok {test-number} - v1, Approx( v2 ) for: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } # Vector matchers -ok {test-number} - v, VectorContains(1) for: { 1, 2, 3 } Contains: 1 +ok {test-number} - v, VectorContains( 1 ) for: { 1, 2, 3 } Contains: 1 # Vector matchers -ok {test-number} - v, VectorContains(2) for: { 1, 2, 3 } Contains: 2 +ok {test-number} - v, VectorContains( 2 ) for: { 1, 2, 3 } Contains: 2 # Vector matchers -ok {test-number} - v5, (VectorContains>(2)) for: { 1, 2, 3 } Contains: 2 +ok {test-number} - v5, ( VectorContains>( 2 ) ) for: { 1, 2, 3 } Contains: 2 # Vector matchers -ok {test-number} - v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2 } +ok {test-number} - v, Contains( v2 ) for: { 1, 2, 3 } Contains: { 1, 2 } # Vector matchers -ok {test-number} - v, Contains({ 1, 2 }) for: { 1, 2, 3 } Contains: { 1, 2 } +ok {test-number} - v, Contains( { 1, 2 } ) for: { 1, 2, 3 } Contains: { 1, 2 } # Vector matchers -ok {test-number} - v5, (Contains, CustomAllocator>(v2)) for: { 1, 2, 3 } Contains: { 1, 2 } +ok {test-number} - v5, ( Contains, CustomAllocator>( v2 ) ) for: { 1, 2, 3 } Contains: { 1, 2 } # Vector matchers -ok {test-number} - v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 3 } +ok {test-number} - v, Contains( v2 ) for: { 1, 2, 3 } Contains: { 1, 2, 3 } # Vector matchers -ok {test-number} - v, Contains(empty) for: { 1, 2, 3 } Contains: { } +ok {test-number} - v, Contains( empty ) for: { 1, 2, 3 } Contains: { } # Vector matchers -ok {test-number} - empty, Contains(empty) for: { } Contains: { } +ok {test-number} - empty, Contains( empty ) for: { } Contains: { } # Vector matchers -ok {test-number} - v5, (Contains, CustomAllocator>(v2)) for: { 1, 2, 3 } Contains: { 1, 2, 3 } +ok {test-number} - v5, ( Contains, CustomAllocator>( v2 ) ) for: { 1, 2, 3 } Contains: { 1, 2, 3 } # Vector matchers -ok {test-number} - v5, Contains(v6) for: { 1, 2, 3 } Contains: { 1, 2 } +ok {test-number} - v5, Contains( v6 ) for: { 1, 2, 3 } Contains: { 1, 2 } # Vector matchers -ok {test-number} - v, VectorContains(1) && VectorContains(2) for: { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) +ok {test-number} - v, VectorContains( 1 ) && VectorContains( 2 ) for: { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) # Vector matchers -ok {test-number} - v, Equals(v) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +ok {test-number} - v, Equals( v ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } # Vector matchers -ok {test-number} - empty, Equals(empty) for: { } Equals: { } +ok {test-number} - empty, Equals( empty ) for: { } Equals: { } # Vector matchers -ok {test-number} - v, Equals({ 1, 2, 3 }) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +ok {test-number} - v, Equals( { 1, 2, 3 } ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } # Vector matchers -ok {test-number} - v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +ok {test-number} - v, Equals( v2 ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } # Vector matchers -ok {test-number} - v5, (Equals, CustomAllocator>(v2)) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +ok {test-number} - v5, ( Equals, CustomAllocator>( v2 ) ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } # Vector matchers -ok {test-number} - v5, Equals(v6) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +ok {test-number} - v5, Equals( v6 ) for: { 1, 2, 3 } Equals: { 1, 2, 3 } # Vector matchers -ok {test-number} - v, UnorderedEquals(v) for: { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } +ok {test-number} - v, UnorderedEquals( v ) for: { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } # Vector matchers -ok {test-number} - v, UnorderedEquals({ 3, 2, 1 }) for: { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } +ok {test-number} - v, UnorderedEquals( { 3, 2, 1 } ) for: { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } # Vector matchers -ok {test-number} - empty, UnorderedEquals(empty) for: { } UnorderedEquals: { } +ok {test-number} - empty, UnorderedEquals( empty ) for: { } UnorderedEquals: { } # Vector matchers -ok {test-number} - permuted, UnorderedEquals(v) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } +ok {test-number} - permuted, UnorderedEquals( v ) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } # Vector matchers -ok {test-number} - permuted, UnorderedEquals(v) for: { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } +ok {test-number} - permuted, UnorderedEquals( v ) for: { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } # Vector matchers -ok {test-number} - v5, (UnorderedEquals, CustomAllocator>(permuted)) for: { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } +ok {test-number} - v5, ( UnorderedEquals, CustomAllocator>( permuted ) ) for: { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } # Vector matchers -ok {test-number} - v5_permuted, UnorderedEquals(v5) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } +ok {test-number} - v5_permuted, UnorderedEquals( v5 ) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } # Vector matchers that fail -not ok {test-number} - v, VectorContains(-1) for: { 1, 2, 3 } Contains: -1 +not ok {test-number} - v, VectorContains( -1 ) for: { 1, 2, 3 } Contains: -1 # Vector matchers that fail -not ok {test-number} - empty, VectorContains(1) for: { } Contains: 1 +not ok {test-number} - empty, VectorContains( 1 ) for: { } Contains: 1 # Vector matchers that fail -not ok {test-number} - empty, Contains(v) for: { } Contains: { 1, 2, 3 } +not ok {test-number} - empty, Contains( v ) for: { } Contains: { 1, 2, 3 } # Vector matchers that fail -not ok {test-number} - v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 4 } +not ok {test-number} - v, Contains( v2 ) for: { 1, 2, 3 } Contains: { 1, 2, 4 } # Vector matchers that fail -not ok {test-number} - v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2 } +not ok {test-number} - v, Equals( v2 ) for: { 1, 2, 3 } Equals: { 1, 2 } # Vector matchers that fail -not ok {test-number} - v2, Equals(v) for: { 1, 2 } Equals: { 1, 2, 3 } +not ok {test-number} - v2, Equals( v ) for: { 1, 2 } Equals: { 1, 2, 3 } # Vector matchers that fail -not ok {test-number} - empty, Equals(v) for: { } Equals: { 1, 2, 3 } +not ok {test-number} - empty, Equals( v ) for: { } Equals: { 1, 2, 3 } # Vector matchers that fail -not ok {test-number} - v, Equals(empty) for: { 1, 2, 3 } Equals: { } +not ok {test-number} - v, Equals( empty ) for: { 1, 2, 3 } Equals: { } # Vector matchers that fail -not ok {test-number} - v, UnorderedEquals(empty) for: { 1, 2, 3 } UnorderedEquals: { } +not ok {test-number} - v, UnorderedEquals( empty ) for: { 1, 2, 3 } UnorderedEquals: { } # Vector matchers that fail -not ok {test-number} - empty, UnorderedEquals(v) for: { } UnorderedEquals: { 1, 2, 3 } +not ok {test-number} - empty, UnorderedEquals( v ) for: { } UnorderedEquals: { 1, 2, 3 } # Vector matchers that fail -not ok {test-number} - permuted, UnorderedEquals(v) for: { 1, 3 } UnorderedEquals: { 1, 2, 3 } +not ok {test-number} - permuted, UnorderedEquals( v ) for: { 1, 3 } UnorderedEquals: { 1, 2, 3 } # Vector matchers that fail -not ok {test-number} - permuted, UnorderedEquals(v) for: { 3, 1 } UnorderedEquals: { 1, 2, 3 } +not ok {test-number} - permuted, UnorderedEquals( v ) for: { 3, 1 } UnorderedEquals: { 1, 2, 3 } # When checked exceptions are thrown they can be expected or unexpected ok {test-number} - thisThrows(), std::domain_error # When checked exceptions are thrown they can be expected or unexpected diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 369adb62..3a463fd1 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -266,8 +266,8 @@ Exception.tests.cpp:|nunexpected exception with message:|n "unexpe ##teamcity[testStarted name='Composed matchers shortcircuit'] ##teamcity[testFinished name='Composed matchers shortcircuit' duration="{duration}"] ##teamcity[testStarted name='Contains string matcher'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "not there" (case insensitive)|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Contains("STRING") )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "STRING"|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "not there" (case insensitive)|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Contains( "STRING" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "STRING"|n'] ##teamcity[testFinished name='Contains string matcher' duration="{duration}"] ##teamcity[testStarted name='Copy and then generate a range'] ##teamcity[testFinished name='Copy and then generate a range' duration="{duration}"] @@ -285,8 +285,8 @@ Exception.tests.cpp:|nunexpected exception with message:|n "custom ##teamcity[testStarted name='Directly creating an EnumInfo'] ##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"] ##teamcity[testStarted name='EndsWith string matcher'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith("Substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n'] ##teamcity[testFinished name='EndsWith string matcher' duration="{duration}"] ##teamcity[testStarted name='Enums can quickly have stringification enabled using REGISTER_ENUM'] ##teamcity[testFinished name='Enums can quickly have stringification enabled using REGISTER_ENUM' duration="{duration}"] @@ -314,18 +314,18 @@ Condition.tests.cpp:|nexpression failed|n CHECK( x == Approx( 1.30 ##teamcity[testStarted name='Equals'] ##teamcity[testFinished name='Equals' duration="{duration}"] ##teamcity[testStarted name='Equals string matcher'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals("this string contains |'ABC|' as a substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "this string contains |'ABC|' as a substring"|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "something else" (case insensitive)|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "this string contains |'ABC|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "this string contains |'ABC|' as a substring"|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "something else" (case insensitive)|n'] ##teamcity[testFinished name='Equals string matcher' duration="{duration}"] ##teamcity[testStarted name='Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified'] ##teamcity[testFinished name='Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified' duration="{duration}"] ##teamcity[testStarted name='Exception matchers that fail'] -Matchers.tests.cpp:|nno exception was thrown where one was expected|n CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{1}|n'] -Matchers.tests.cpp:|nno exception was thrown where one was expected|n REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{1}|n'] -Matchers.tests.cpp:|nunexpected exception with message:|n "Unknown exception"|n CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n throwsAsInt(1), SpecialException, ExceptionMatcher{1}|n'] -Matchers.tests.cpp:|nunexpected exception with message:|n "Unknown exception"|n REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n throwsAsInt(1), SpecialException, ExceptionMatcher{1}|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THROWS_MATCHES( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] -Matchers.tests.cpp:|nexpression failed|n REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] +Matchers.tests.cpp:|nno exception was thrown where one was expected|n CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] +Matchers.tests.cpp:|nno exception was thrown where one was expected|n REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] +Matchers.tests.cpp:|nunexpected exception with message:|n "Unknown exception"|n CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] +Matchers.tests.cpp:|nunexpected exception with message:|n "Unknown exception"|n REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] +Matchers.tests.cpp:|nexpression failed|n REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] ##teamcity[testFinished name='Exception matchers that fail' duration="{duration}"] ##teamcity[testStarted name='Exception matchers that succeed'] ##teamcity[testFinished name='Exception matchers that succeed' duration="{duration}"] @@ -395,12 +395,12 @@ Condition.tests.cpp:|nexpression failed|n CHECK( data.str_hello.si ##teamcity[testStarted name='Matchers can be composed with both && and ||||'] ##teamcity[testFinished name='Matchers can be composed with both && and ||||' duration="{duration}"] ##teamcity[testStarted name='Matchers can be composed with both && and |||| - failing'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), (Contains("string") |||| Contains("different")) && Contains("random") )|nwith expansion:|n "this string contains |'abc|' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), ( Contains( "string" ) |||| Contains( "different" ) ) && Contains( "random" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )|n'] ##teamcity[testFinished name='Matchers can be composed with both && and |||| - failing' duration="{duration}"] ##teamcity[testStarted name='Matchers can be negated (Not) with the ! operator'] ##teamcity[testFinished name='Matchers can be negated (Not) with the ! operator' duration="{duration}"] ##teamcity[testStarted name='Matchers can be negated (Not) with the ! operator - failing'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), !Contains("substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" not contains: "substring"|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), !Contains( "substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" not contains: "substring"|n'] ##teamcity[testFinished name='Matchers can be negated (Not) with the ! operator - failing' duration="{duration}"] ##teamcity[testStarted name='Mismatching exception messages failing the test'] Exception.tests.cpp:|nexpression failed|n REQUIRE_THROWS_WITH( thisThrows(), "should fail" )|nwith expansion:|n "expected exception" equals: "should fail"|n'] @@ -469,9 +469,9 @@ Message.tests.cpp:|nexplicit failure with message:|n "Message from Decomposition.tests.cpp:|nexpression failed|n CHECK( truthy(false) )|nwith expansion:|n Hey, its truthy!|n'] ##teamcity[testFinished name='Reconstruction should be based on stringification: #914' duration="{duration}"] ##teamcity[testStarted name='Regex string matcher'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches("this STRING contains |'abc|' as a substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this STRING contains |'abc|' as a substring" case sensitively|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches("contains |'abc|' as a substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "contains |'abc|' as a substring" case sensitively|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches("this string contains |'abc|' as a") )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this string contains |'abc|' as a" case sensitively|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this STRING contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this STRING contains |'abc|' as a substring" case sensitively|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "contains |'abc|' as a substring" case sensitively|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this string contains |'abc|' as a" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this string contains |'abc|' as a" case sensitively|n'] ##teamcity[testFinished name='Regex string matcher' duration="{duration}"] ##teamcity[testStarted name='Regression test #1'] ##teamcity[testFinished name='Regression test #1' duration="{duration}"] @@ -499,8 +499,8 @@ Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringFor ##teamcity[testStdOut name='Standard output from all sections is reported' out='Message from section one|nMessage from section two|n'] ##teamcity[testFinished name='Standard output from all sections is reported' duration="{duration}"] ##teamcity[testStarted name='StartsWith string matcher'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith("This String") )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "This String"|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "string" (case insensitive)|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "This String"|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "string" (case insensitive)|n'] ##teamcity[testFinished name='StartsWith string matcher' duration="{duration}"] ##teamcity[testStarted name='Static arrays are convertible to string'] ##teamcity[testFinished name='Static arrays are convertible to string' duration="{duration}"] @@ -610,24 +610,24 @@ Exception.tests.cpp:|nunexpected exception with message:|n "3.14"' ##teamcity[testStarted name='Vector Approx matcher'] ##teamcity[testFinished name='Vector Approx matcher' duration="{duration}"] ##teamcity[testStarted name='Vector Approx matcher -- failing'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, Approx(t1) )|nwith expansion:|n { } is approx: { 1.0, 2.0 }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v1, Approx(v2) )|nwith expansion:|n { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, Approx( t1 ) )|nwith expansion:|n { } is approx: { 1.0, 2.0 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v1, Approx( v2 ) )|nwith expansion:|n { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 }|n'] ##teamcity[testFinished name='Vector Approx matcher -- failing' duration="{duration}"] ##teamcity[testStarted name='Vector matchers'] ##teamcity[testFinished name='Vector matchers' duration="{duration}"] ##teamcity[testStarted name='Vector matchers that fail'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, VectorContains(-1) )|nwith expansion:|n { 1, 2, 3 } Contains: -1|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, VectorContains(1) )|nwith expansion:|n { } Contains: 1|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, Contains(v) )|nwith expansion:|n { } Contains: { 1, 2, 3 }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, Contains(v2) )|nwith expansion:|n { 1, 2, 3 } Contains: { 1, 2, 4 }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, Equals(v2) )|nwith expansion:|n { 1, 2, 3 } Equals: { 1, 2 }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v2, Equals(v) )|nwith expansion:|n { 1, 2 } Equals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, Equals(v) )|nwith expansion:|n { } Equals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, Equals(empty) )|nwith expansion:|n { 1, 2, 3 } Equals: { }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, UnorderedEquals(empty) )|nwith expansion:|n { 1, 2, 3 } UnorderedEquals: { }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, UnorderedEquals(v) )|nwith expansion:|n { } UnorderedEquals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals(v) )|nwith expansion:|n { 1, 3 } UnorderedEquals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals(v) )|nwith expansion:|n { 3, 1 } UnorderedEquals: { 1, 2, 3 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, VectorContains( -1 ) )|nwith expansion:|n { 1, 2, 3 } Contains: -1|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, VectorContains( 1 ) )|nwith expansion:|n { } Contains: 1|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, Contains( v ) )|nwith expansion:|n { } Contains: { 1, 2, 3 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, Contains( v2 ) )|nwith expansion:|n { 1, 2, 3 } Contains: { 1, 2, 4 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, Equals( v2 ) )|nwith expansion:|n { 1, 2, 3 } Equals: { 1, 2 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v2, Equals( v ) )|nwith expansion:|n { 1, 2 } Equals: { 1, 2, 3 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, Equals( v ) )|nwith expansion:|n { } Equals: { 1, 2, 3 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, Equals( empty ) )|nwith expansion:|n { 1, 2, 3 } Equals: { }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( v, UnorderedEquals( empty ) )|nwith expansion:|n { 1, 2, 3 } UnorderedEquals: { }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( empty, UnorderedEquals( v ) )|nwith expansion:|n { } UnorderedEquals: { 1, 2, 3 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 1, 3 } UnorderedEquals: { 1, 2, 3 }|n'] +Matchers.tests.cpp:|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 3, 1 } UnorderedEquals: { 1, 2, 3 }|n'] ##teamcity[testFinished name='Vector matchers that fail' duration="{duration}"] ##teamcity[testStarted name='When checked exceptions are thrown they can be expected or unexpected'] ##teamcity[testFinished name='When checked exceptions are thrown they can be expected or unexpected' duration="{duration}"] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 290ab087..9c6fd5f4 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -2526,7 +2526,7 @@ Nor would this
- 1, Predicate<int>(alwaysTrue, "always true") + 1, Predicate<int>( alwaysTrue, "always true" ) 1 matches predicate: "always true" @@ -2534,7 +2534,7 @@ Nor would this - 1, !Predicate<int>(alwaysFalse, "always false") + 1, !Predicate<int>( alwaysFalse, "always false" ) 1 not matches predicate: "always false" @@ -2545,7 +2545,7 @@ Nor would this
- "Hello olleH", Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); }, "First and last character should be equal") + "Hello olleH", Predicate<std::string>( []( std::string const& str ) -> bool { return str.front() == str.back(); }, "First and last character should be equal" ) "Hello olleH" matches predicate: "First and last character should be equal" @@ -2553,7 +2553,7 @@ Nor would this - "This wouldn't pass", !Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); } ) + "This wouldn't pass", !Predicate<std::string>( []( std::string const& str ) -> bool { return str.front() == str.back(); } ) "This wouldn't pass" not matches undescribed predicate @@ -3123,7 +3123,7 @@ Nor would this - 1, (MatcherA() && MatcherB()) && MatcherC() + 1, ( MatcherA() && MatcherB() ) && MatcherC() 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) @@ -3131,7 +3131,7 @@ Nor would this - 1, MatcherA() && (MatcherB() && MatcherC()) + 1, MatcherA() && ( MatcherB() && MatcherC() ) 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) @@ -3139,7 +3139,7 @@ Nor would this - 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) + 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) @@ -3150,7 +3150,7 @@ Nor would this - 1, (MatcherA() || MatcherB()) || MatcherC() + 1, ( MatcherA() || MatcherB() ) || MatcherC() 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) @@ -3158,7 +3158,7 @@ Nor would this - 1, MatcherA() || (MatcherB() || MatcherC()) + 1, MatcherA() || ( MatcherB() || MatcherC() ) 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) @@ -3166,7 +3166,7 @@ Nor would this - 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) + 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) @@ -3242,7 +3242,7 @@ Nor would this - vec, Predicate<std::vector<int>>([](auto const& v) { return std::all_of(v.begin(), v.end(), [](int elem) { return elem % 2 == 1; }); }, "All elements are odd") && !EqualsRange(a) + vec, Predicate<std::vector<int>>( []( auto const& v ) { return std::all_of( v.begin(), v.end(), []( int elem ) { return elem % 2 == 1; } ); }, "All elements are odd" ) && !EqualsRange( a ) { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) @@ -3250,7 +3250,7 @@ Nor would this - str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar") + str, StartsWith( "foo" ) && EqualsRange( arr ) && EndsWith( "bar" ) "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) @@ -3258,7 +3258,7 @@ Nor would this - str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar") + str, StartsWith( "foo" ) && !EqualsRange( bad_arr ) && EndsWith( "bar" ) "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) @@ -3266,7 +3266,7 @@ Nor would this - str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar") + str, EqualsRange( arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) @@ -3274,7 +3274,7 @@ Nor would this - str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar") + str, !EqualsRange( bad_arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) @@ -3282,7 +3282,7 @@ Nor would this - str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar")) + str, EqualsRange( bad_arr ) || ( StartsWith( "foo" ) && EndsWith( "bar" ) ) "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) @@ -3290,7 +3290,7 @@ Nor would this - str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr) + str, ( StartsWith( "foo" ) && EndsWith( "bar" ) ) || EqualsRange( bad_arr ) "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) @@ -3301,7 +3301,7 @@ Nor would this - container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c) + container, EqualsRange( a ) || EqualsRange( b ) || EqualsRange( c ) { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) @@ -3761,7 +3761,7 @@ Nor would this
- matcher.match(1) + matcher.match( 1 ) true @@ -3847,7 +3847,7 @@ Nor would this - testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) + testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) "this string contains 'abc' as a substring" contains: "not there" (case insensitive) @@ -3855,7 +3855,7 @@ Nor would this - testStringForMatching(), Contains("STRING") + testStringForMatching(), Contains( "STRING" ) "this string contains 'abc' as a substring" contains: "STRING" @@ -4102,7 +4102,7 @@ Nor would this - testStringForMatching(), EndsWith("Substring") + testStringForMatching(), EndsWith( "Substring" ) "this string contains 'abc' as a substring" ends with: "Substring" @@ -4110,7 +4110,7 @@ Nor would this - testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) + testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) "this string contains 'abc' as a substring" ends with: "this" (case insensitive) @@ -4362,7 +4362,7 @@ Nor would this - testStringForMatching(), Equals("this string contains 'abc' as a substring") + testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" @@ -4370,7 +4370,7 @@ Nor would this - testStringForMatching(), Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No) + testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) @@ -4381,7 +4381,7 @@ Nor would this - testStringForMatching(), Equals("this string contains 'ABC' as a substring") + testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" @@ -4389,7 +4389,7 @@ Nor would this - testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) + testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) "this string contains 'abc' as a substring" equals: "something else" (case insensitive) @@ -4432,18 +4432,18 @@ Nor would this
- doesNotThrow(), SpecialException, ExceptionMatcher{1} + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } - doesNotThrow(), SpecialException, ExceptionMatcher{1} + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } - doesNotThrow(), SpecialException, ExceptionMatcher{1} + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } - doesNotThrow(), SpecialException, ExceptionMatcher{1} + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } @@ -4451,10 +4451,10 @@ Nor would this
- throwsAsInt(1), SpecialException, ExceptionMatcher{1} + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } - throwsAsInt(1), SpecialException, ExceptionMatcher{1} + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } Unknown exception @@ -4462,10 +4462,10 @@ Nor would this - throwsAsInt(1), SpecialException, ExceptionMatcher{1} + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } - throwsAsInt(1), SpecialException, ExceptionMatcher{1} + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } Unknown exception @@ -4476,7 +4476,7 @@ Nor would this
- throwsSpecialException(3), SpecialException, ExceptionMatcher{1} + throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } SpecialException::what special exception has value of 1 @@ -4484,7 +4484,7 @@ Nor would this - throwsSpecialException(4), SpecialException, ExceptionMatcher{1} + throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } SpecialException::what special exception has value of 1 @@ -4497,7 +4497,7 @@ Nor would this - throwsSpecialException(1), SpecialException, ExceptionMatcher{1} + throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } SpecialException::what special exception has value of 1 @@ -4505,7 +4505,7 @@ Nor would this - throwsSpecialException(2), SpecialException, ExceptionMatcher{2} + throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } SpecialException::what special exception has value of 2 @@ -4576,7 +4576,7 @@ Nor would this - throwsDerivedException(), DerivedException, Message("DerivedException::what") + throwsDerivedException(), DerivedException, Message( "DerivedException::what" ) DerivedException::what exception message matches "DerivedException::what" @@ -4584,7 +4584,7 @@ Nor would this - throwsDerivedException(), DerivedException, !Message("derivedexception::what") + throwsDerivedException(), DerivedException, !Message( "derivedexception::what" ) DerivedException::what not exception message matches "derivedexception::what" @@ -4592,7 +4592,7 @@ Nor would this - throwsSpecialException(2), SpecialException, !Message("DerivedException::what") + throwsSpecialException( 2 ), SpecialException, !Message( "DerivedException::what" ) SpecialException::what not exception message matches "DerivedException::what" @@ -4600,7 +4600,7 @@ Nor would this - throwsSpecialException(2), SpecialException, Message("SpecialException::what") + throwsSpecialException( 2 ), SpecialException, Message( "SpecialException::what" ) SpecialException::what exception message matches "SpecialException::what" @@ -4707,7 +4707,7 @@ Nor would this
- 10., WithinRel(11.1, 0.1) + 10., WithinRel( 11.1, 0.1 ) 10.0 and 11.1 are within 10% of each other @@ -4715,7 +4715,7 @@ Nor would this - 10., !WithinRel(11.2, 0.1) + 10., !WithinRel( 11.2, 0.1 ) 10.0 not and 11.2 are within 10% of each other @@ -4723,7 +4723,7 @@ Nor would this - 1., !WithinRel(0., 0.99) + 1., !WithinRel( 0., 0.99 ) 1.0 not and 0 are within 99% of each other @@ -4731,7 +4731,7 @@ Nor would this - -0., WithinRel(0.) + -0., WithinRel( 0. ) -0.0 and 0 are within 2.22045e-12% of each other @@ -4740,7 +4740,7 @@ Nor would this
- v1, WithinRel(v2) + v1, WithinRel( v2 ) 0.0 and 2.22507e-308 are within 2.22045e-12% of each other @@ -4753,7 +4753,7 @@ Nor would this
- 1., WithinAbs(1., 0) + 1., WithinAbs( 1., 0 ) 1.0 is within 0.0 of 1.0 @@ -4761,7 +4761,7 @@ Nor would this - 0., WithinAbs(1., 1) + 0., WithinAbs( 1., 1 ) 0.0 is within 1.0 of 1.0 @@ -4769,7 +4769,7 @@ Nor would this - 0., !WithinAbs(1., 0.99) + 0., !WithinAbs( 1., 0.99 ) 0.0 not is within 0.99 of 1.0 @@ -4777,7 +4777,7 @@ Nor would this - 0., !WithinAbs(1., 0.99) + 0., !WithinAbs( 1., 0.99 ) 0.0 not is within 0.99 of 1.0 @@ -4785,7 +4785,7 @@ Nor would this - 11., !WithinAbs(10., 0.5) + 11., !WithinAbs( 10., 0.5 ) 11.0 not is within 0.5 of 10.0 @@ -4793,7 +4793,7 @@ Nor would this - 10., !WithinAbs(11., 0.5) + 10., !WithinAbs( 11., 0.5 ) 10.0 not is within 0.5 of 11.0 @@ -4801,7 +4801,7 @@ Nor would this - -10., WithinAbs(-10., 0.5) + -10., WithinAbs( -10., 0.5 ) -10.0 is within 0.5 of -10.0 @@ -4809,7 +4809,7 @@ Nor would this - -10., WithinAbs(-9.6, 0.5) + -10., WithinAbs( -9.6, 0.5 ) -10.0 is within 0.5 of -9.6 @@ -4820,7 +4820,7 @@ Nor would this
- 1., WithinULP(1., 0) + 1., WithinULP( 1., 0 ) 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) @@ -4828,7 +4828,7 @@ Nor would this - nextafter(1., 2.), WithinULP(1., 1) + nextafter( 1., 2. ), WithinULP( 1., 1 ) 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) @@ -4836,7 +4836,7 @@ Nor would this - 0., WithinULP(nextafter(0., 1.), 1) + 0., WithinULP( nextafter( 0., 1. ), 1 ) 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) @@ -4844,7 +4844,7 @@ Nor would this - 1., WithinULP(nextafter(1., 0.), 1) + 1., WithinULP( nextafter( 1., 0. ), 1 ) 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) @@ -4852,7 +4852,7 @@ Nor would this - 1., !WithinULP(nextafter(1., 2.), 0) + 1., !WithinULP( nextafter( 1., 2. ), 0 ) 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) @@ -4860,7 +4860,7 @@ Nor would this - 1., WithinULP(1., 0) + 1., WithinULP( 1., 0 ) 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) @@ -4868,7 +4868,7 @@ Nor would this - -0., WithinULP(0., 0) + -0., WithinULP( 0., 0 ) -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) @@ -4879,7 +4879,7 @@ Nor would this
- 1., WithinAbs(1., 0.5) || WithinULP(2., 1) + 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) @@ -4887,7 +4887,7 @@ Nor would this - 1., WithinAbs(2., 0.5) || WithinULP(1., 0) + 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) @@ -4895,7 +4895,7 @@ Nor would this - 0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1) + 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) @@ -4906,50 +4906,50 @@ Nor would this
- WithinAbs(1., 0.) + WithinAbs( 1., 0. ) - WithinAbs(1., 0.) + WithinAbs( 1., 0. ) - WithinAbs(1., -1.), std::domain_error + WithinAbs( 1., -1. ), std::domain_error - WithinAbs(1., -1.), std::domain_error + WithinAbs( 1., -1. ), std::domain_error - WithinULP(1., 0) + WithinULP( 1., 0 ) - WithinULP(1., 0) + WithinULP( 1., 0 ) - WithinRel(1., 0.) + WithinRel( 1., 0. ) - WithinRel(1., 0.) + WithinRel( 1., 0. ) - WithinRel(1., -0.2), std::domain_error + WithinRel( 1., -0.2 ), std::domain_error - WithinRel(1., -0.2), std::domain_error + WithinRel( 1., -0.2 ), std::domain_error - WithinRel(1., 1.), std::domain_error + WithinRel( 1., 1. ), std::domain_error - WithinRel(1., 1.), std::domain_error + WithinRel( 1., 1. ), std::domain_error @@ -4960,7 +4960,7 @@ Nor would this
- 10.f, WithinRel(11.1f, 0.1f) + 10.f, WithinRel( 11.1f, 0.1f ) 10.0f and 11.1 are within 10% of each other @@ -4968,7 +4968,7 @@ Nor would this - 10.f, !WithinRel(11.2f, 0.1f) + 10.f, !WithinRel( 11.2f, 0.1f ) 10.0f not and 11.2 are within 10% of each other @@ -4976,7 +4976,7 @@ Nor would this - 1.f, !WithinRel(0.f, 0.99f) + 1.f, !WithinRel( 0.f, 0.99f ) 1.0f not and 0 are within 99% of each other @@ -4984,7 +4984,7 @@ Nor would this - -0.f, WithinRel(0.f) + -0.f, WithinRel( 0.f ) -0.0f and 0 are within 0.00119209% of each other @@ -4993,7 +4993,7 @@ Nor would this
- v1, WithinRel(v2) + v1, WithinRel( v2 ) 0.0f and 1.17549e-38 are within 0.00119209% of each other @@ -5006,7 +5006,7 @@ Nor would this
- 1.f, WithinAbs(1.f, 0) + 1.f, WithinAbs( 1.f, 0 ) 1.0f is within 0.0 of 1.0 @@ -5014,7 +5014,7 @@ Nor would this - 0.f, WithinAbs(1.f, 1) + 0.f, WithinAbs( 1.f, 1 ) 0.0f is within 1.0 of 1.0 @@ -5022,7 +5022,7 @@ Nor would this - 0.f, !WithinAbs(1.f, 0.99f) + 0.f, !WithinAbs( 1.f, 0.99f ) 0.0f not is within 0.9900000095 of 1.0 @@ -5030,7 +5030,7 @@ Nor would this - 0.f, !WithinAbs(1.f, 0.99f) + 0.f, !WithinAbs( 1.f, 0.99f ) 0.0f not is within 0.9900000095 of 1.0 @@ -5038,7 +5038,7 @@ Nor would this - 0.f, WithinAbs(-0.f, 0) + 0.f, WithinAbs( -0.f, 0 ) 0.0f is within 0.0 of -0.0 @@ -5046,7 +5046,7 @@ Nor would this - 11.f, !WithinAbs(10.f, 0.5f) + 11.f, !WithinAbs( 10.f, 0.5f ) 11.0f not is within 0.5 of 10.0 @@ -5054,7 +5054,7 @@ Nor would this - 10.f, !WithinAbs(11.f, 0.5f) + 10.f, !WithinAbs( 11.f, 0.5f ) 10.0f not is within 0.5 of 11.0 @@ -5062,7 +5062,7 @@ Nor would this - -10.f, WithinAbs(-10.f, 0.5f) + -10.f, WithinAbs( -10.f, 0.5f ) -10.0f is within 0.5 of -10.0 @@ -5070,7 +5070,7 @@ Nor would this - -10.f, WithinAbs(-9.6f, 0.5f) + -10.f, WithinAbs( -9.6f, 0.5f ) -10.0f is within 0.5 of -9.6000003815 @@ -5081,7 +5081,7 @@ Nor would this
- 1.f, WithinULP(1.f, 0) + 1.f, WithinULP( 1.f, 0 ) 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) @@ -5089,7 +5089,7 @@ Nor would this - nextafter(1.f, 2.f), WithinULP(1.f, 1) + nextafter( 1.f, 2.f ), WithinULP( 1.f, 1 ) 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) @@ -5097,7 +5097,7 @@ Nor would this - 0.f, WithinULP(nextafter(0.f, 1.f), 1) + 0.f, WithinULP( nextafter( 0.f, 1.f ), 1 ) 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) @@ -5105,7 +5105,7 @@ Nor would this - 1.f, WithinULP(nextafter(1.f, 0.f), 1) + 1.f, WithinULP( nextafter( 1.f, 0.f ), 1 ) 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) @@ -5113,7 +5113,7 @@ Nor would this - 1.f, !WithinULP(nextafter(1.f, 2.f), 0) + 1.f, !WithinULP( nextafter( 1.f, 2.f ), 0 ) 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) @@ -5121,7 +5121,7 @@ Nor would this - 1.f, WithinULP(1.f, 0) + 1.f, WithinULP( 1.f, 0 ) 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) @@ -5129,7 +5129,7 @@ Nor would this - -0.f, WithinULP(0.f, 0) + -0.f, WithinULP( 0.f, 0 ) -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) @@ -5140,7 +5140,7 @@ Nor would this
- 1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1) + 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) @@ -5148,7 +5148,7 @@ Nor would this - 1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0) + 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) @@ -5156,7 +5156,7 @@ Nor would this - 0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f) + 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) @@ -5167,58 +5167,58 @@ Nor would this
- WithinAbs(1.f, 0.f) + WithinAbs( 1.f, 0.f ) - WithinAbs(1.f, 0.f) + WithinAbs( 1.f, 0.f ) - WithinAbs(1.f, -1.f), std::domain_error + WithinAbs( 1.f, -1.f ), std::domain_error - WithinAbs(1.f, -1.f), std::domain_error + WithinAbs( 1.f, -1.f ), std::domain_error - WithinULP(1.f, 0) + WithinULP( 1.f, 0 ) - WithinULP(1.f, 0) + WithinULP( 1.f, 0 ) - WithinULP(1.f, static_cast<uint64_t>(-1)), std::domain_error + WithinULP( 1.f, static_cast<uint64_t>( -1 ) ), std::domain_error - WithinULP(1.f, static_cast<uint64_t>(-1)), std::domain_error + WithinULP( 1.f, static_cast<uint64_t>( -1 ) ), std::domain_error - WithinRel(1.f, 0.f) + WithinRel( 1.f, 0.f ) - WithinRel(1.f, 0.f) + WithinRel( 1.f, 0.f ) - WithinRel(1.f, -0.2f), std::domain_error + WithinRel( 1.f, -0.2f ), std::domain_error - WithinRel(1.f, -0.2f), std::domain_error + WithinRel( 1.f, -0.2f ), std::domain_error - WithinRel(1.f, 1.f), std::domain_error + WithinRel( 1.f, 1.f ), std::domain_error - WithinRel(1.f, 1.f), std::domain_error + WithinRel( 1.f, 1.f ), std::domain_error @@ -8311,7 +8311,7 @@ Nor would this - testStringForMatching(), Contains("string") && Contains("abc") && Contains("substring") && Contains("contains") + 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" ) @@ -8322,7 +8322,7 @@ Nor would this - testStringForMatching(), Contains("string") || Contains("different") || Contains("random") + testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) @@ -8330,7 +8330,7 @@ Nor would this - testStringForMatching2(), Contains("string") || Contains("different") || 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" ) @@ -8341,7 +8341,7 @@ Nor would this - testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring") + testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) @@ -8352,7 +8352,7 @@ Nor would this - testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") + testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) @@ -8363,7 +8363,7 @@ Nor would this - testStringForMatching(), !Contains("different") + testStringForMatching(), !Contains( "different" ) "this string contains 'abc' as a substring" not contains: "different" @@ -8374,7 +8374,7 @@ Nor would this - testStringForMatching(), !Contains("substring") + testStringForMatching(), !Contains( "substring" ) "this string contains 'abc' as a substring" not contains: "substring" @@ -9045,10 +9045,10 @@ Nor would this - (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed + ( EvilMatcher(), EvilMatcher() ), EvilCommaOperatorUsed - (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed + ( EvilMatcher(), EvilMatcher() ), EvilCommaOperatorUsed @@ -9061,18 +9061,18 @@ Nor would this - EvilMatcher() || (EvilMatcher() && !EvilMatcher()) + EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) - EvilMatcher() || (EvilMatcher() && !EvilMatcher()) + EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) - (EvilMatcher() && EvilMatcher()) || !EvilMatcher() + ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() - (EvilMatcher() && EvilMatcher()) || !EvilMatcher() + ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() @@ -10504,7 +10504,7 @@ Nor would this - "foo", Predicate<const char*>([] (const char* const&) { return true; }) + "foo", Predicate<const char*>( []( const char* const& ) { return true; } ) "foo" matches undescribed predicate @@ -11448,7 +11448,7 @@ Nor would this - testStringForMatching(), Matches("this STRING contains 'abc' as a substring") + testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively @@ -11456,7 +11456,7 @@ Nor would this - testStringForMatching(), Matches("contains 'abc' as a substring") + testStringForMatching(), Matches( "contains 'abc' as a substring" ) "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively @@ -11464,7 +11464,7 @@ Nor would this - testStringForMatching(), Matches("this string contains 'abc' as a") + testStringForMatching(), Matches( "this string contains 'abc' as a" ) "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively @@ -11475,7 +11475,7 @@ Nor would this - actual, !UnorderedEquals(expected) + actual, !UnorderedEquals( expected ) { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } @@ -12395,7 +12395,7 @@ Message from section two - testStringForMatching(), StartsWith("This String") + testStringForMatching(), StartsWith( "This String" ) "this string contains 'abc' as a substring" starts with: "This String" @@ -12403,7 +12403,7 @@ Message from section two - testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) + testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) "this string contains 'abc' as a substring" starts with: "string" (case insensitive) @@ -12452,7 +12452,7 @@ Message from section two - testStringForMatching(), Contains("string") + testStringForMatching(), Contains( "string" ) "this string contains 'abc' as a substring" contains: "string" @@ -12460,7 +12460,7 @@ Message from section two - testStringForMatching(), Contains("string", Catch::CaseSensitive::No) + testStringForMatching(), Contains( "string", Catch::CaseSensitive::No ) "this string contains 'abc' as a substring" contains: "string" (case insensitive) @@ -12468,7 +12468,7 @@ Message from section two - testStringForMatching(), Contains("abc") + testStringForMatching(), Contains( "abc" ) "this string contains 'abc' as a substring" contains: "abc" @@ -12476,7 +12476,7 @@ Message from section two - testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No) + testStringForMatching(), Contains( "aBC", Catch::CaseSensitive::No ) "this string contains 'abc' as a substring" contains: "abc" (case insensitive) @@ -12484,7 +12484,7 @@ Message from section two - testStringForMatching(), StartsWith("this") + testStringForMatching(), StartsWith( "this" ) "this string contains 'abc' as a substring" starts with: "this" @@ -12492,7 +12492,7 @@ Message from section two - testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No) + testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) "this string contains 'abc' as a substring" starts with: "this" (case insensitive) @@ -12500,7 +12500,7 @@ Message from section two - testStringForMatching(), EndsWith("substring") + testStringForMatching(), EndsWith( "substring" ) "this string contains 'abc' as a substring" ends with: "substring" @@ -12508,7 +12508,7 @@ Message from section two - testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No) + testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) @@ -15882,7 +15882,7 @@ There is no extra whitespace here
- empty, Approx(empty) + empty, Approx( empty ) { } is approx: { } @@ -15894,7 +15894,7 @@ There is no extra whitespace here
- v1, Approx(v1) + v1, Approx( v1 ) { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } @@ -15902,7 +15902,7 @@ There is no extra whitespace here - v1, Approx<double>({ 1., 2., 3. }) + v1, Approx<double>( { 1., 2., 3. } ) { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } @@ -15916,7 +15916,7 @@ There is no extra whitespace here
- v1, !Approx(temp) + v1, !Approx( temp ) { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } @@ -15930,7 +15930,7 @@ There is no extra whitespace here
- v1, !Approx(v2) + v1, !Approx( v2 ) { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } @@ -15938,7 +15938,7 @@ There is no extra whitespace here - v1, Approx(v2).margin(0.5) + v1, Approx( v2 ).margin( 0.5 ) { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } @@ -15946,7 +15946,7 @@ There is no extra whitespace here - v1, Approx(v2).epsilon(0.5) + v1, Approx( v2 ).epsilon( 0.5 ) { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } @@ -15954,7 +15954,7 @@ There is no extra whitespace here - v1, Approx(v2).epsilon(0.1).scale(500) + v1, Approx( v2 ).epsilon( 0.1 ).scale( 500 ) { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } @@ -15970,7 +15970,7 @@ There is no extra whitespace here
- empty, Approx(t1) + empty, Approx( t1 ) { } is approx: { 1.0, 2.0 } @@ -15981,7 +15981,7 @@ There is no extra whitespace here
- v1, Approx(v2) + v1, Approx( v2 ) { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } @@ -15995,7 +15995,7 @@ There is no extra whitespace here
- v, VectorContains(1) + v, VectorContains( 1 ) { 1, 2, 3 } Contains: 1 @@ -16003,7 +16003,7 @@ There is no extra whitespace here - v, VectorContains(2) + v, VectorContains( 2 ) { 1, 2, 3 } Contains: 2 @@ -16011,7 +16011,7 @@ There is no extra whitespace here - v5, (VectorContains<int, CustomAllocator<int>>(2)) + v5, ( VectorContains<int, CustomAllocator<int>>( 2 ) ) { 1, 2, 3 } Contains: 2 @@ -16022,7 +16022,7 @@ There is no extra whitespace here
- v, Contains(v2) + v, Contains( v2 ) { 1, 2, 3 } Contains: { 1, 2 } @@ -16030,7 +16030,7 @@ There is no extra whitespace here - v, Contains<int>({ 1, 2 }) + v, Contains<int>( { 1, 2 } ) { 1, 2, 3 } Contains: { 1, 2 } @@ -16038,7 +16038,7 @@ There is no extra whitespace here - v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) + v5, ( Contains<int, std::allocator<int>, CustomAllocator<int>>( v2 ) ) { 1, 2, 3 } Contains: { 1, 2 } @@ -16046,7 +16046,7 @@ There is no extra whitespace here - v, Contains(v2) + v, Contains( v2 ) { 1, 2, 3 } Contains: { 1, 2, 3 } @@ -16054,7 +16054,7 @@ There is no extra whitespace here - v, Contains(empty) + v, Contains( empty ) { 1, 2, 3 } Contains: { } @@ -16062,7 +16062,7 @@ There is no extra whitespace here - empty, Contains(empty) + empty, Contains( empty ) { } Contains: { } @@ -16070,7 +16070,7 @@ There is no extra whitespace here - v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) + v5, ( Contains<int, std::allocator<int>, CustomAllocator<int>>( v2 ) ) { 1, 2, 3 } Contains: { 1, 2, 3 } @@ -16078,7 +16078,7 @@ There is no extra whitespace here - v5, Contains(v6) + v5, Contains( v6 ) { 1, 2, 3 } Contains: { 1, 2 } @@ -16089,7 +16089,7 @@ There is no extra whitespace here
- v, VectorContains(1) && VectorContains(2) + v, VectorContains( 1 ) && VectorContains( 2 ) { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) @@ -16100,7 +16100,7 @@ There is no extra whitespace here
- v, Equals(v) + v, Equals( v ) { 1, 2, 3 } Equals: { 1, 2, 3 } @@ -16108,7 +16108,7 @@ There is no extra whitespace here - empty, Equals(empty) + empty, Equals( empty ) { } Equals: { } @@ -16116,7 +16116,7 @@ There is no extra whitespace here - v, Equals<int>({ 1, 2, 3 }) + v, Equals<int>( { 1, 2, 3 } ) { 1, 2, 3 } Equals: { 1, 2, 3 } @@ -16124,7 +16124,7 @@ There is no extra whitespace here - v, Equals(v2) + v, Equals( v2 ) { 1, 2, 3 } Equals: { 1, 2, 3 } @@ -16132,7 +16132,7 @@ There is no extra whitespace here - v5, (Equals<int, std::allocator<int>, CustomAllocator<int>>(v2)) + v5, ( Equals<int, std::allocator<int>, CustomAllocator<int>>( v2 ) ) { 1, 2, 3 } Equals: { 1, 2, 3 } @@ -16140,7 +16140,7 @@ There is no extra whitespace here - v5, Equals(v6) + v5, Equals( v6 ) { 1, 2, 3 } Equals: { 1, 2, 3 } @@ -16151,7 +16151,7 @@ There is no extra whitespace here
- v, UnorderedEquals(v) + v, UnorderedEquals( v ) { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } @@ -16159,7 +16159,7 @@ There is no extra whitespace here - v, UnorderedEquals<int>({ 3, 2, 1 }) + v, UnorderedEquals<int>( { 3, 2, 1 } ) { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } @@ -16167,7 +16167,7 @@ There is no extra whitespace here - empty, UnorderedEquals(empty) + empty, UnorderedEquals( empty ) { } UnorderedEquals: { } @@ -16175,7 +16175,7 @@ There is no extra whitespace here - permuted, UnorderedEquals(v) + permuted, UnorderedEquals( v ) { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } @@ -16183,7 +16183,7 @@ There is no extra whitespace here - permuted, UnorderedEquals(v) + permuted, UnorderedEquals( v ) { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } @@ -16191,7 +16191,7 @@ There is no extra whitespace here - v5, (UnorderedEquals<int, std::allocator<int>, CustomAllocator<int>>(permuted)) + v5, ( UnorderedEquals<int, std::allocator<int>, CustomAllocator<int>>( permuted ) ) { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } @@ -16199,7 +16199,7 @@ There is no extra whitespace here - v5_permuted, UnorderedEquals(v5) + v5_permuted, UnorderedEquals( v5 ) { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } @@ -16213,7 +16213,7 @@ There is no extra whitespace here
- v, VectorContains(-1) + v, VectorContains( -1 ) { 1, 2, 3 } Contains: -1 @@ -16221,7 +16221,7 @@ There is no extra whitespace here - empty, VectorContains(1) + empty, VectorContains( 1 ) { } Contains: 1 @@ -16232,7 +16232,7 @@ There is no extra whitespace here
- empty, Contains(v) + empty, Contains( v ) { } Contains: { 1, 2, 3 } @@ -16240,7 +16240,7 @@ There is no extra whitespace here - v, Contains(v2) + v, Contains( v2 ) { 1, 2, 3 } Contains: { 1, 2, 4 } @@ -16251,7 +16251,7 @@ There is no extra whitespace here
- v, Equals(v2) + v, Equals( v2 ) { 1, 2, 3 } Equals: { 1, 2 } @@ -16259,7 +16259,7 @@ There is no extra whitespace here - v2, Equals(v) + v2, Equals( v ) { 1, 2 } Equals: { 1, 2, 3 } @@ -16267,7 +16267,7 @@ There is no extra whitespace here - empty, Equals(v) + empty, Equals( v ) { } Equals: { 1, 2, 3 } @@ -16275,7 +16275,7 @@ There is no extra whitespace here - v, Equals(empty) + v, Equals( empty ) { 1, 2, 3 } Equals: { } @@ -16286,7 +16286,7 @@ There is no extra whitespace here
- v, UnorderedEquals(empty) + v, UnorderedEquals( empty ) { 1, 2, 3 } UnorderedEquals: { } @@ -16294,7 +16294,7 @@ There is no extra whitespace here - empty, UnorderedEquals(v) + empty, UnorderedEquals( v ) { } UnorderedEquals: { 1, 2, 3 } @@ -16302,7 +16302,7 @@ There is no extra whitespace here - permuted, UnorderedEquals(v) + permuted, UnorderedEquals( v ) { 1, 3 } UnorderedEquals: { 1, 2, 3 } @@ -16310,7 +16310,7 @@ There is no extra whitespace here - permuted, UnorderedEquals(v) + permuted, UnorderedEquals( v ) { 3, 1 } UnorderedEquals: { 1, 2, 3 } diff --git a/tests/SelfTest/CompileTimePerfTests/10.tests.cpp b/tests/SelfTest/CompileTimePerfTests/10.tests.cpp deleted file mode 100644 index 01cd072d..00000000 --- a/tests/SelfTest/CompileTimePerfTests/10.tests.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Include set of usage tests multiple times - for compile-time performance testing -// (do not run) - -#include "All.tests.cpp" -#include "All.tests.cpp" -#include "All.tests.cpp" -#include "All.tests.cpp" -#include "All.tests.cpp" -#include "All.tests.cpp" -#include "All.tests.cpp" -#include "All.tests.cpp" -#include "All.tests.cpp" -#include "All.tests.cpp" diff --git a/tests/SelfTest/CompileTimePerfTests/100.tests.cpp b/tests/SelfTest/CompileTimePerfTests/100.tests.cpp deleted file mode 100644 index e03ca838..00000000 --- a/tests/SelfTest/CompileTimePerfTests/100.tests.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Include set of usage tests multiple times - for compile-time performance testing -// (do not run) - -#include "10.tests.cpp" -#include "10.tests.cpp" -#include "10.tests.cpp" -#include "10.tests.cpp" -#include "10.tests.cpp" -#include "10.tests.cpp" -#include "10.tests.cpp" -#include "10.tests.cpp" -#include "10.tests.cpp" -#include "10.tests.cpp" diff --git a/tests/SelfTest/CompileTimePerfTests/All.tests.cpp b/tests/SelfTest/CompileTimePerfTests/All.tests.cpp deleted file mode 100644 index 2b6a1029..00000000 --- a/tests/SelfTest/CompileTimePerfTests/All.tests.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// include set of usage tests into one file for compiler performance test purposes -// This whole file can now be included multiple times in 10.tests.cpp, and *that* -// file included multiple times (in 100.tests.cpp) - -// Note that the intention is only for these files to be compiled. They will -// fail at runtime due to the re-user of test case names - -#include "../UsageTests/Approx.tests.cpp" -#include "../UsageTests/BDD.tests.cpp" -#include "../UsageTests/Class.tests.cpp" -#include "../UsageTests/Compilation.tests.cpp" -#include "../UsageTests/Condition.tests.cpp" -#include "../UsageTests/Exception.tests.cpp" -#include "../UsageTests/Matchers.tests.cpp" -#include "../UsageTests/Misc.tests.cpp" diff --git a/tests/SelfTest/UsageTests/Approx.tests.cpp b/tests/SelfTest/UsageTests/Approx.tests.cpp index f0d8919c..96f9706d 100644 --- a/tests/SelfTest/UsageTests/Approx.tests.cpp +++ b/tests/SelfTest/UsageTests/Approx.tests.cpp @@ -13,13 +13,9 @@ using Catch::Approx; -namespace { namespace ApproxTests { - -#ifndef APPROX_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU -#define APPROX_TEST_HELPERS_INCLUDED - - inline double divide( double a, double b ) { - return a/b; +namespace { + static double divide(double a, double b) { + return a / b; } class StrongDoubleTypedef { @@ -30,11 +26,10 @@ namespace { namespace ApproxTests { explicit operator double() const { return d_; } }; - inline std::ostream& operator<<( std::ostream& os, StrongDoubleTypedef td ) { + static std::ostream& operator<<(std::ostream& os, StrongDoubleTypedef td) { return os << "StrongDoubleTypedef(" << static_cast(td) << ")"; } - -#endif +} // end unnamed namespace using namespace Catch::literals; @@ -214,5 +209,3 @@ TEST_CASE( "Comparison with explicitly convertible types", "[Approx]" ) REQUIRE(Approx(11.0) >= td); } - -}} // namespace ApproxTests diff --git a/tests/SelfTest/UsageTests/BDD.tests.cpp b/tests/SelfTest/UsageTests/BDD.tests.cpp index 131340fa..eba58d38 100644 --- a/tests/SelfTest/UsageTests/BDD.tests.cpp +++ b/tests/SelfTest/UsageTests/BDD.tests.cpp @@ -5,103 +5,99 @@ #include -namespace { namespace BDDTests { +namespace { -#ifndef BDD_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU -#define BDD_TEST_HELPERS_INCLUDED + static bool itDoesThis() { return true; } - inline bool itDoesThis() { return true; } + static bool itDoesThat() { return true; } - inline bool itDoesThat() { return true; } + // a trivial fixture example to support SCENARIO_METHOD tests + struct Fixture { + Fixture(): d_counter( 0 ) {} - namespace { + int counter() { return d_counter++; } -// a trivial fixture example to support SCENARIO_METHOD tests - struct Fixture { - Fixture() - : d_counter(0) { - } + int d_counter; + }; - int counter() { - return d_counter++; - } +} - int d_counter; - }; - } -#endif - - SCENARIO("Do that thing with the thing", "[Tags]") { - GIVEN("This stuff exists") { - // make stuff exist - AND_GIVEN("And some assumption") { - // Validate assumption - WHEN("I do this") { - // do this - THEN("it should do this") { - REQUIRE(itDoesThis()); - AND_THEN("do that")REQUIRE(itDoesThat()); +SCENARIO("Do that thing with the thing", "[Tags]") { + GIVEN("This stuff exists") { + // make stuff exist + AND_GIVEN("And some assumption") { + // Validate assumption + WHEN("I do this") { + // do this + THEN("it should do this") { + REQUIRE(itDoesThis()); + AND_THEN("do that") { + REQUIRE(itDoesThat()); } } } } } +} - SCENARIO("Vector resizing affects size and capacity", "[vector][bdd][size][capacity]") { - GIVEN("an empty vector") { - std::vector v; - REQUIRE(v.size() == 0); +SCENARIO( "Vector resizing affects size and capacity", + "[vector][bdd][size][capacity]" ) { + GIVEN( "an empty vector" ) { + std::vector v; + REQUIRE( v.size() == 0 ); - WHEN("it is made larger") { - v.resize(10); - THEN("the size and capacity go up") { - REQUIRE(v.size() == 10); - REQUIRE(v.capacity() >= 10); + WHEN( "it is made larger" ) { + v.resize( 10 ); + THEN( "the size and capacity go up" ) { + REQUIRE( v.size() == 10 ); + REQUIRE( v.capacity() >= 10 ); - AND_WHEN("it is made smaller again") { - v.resize(5); - THEN("the size goes down but the capacity stays the same") { - REQUIRE(v.size() == 5); - REQUIRE(v.capacity() >= 10); - } + AND_WHEN( "it is made smaller again" ) { + v.resize( 5 ); + THEN( + "the size goes down but the capacity stays the same" ) { + REQUIRE( v.size() == 5 ); + REQUIRE( v.capacity() >= 10 ); } } } + } - WHEN("we reserve more space") { - v.reserve(10); - THEN("The capacity is increased but the size remains the same") { - REQUIRE(v.capacity() >= 10); - REQUIRE(v.size() == 0); - } + WHEN( "we reserve more space" ) { + v.reserve( 10 ); + THEN( "The capacity is increased but the size remains the same" ) { + REQUIRE( v.capacity() >= 10 ); + REQUIRE( v.size() == 0 ); } } } +} - SCENARIO("This is a really long scenario name to see how the list command deals with wrapping", - "[very long tags][lots][long][tags][verbose]" - "[one very long tag name that should cause line wrapping writing out using the list command]" - "[anotherReallyLongTagNameButThisOneHasNoObviousWrapPointsSoShouldSplitWithinAWordUsingADashCharacter]") { - GIVEN("A section name that is so long that it cannot fit in a single console width")WHEN( - "The test headers are printed as part of the normal running of the scenario")THEN( - "The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent")SUCCEED( - "boo!"); - } - - SCENARIO_METHOD(Fixture, - "BDD tests requiring Fixtures to provide commonly-accessed data or methods", - "[bdd][fixtures]") { - const int before(counter()); - GIVEN("No operations precede me") { - REQUIRE(before == 0); - WHEN("We get the count") { - const int after(counter()); - THEN("Subsequently values are higher") { - REQUIRE(after > before); - } +SCENARIO("This is a really long scenario name to see how the list command deals with wrapping", + "[very long tags][lots][long][tags][verbose]" + "[one very long tag name that should cause line wrapping writing out using the list command]" + "[anotherReallyLongTagNameButThisOneHasNoObviousWrapPointsSoShouldSplitWithinAWordUsingADashCharacter]") { + GIVEN("A section name that is so long that it cannot fit in a single console width") { + WHEN("The test headers are printed as part of the normal running of the scenario") { + THEN("The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent") { + SUCCEED("boo!"); } } } +} -}} // namespace BDDtests +SCENARIO_METHOD(Fixture, + "BDD tests requiring Fixtures to provide commonly-accessed data or methods", + "[bdd][fixtures]") { + const int before(counter()); + GIVEN("No operations precede me") { + REQUIRE(before == 0); + WHEN("We get the count") { + const int after(counter()); + THEN("Subsequently values are higher") { + REQUIRE(after > before); + } + } + } +} diff --git a/tests/SelfTest/UsageTests/Class.tests.cpp b/tests/SelfTest/UsageTests/Class.tests.cpp index b6009e0b..94e83051 100644 --- a/tests/SelfTest/UsageTests/Class.tests.cpp +++ b/tests/SelfTest/UsageTests/Class.tests.cpp @@ -7,68 +7,47 @@ #include #include -namespace{ namespace ClassTests { +namespace { -#ifndef CLASS_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU -#define CLASS_TEST_HELPERS_INCLUDED + class TestClass { + std::string s; -class TestClass -{ - std::string s; + public: + TestClass(): s( "hello" ) {} -public: - TestClass() - : s( "hello" ) - {} + void succeedingCase() { REQUIRE( s == "hello" ); } + void failingCase() { REQUIRE( s == "world" ); } + }; - void succeedingCase() - { - REQUIRE( s == "hello" ); - } - void failingCase() - { - REQUIRE( s == "world" ); - } -}; + struct Fixture { + Fixture(): m_a( 1 ) {} -struct Fixture -{ - Fixture() : m_a( 1 ) {} + int m_a; + }; - int m_a; -}; + template struct Template_Fixture { + Template_Fixture(): m_a( 1 ) {} -template< typename T > -struct Template_Fixture { - Template_Fixture(): m_a(1) {} + T m_a; + }; - T m_a; -}; + template struct Template_Fixture_2 { + Template_Fixture_2() {} -template -struct Template_Fixture_2 { - Template_Fixture_2() {} + T m_a; + }; - T m_a; -}; + template struct Template_Foo { + size_t size() { return 0; } + }; -template< typename T> -struct Template_Foo { - size_t size() { return 0; } -}; - -template< typename T, size_t V> -struct Template_Foo_2 { - size_t size() { return V; } -}; - -template -struct Nttp_Fixture{ - int value = V; -}; -#endif + template struct Template_Foo_2 { + size_t size() { return V; } + }; + template struct Nttp_Fixture { int value = V; }; +} // end unnamed namespace METHOD_AS_TEST_CASE( TestClass::succeedingCase, "A METHOD_AS_TEST_CASE based test run that succeeds", "[class]" ) METHOD_AS_TEST_CASE( TestClass::failingCase, "A METHOD_AS_TEST_CASE based test run that fails", "[.][class][failing]" ) @@ -129,7 +108,3 @@ namespace Inner REQUIRE(Template_Fixture_2{}.m_a.size() < 2); } } - - - -}} // namespace ClassTests diff --git a/tests/SelfTest/UsageTests/Compilation.tests.cpp b/tests/SelfTest/UsageTests/Compilation.tests.cpp index cce190f2..c40c09f8 100644 --- a/tests/SelfTest/UsageTests/Compilation.tests.cpp +++ b/tests/SelfTest/UsageTests/Compilation.tests.cpp @@ -33,60 +33,44 @@ std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) { #include -namespace { namespace CompilationTests { - -#ifndef COMPILATION_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU -#define COMPILATION_TEST_HELPERS_INCLUDED - - // Comparison operators can return non-booleans. - // This is unusual, but should be supported. - struct logic_t { - logic_t operator< (logic_t) const { return {}; } - logic_t operator<=(logic_t) const { return {}; } - logic_t operator> (logic_t) const { return {}; } - logic_t operator>=(logic_t) const { return {}; } - logic_t operator==(logic_t) const { return {}; } - logic_t operator!=(logic_t) const { return {}; } - explicit operator bool() const { return true; } - }; +// Comparison operators can return non-booleans. +// This is unusual, but should be supported. +struct logic_t { + logic_t operator< (logic_t) const { return {}; } + logic_t operator<=(logic_t) const { return {}; } + logic_t operator> (logic_t) const { return {}; } + logic_t operator>=(logic_t) const { return {}; } + logic_t operator==(logic_t) const { return {}; } + logic_t operator!=(logic_t) const { return {}; } + explicit operator bool() const { return true; } +}; -// This is a minimal example for an issue we have found in 1.7.0 - struct foo { - int i; - }; - - template - bool operator==(const T &val, foo f) { - return val == f.i; +void throws_int(bool b) { + if (b) { + throw 1; } +} - void throws_int(bool b) { - if (b) { - throw 1; - } - } +template +bool templated_tests(T t) { + int a = 3; + REQUIRE(a == t); + CHECK(a == t); + REQUIRE_THROWS(throws_int(true)); + CHECK_THROWS_AS(throws_int(true), int); + REQUIRE_NOTHROW(throws_int(false)); + REQUIRE_THAT("aaa", Catch::Matchers::EndsWith("aaa")); + return true; +} - template - bool templated_tests(T t) { - int a = 3; - REQUIRE(a == t); - CHECK(a == t); - REQUIRE_THROWS(throws_int(true)); - CHECK_THROWS_AS(throws_int(true), int); - REQUIRE_NOTHROW(throws_int(false)); - REQUIRE_THAT("aaa", Catch::Matchers::EndsWith("aaa")); - return true; - } +struct A {}; - struct A { - }; +std::ostream &operator<<(std::ostream &o, const A &) { return o << 0; } - std::ostream &operator<<(std::ostream &o, const A &) { return o << 0; } - - struct B : private A { - bool operator==(int) const { return true; } - }; +struct B : private A { + bool operator==(int) const { return true; } +}; #ifdef __clang__ #pragma clang diagnostic push @@ -98,24 +82,32 @@ namespace { namespace CompilationTests { #pragma GCC diagnostic ignored "-Wunused-function" #endif - B f(); +B f(); - std::ostream g(); +std::ostream g(); #ifdef __clang__ #pragma clang diagnostic pop #endif - template - struct Fixture_1245 {}; +template +struct Fixture_1245 {}; -#endif +// This is a minimal example for an issue we have found in 1.7.0 +struct dummy_809 { + int i; +}; - TEST_CASE("#809") { - foo f; - f.i = 42; - REQUIRE(42 == f); - } +template +bool operator==(const T& val, dummy_809 f) { + return val == f.i; +} + +TEST_CASE("#809") { + dummy_809 f; + f.i = 42; + REQUIRE(42 == f); +} // ------------------------------------------------------------------ @@ -129,65 +121,63 @@ namespace { namespace CompilationTests { // Test containing example where original stream insertable check breaks compilation +TEST_CASE("#872") { + A dummy; + CAPTURE(dummy); + B x; + REQUIRE (x == 4); +} +TEST_CASE("#1027: Bitfields can be captured") { + struct Y { + uint32_t v : 1; + }; + Y y{ 0 }; + REQUIRE(y.v == 0); + REQUIRE(0 == y.v); +} - TEST_CASE("#872") { - A dummy; - CAPTURE(dummy); - B x; - REQUIRE (x == 4); - } +// Comparison operators can return non-booleans. +// This is unusual, but should be supported. +TEST_CASE("#1147") { + logic_t t1, t2; + REQUIRE(t1 == t2); + REQUIRE(t1 != t2); + REQUIRE(t1 < t2); + REQUIRE(t1 > t2); + REQUIRE(t1 <= t2); + REQUIRE(t1 >= t2); +} - TEST_CASE("#1027: Bitfields can be captured") { - struct Y { - uint32_t v : 1; - }; - Y y{ 0 }; - REQUIRE(y.v == 0); - REQUIRE(0 == y.v); - } +// unsigned array +TEST_CASE("#1238") { + unsigned char uarr[] = "123"; + CAPTURE(uarr); + signed char sarr[] = "456"; + CAPTURE(sarr); - // Comparison operators can return non-booleans. - // This is unusual, but should be supported. - TEST_CASE("#1147") { - logic_t t1, t2; - REQUIRE(t1 == t2); - REQUIRE(t1 != t2); - REQUIRE(t1 < t2); - REQUIRE(t1 > t2); - REQUIRE(t1 <= t2); - REQUIRE(t1 >= t2); - } + REQUIRE(std::memcmp(uarr, "123", sizeof(uarr)) == 0); + REQUIRE(std::memcmp(sarr, "456", sizeof(sarr)) == 0); +} - // unsigned array - TEST_CASE("#1238") { - unsigned char uarr[] = "123"; - CAPTURE(uarr); - signed char sarr[] = "456"; - CAPTURE(sarr); +TEST_CASE_METHOD((Fixture_1245), "#1245", "[compilation]") { + SUCCEED(); +} - REQUIRE(std::memcmp(uarr, "123", sizeof(uarr)) == 0); - REQUIRE(std::memcmp(sarr, "456", sizeof(sarr)) == 0); - } +TEST_CASE("#1403", "[compilation]") { + ::foo::helper_1403 h1, h2; + REQUIRE(h1 == h2); +} - TEST_CASE_METHOD((Fixture_1245), "#1245", "[compilation]") { - SUCCEED(); - } +TEST_CASE("Optionally static assertions", "[compilation]") { + STATIC_REQUIRE( std::is_void::value ); + STATIC_REQUIRE_FALSE( std::is_void::value ); +} - TEST_CASE("#1403", "[compilation]") { - ::foo::helper_1403 h1, h2; - REQUIRE(h1 == h2); - } - - TEST_CASE("Optionally static assertions", "[compilation]") { - STATIC_REQUIRE( std::is_void::value ); - STATIC_REQUIRE_FALSE( std::is_void::value ); - } - - TEST_CASE("#1548", "[compilation]") { - using namespace bar; - REQUIRE(std::is_same, TypeList>::value); - } +TEST_CASE("#1548", "[compilation]") { + using namespace bar; + REQUIRE(std::is_same, TypeList>::value); +} // #925 using signal_t = void (*) (void*); @@ -214,17 +204,16 @@ namespace { namespace CompilationTests { #pragma warning(pop) #endif - TEST_CASE("#1319: Sections can have description (even if it is not saved", "[compilation]") { - SECTION("SectionName", "This is a long form section description") { - SUCCEED(); - } +TEST_CASE( "#1319: Sections can have description (even if it is not saved", + "[compilation]" ) { + SECTION( "SectionName", "This is a long form section description" ) { + SUCCEED(); } +} - TEST_CASE("Lambdas in assertions") { - REQUIRE([]() { return true; }()); - } - -}} // namespace CompilationTests +TEST_CASE("Lambdas in assertions") { + REQUIRE([]() { return true; }()); +} namespace { struct HasBitOperators { diff --git a/tests/SelfTest/UsageTests/Condition.tests.cpp b/tests/SelfTest/UsageTests/Condition.tests.cpp index 7c6a1d73..167752e1 100644 --- a/tests/SelfTest/UsageTests/Condition.tests.cpp +++ b/tests/SelfTest/UsageTests/Condition.tests.cpp @@ -20,31 +20,28 @@ using Catch::Approx; #include #include -namespace { namespace ConditionTests { +namespace { -#ifndef CONDITION_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU -#define CONDITION_TEST_HELPERS_INCLUDED + struct TestData { + int int_seven = 7; + std::string str_hello = "hello"; + float float_nine_point_one = 9.1f; + double double_pi = 3.1415926535; + }; -struct TestData { - int int_seven = 7; - std::string str_hello = "hello"; - float float_nine_point_one = 9.1f; - double double_pi = 3.1415926535; -}; + struct TestDef { + TestDef& operator + (const std::string&) { + return *this; + } + TestDef& operator[](const std::string&) { + return *this; + } + }; -struct TestDef { - TestDef& operator + ( const std::string& ) { - return *this; - } - TestDef& operator[]( const std::string& ) { - return *this; - } -}; + static const char* returnsConstNull() { return nullptr; } + static char* returnsNull() { return nullptr; } -inline const char* returnsConstNull(){ return nullptr; } -inline char* returnsNull(){ return nullptr; } - -#endif +} // end unnamed namespace // The "failing" tests all use the CHECK macro, which continues if the specific test fails. // This allows us to see all results, even if an earlier check fails @@ -330,5 +327,3 @@ TEST_CASE( "'Not' checks that should fail", "[.][failing]" ) CHECK( !(1 == 1) ); CHECK_FALSE( 1 == 1 ); } - -}} // namespace ConditionTests diff --git a/tests/SelfTest/UsageTests/Exception.tests.cpp b/tests/SelfTest/UsageTests/Exception.tests.cpp index 1f6b4fa2..206bd9c8 100644 --- a/tests/SelfTest/UsageTests/Exception.tests.cpp +++ b/tests/SelfTest/UsageTests/Exception.tests.cpp @@ -20,55 +20,50 @@ #pragma clang diagnostic ignored "-Wunreachable-code" #endif -namespace { namespace ExceptionTests { +namespace { -#ifndef EXCEPTION_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU -#define EXCEPTION_TEST_HELPERS_INCLUDED - -int thisThrows() { - throw std::domain_error( "expected exception" ); - return 1; -} - -int thisDoesntThrow() { - return 0; -} - -class CustomException { -public: - explicit CustomException( const std::string& msg ) - : m_msg( msg ) - {} - - std::string getMessage() const { - return m_msg; + int thisThrows() { + throw std::domain_error("expected exception"); + return 1; } -private: - std::string m_msg; -}; - -class CustomStdException : public std::exception { -public: - explicit CustomStdException( const std::string& msg ) - : m_msg( msg ) - {} - ~CustomStdException() noexcept override {} - - std::string getMessage() const { - return m_msg; + int thisDoesntThrow() { + return 0; } -private: - std::string m_msg; -}; + class CustomException { + public: + explicit CustomException(const std::string& msg) + : m_msg(msg) {} + + std::string getMessage() const { + return m_msg; + } + + private: + std::string m_msg; + }; + + class CustomStdException : public std::exception { + public: + explicit CustomStdException(const std::string& msg) + : m_msg(msg) {} + ~CustomStdException() noexcept override {} + + std::string getMessage() const { + return m_msg; + } + + private: + std::string m_msg; + }; + + [[noreturn]] void throwCustom() { + throw CustomException("custom exception - not std"); + } -[[noreturn]] void throwCustom() { - throw CustomException( "custom exception - not std" ); } -#endif - TEST_CASE( "When checked exceptions are thrown they can be expected or unexpected", "[!throws]" ) { REQUIRE_THROWS_AS( thisThrows(), std::domain_error ); REQUIRE_NOTHROW( thisDoesntThrow() ); @@ -198,8 +193,6 @@ TEST_CASE( "#748 - captures with unexpected exceptions", "[.][failing][!throws][ } } -}} // namespace ExceptionTests - #ifdef __clang__ #pragma clang diagnostic pop #endif diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp index cf6f3ce7..36bab396 100644 --- a/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -12,41 +12,37 @@ #include #include +#include #include #include #include #ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wweak-vtables" -#pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +# pragma clang diagnostic ignored "-Wpadded" #endif -namespace { namespace MatchersTests { +namespace { -#ifndef MATCHERS_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU -#define MATCHERS_TEST_HELPERS_INCLUDED - - inline const char *testStringForMatching() { + static const char* testStringForMatching() { return "this string contains 'abc' as a substring"; } - inline const char *testStringForMatching2() { + static const char* testStringForMatching2() { return "some completely different text that contains one common word"; } - inline bool alwaysTrue(int) { return true; } - inline bool alwaysFalse(int) { return false; } - + static bool alwaysTrue( int ) { return true; } + static bool alwaysFalse( int ) { return false; } #ifdef _MSC_VER -#pragma warning(disable:4702) // Unreachable code -- MSVC 19 (VS 2015) sees right through the indirection +# pragma warning( disable : 4702 ) // Unreachable code -- MSVC 19 (VS 2015) + // sees right through the indirection #endif -#include - struct SpecialException : std::exception { - SpecialException(int i_) : i(i_) {} + SpecialException( int i_ ): i( i_ ) {} char const* what() const noexcept override { return "SpecialException::what"; @@ -61,29 +57,26 @@ namespace { namespace MatchersTests { } }; - void doesNotThrow() {} + static void doesNotThrow() {} - [[noreturn]] - void throwsSpecialException(int i) { - throw SpecialException{i}; + [[noreturn]] static void throwsSpecialException( int i ) { + throw SpecialException{ i }; } - [[noreturn]] - void throwsAsInt(int i) { - throw i; - } + [[noreturn]] static void throwsAsInt( int i ) { throw i; } - [[noreturn]] - void throwsDerivedException() { + [[noreturn]] static void throwsDerivedException() { throw DerivedException{}; } - class ExceptionMatcher : public Catch::Matchers::MatcherBase { + class ExceptionMatcher + : public Catch::Matchers::MatcherBase { int m_expected; - public: - ExceptionMatcher(int i) : m_expected(i) {} - bool match(SpecialException const &se) const override { + public: + ExceptionMatcher( int i ): m_expected( i ) {} + + bool match( SpecialException const& se ) const override { return se.i == m_expected; } @@ -94,934 +87,997 @@ namespace { namespace MatchersTests { } }; -#endif - using namespace Catch::Matchers; #ifdef __DJGPP__ - float nextafter(float from, float to) - { - return ::nextafterf(from, to); + static float nextafter( float from, float to ) { + return ::nextafterf( from, to ); } - double nextafter(double from, double to) - { - return ::nextafter(from, to); + static double nextafter( double from, double to ) { + return ::nextafter( from, to ); } #else using std::nextafter; #endif - TEST_CASE("String matchers", "[matchers]") { - REQUIRE_THAT(testStringForMatching(), Contains("string")); - REQUIRE_THAT(testStringForMatching(), Contains("string", Catch::CaseSensitive::No)); - CHECK_THAT(testStringForMatching(), Contains("abc")); - CHECK_THAT(testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No)); +} // end unnamed namespace - CHECK_THAT(testStringForMatching(), StartsWith("this")); - CHECK_THAT(testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No)); - CHECK_THAT(testStringForMatching(), EndsWith("substring")); - CHECK_THAT(testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No)); - } +TEST_CASE( "String matchers", "[matchers]" ) { + REQUIRE_THAT( testStringForMatching(), Contains( "string" ) ); + REQUIRE_THAT( testStringForMatching(), + Contains( "string", Catch::CaseSensitive::No ) ); + CHECK_THAT( testStringForMatching(), Contains( "abc" ) ); + CHECK_THAT( testStringForMatching(), + Contains( "aBC", Catch::CaseSensitive::No ) ); - TEST_CASE("Contains string matcher", "[.][failing][matchers]") { - CHECK_THAT(testStringForMatching(), Contains("not there", Catch::CaseSensitive::No)); - CHECK_THAT(testStringForMatching(), Contains("STRING")); - } + CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ); + CHECK_THAT( testStringForMatching(), + StartsWith( "THIS", Catch::CaseSensitive::No ) ); + CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ); + CHECK_THAT( testStringForMatching(), + EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) ); +} - TEST_CASE("StartsWith string matcher", "[.][failing][matchers]") { - CHECK_THAT(testStringForMatching(), StartsWith("This String")); - CHECK_THAT(testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No)); - } +TEST_CASE( "Contains string matcher", "[.][failing][matchers]" ) { + CHECK_THAT( testStringForMatching(), + Contains( "not there", Catch::CaseSensitive::No ) ); + CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ); +} - TEST_CASE("EndsWith string matcher", "[.][failing][matchers]") { - CHECK_THAT(testStringForMatching(), EndsWith("Substring")); - CHECK_THAT(testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No)); - } +TEST_CASE( "StartsWith string matcher", "[.][failing][matchers]" ) { + CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ); + CHECK_THAT( testStringForMatching(), + StartsWith( "string", Catch::CaseSensitive::No ) ); +} - TEST_CASE("Equals string matcher", "[.][failing][matchers]") { - CHECK_THAT(testStringForMatching(), Equals("this string contains 'ABC' as a substring")); - CHECK_THAT(testStringForMatching(), Equals("something else", Catch::CaseSensitive::No)); - } +TEST_CASE( "EndsWith string matcher", "[.][failing][matchers]" ) { + CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ); + CHECK_THAT( testStringForMatching(), + EndsWith( "this", Catch::CaseSensitive::No ) ); +} - TEST_CASE("Equals", "[matchers]") { - CHECK_THAT(testStringForMatching(), Equals("this string contains 'abc' as a substring")); - CHECK_THAT(testStringForMatching(), - Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No)); - } +TEST_CASE( "Equals string matcher", "[.][failing][matchers]" ) { + CHECK_THAT( testStringForMatching(), + Equals( "this string contains 'ABC' as a substring" ) ); + CHECK_THAT( testStringForMatching(), + Equals( "something else", Catch::CaseSensitive::No ) ); +} -// does not work in libstdc++ 4.8, so we have to enable these tests only when they -// are expected to pass and cannot have them in baselines - TEST_CASE("Regex string matcher -- libstdc++-4.8 workaround", "[matchers][approvals]") { +TEST_CASE( "Equals", "[matchers]" ) { + CHECK_THAT( testStringForMatching(), + Equals( "this string contains 'abc' as a substring" ) ); + CHECK_THAT( testStringForMatching(), + Equals( "this string contains 'ABC' as a substring", + Catch::CaseSensitive::No ) ); +} -// This is fiiiine -// Taken from an answer at -// https://stackoverflow.com/questions/12530406/is-gcc-4-8-or-earlier-buggy-about-regular-expressions -#if (!defined(__GNUC__)) || \ - (__cplusplus >= 201103L && \ - (!defined(__GLIBCXX__) || (__cplusplus >= 201402L) || \ - (defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \ - defined(_GLIBCXX_REGEX_STATE_LIMIT) || \ - (defined(_GLIBCXX_RELEASE) && \ - _GLIBCXX_RELEASE > 4)))) - -// DJGPP meets the above condition but does not work properly anyway +TEST_CASE( "Regex string matcher -- libstdc++-4.8 workaround", + "[matchers][approvals]" ) { +// DJGPP has similar problem with its regex support as libstdc++ 4.8 #ifndef __DJGPP__ - REQUIRE_THAT(testStringForMatching(), Matches("this string contains 'abc' as a substring")); - REQUIRE_THAT(testStringForMatching(), - Matches("this string CONTAINS 'abc' as a substring", Catch::CaseSensitive::No)); - REQUIRE_THAT(testStringForMatching(), Matches("^this string contains 'abc' as a substring$")); - REQUIRE_THAT(testStringForMatching(), Matches("^.* 'abc' .*$")); - REQUIRE_THAT(testStringForMatching(), Matches("^.* 'ABC' .*$", Catch::CaseSensitive::No)); + REQUIRE_THAT( testStringForMatching(), + Matches( "this string contains 'abc' as a substring" ) ); + REQUIRE_THAT( testStringForMatching(), + Matches( "this string CONTAINS 'abc' as a substring", + Catch::CaseSensitive::No ) ); + REQUIRE_THAT( testStringForMatching(), + Matches( "^this string contains 'abc' as a substring$" ) ); + REQUIRE_THAT( testStringForMatching(), Matches( "^.* 'abc' .*$" ) ); + REQUIRE_THAT( testStringForMatching(), + Matches( "^.* 'ABC' .*$", Catch::CaseSensitive::No ) ); #endif -#endif - - REQUIRE_THAT(testStringForMatching2(), !Matches("this string contains 'abc' as a substring")); - } - - TEST_CASE("Regex string matcher", "[matchers][.failing]") { - CHECK_THAT(testStringForMatching(), Matches("this STRING contains 'abc' as a substring")); - CHECK_THAT(testStringForMatching(), Matches("contains 'abc' as a substring")); - CHECK_THAT(testStringForMatching(), Matches("this string contains 'abc' as a")); - } - - TEST_CASE("Matchers can be (AllOf) composed with the && operator", "[matchers][operators][operator&&]") { - CHECK_THAT(testStringForMatching(), - Contains("string") && - Contains("abc") && - Contains("substring") && - Contains("contains")); - } - - TEST_CASE("Matchers can be (AnyOf) composed with the || operator", "[matchers][operators][operator||]") { - CHECK_THAT(testStringForMatching(), Contains("string") || Contains("different") || Contains("random")); - CHECK_THAT(testStringForMatching2(), Contains("string") || Contains("different") || Contains("random")); - } - - TEST_CASE("Matchers can be composed with both && and ||", "[matchers][operators][operator||][operator&&]") { - CHECK_THAT(testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring")); - } - - TEST_CASE("Matchers can be composed with both && and || - failing", - "[matchers][operators][operator||][operator&&][.failing]") { - CHECK_THAT(testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random")); - } - - TEST_CASE("Matchers can be negated (Not) with the ! operator", "[matchers][operators][not]") { - CHECK_THAT(testStringForMatching(), !Contains("different")); - } - - TEST_CASE("Matchers can be negated (Not) with the ! operator - failing", - "[matchers][operators][not][.failing]") { - CHECK_THAT(testStringForMatching(), !Contains("substring")); - } - - template - struct CustomAllocator : private std::allocator - { - using size_type = size_t; - using difference_type = ptrdiff_t; - using pointer = T*; - using const_pointer = const T*; - using reference = T&; - using const_reference = const T&; - using value_type = T; - - template - struct rebind - { using other = CustomAllocator; }; - - using propagate_on_container_move_assignment = std::true_type; - using is_always_equal = std::true_type; - - CustomAllocator() = default; - - CustomAllocator(const CustomAllocator& other) - : std::allocator(other) { } - - template - CustomAllocator(const CustomAllocator&) { } - - ~CustomAllocator() = default; - - using std::allocator::allocate; - using std::allocator::deallocate; - }; - - TEST_CASE("Vector matchers", "[matchers][vector]") { - std::vector v; - v.push_back(1); - v.push_back(2); - v.push_back(3); - - std::vector v2; - v2.push_back(1); - v2.push_back(2); - - std::vector v3; - v3.push_back(1); - v3.push_back(2); - v3.push_back(3); - - std::vector v4; - v4.push_back(1 + 1e-8); - v4.push_back(2 + 1e-8); - v4.push_back(3 + 1e-8); - - std::vector> v5; - v5.push_back(1); - v5.push_back(2); - v5.push_back(3); - - std::vector> v6; - v6.push_back(1); - v6.push_back(2); - - std::vector empty; - - SECTION("Contains (element)") { - CHECK_THAT(v, VectorContains(1)); - CHECK_THAT(v, VectorContains(2)); - CHECK_THAT(v5, (VectorContains>(2))); - } - SECTION("Contains (vector)") { - CHECK_THAT(v, Contains(v2)); - CHECK_THAT(v, Contains({ 1, 2 })); - CHECK_THAT(v5, (Contains, CustomAllocator>(v2))); - - v2.push_back(3); // now exactly matches - CHECK_THAT(v, Contains(v2)); - - CHECK_THAT(v, Contains(empty)); - CHECK_THAT(empty, Contains(empty)); - - CHECK_THAT(v5, (Contains, CustomAllocator>(v2))); - CHECK_THAT(v5, Contains(v6)); - } - SECTION("Contains (element), composed") { - CHECK_THAT(v, VectorContains(1) && VectorContains(2)); - } - - SECTION("Equals") { - - // Same vector - CHECK_THAT(v, Equals(v)); - - CHECK_THAT(empty, Equals(empty)); - - // Different vector with same elements - CHECK_THAT(v, Equals({ 1, 2, 3 })); - v2.push_back(3); - CHECK_THAT(v, Equals(v2)); - - CHECK_THAT(v5, (Equals, CustomAllocator>(v2))); - - v6.push_back(3); - CHECK_THAT(v5, Equals(v6)); - } - SECTION("UnorderedEquals") { - CHECK_THAT(v, UnorderedEquals(v)); - CHECK_THAT(v, UnorderedEquals({ 3, 2, 1 })); - CHECK_THAT(empty, UnorderedEquals(empty)); - - auto permuted = v; - std::next_permutation(begin(permuted), end(permuted)); - REQUIRE_THAT(permuted, UnorderedEquals(v)); - - std::reverse(begin(permuted), end(permuted)); - REQUIRE_THAT(permuted, UnorderedEquals(v)); - - CHECK_THAT(v5, (UnorderedEquals, CustomAllocator>(permuted))); - - auto v5_permuted = v5; - std::next_permutation(begin(v5_permuted), end(v5_permuted)); - CHECK_THAT(v5_permuted, UnorderedEquals(v5)); - } - } - - TEST_CASE("Vector matchers that fail", "[matchers][vector][.][failing]") { - std::vector v; - v.push_back(1); - v.push_back(2); - v.push_back(3); - - std::vector v2; - v2.push_back(1); - v2.push_back(2); - - std::vector v3; - v3.push_back(1); - v3.push_back(2); - v3.push_back(3); - - std::vector v4; - v4.push_back(1.1); - v4.push_back(2.1); - v4.push_back(3.1); - - std::vector empty; - - SECTION("Contains (element)") { - CHECK_THAT(v, VectorContains(-1)); - CHECK_THAT(empty, VectorContains(1)); - } - SECTION("Contains (vector)") { - CHECK_THAT(empty, Contains(v)); - v2.push_back(4); - CHECK_THAT(v, Contains(v2)); - } - - SECTION("Equals") { - - CHECK_THAT(v, Equals(v2)); - CHECK_THAT(v2, Equals(v)); - CHECK_THAT(empty, Equals(v)); - CHECK_THAT(v, Equals(empty)); - } - SECTION("UnorderedEquals") { - CHECK_THAT(v, UnorderedEquals(empty)); - CHECK_THAT(empty, UnorderedEquals(v)); - - auto permuted = v; - std::next_permutation(begin(permuted), end(permuted)); - permuted.pop_back(); - CHECK_THAT(permuted, UnorderedEquals(v)); - - std::reverse(begin(permuted), end(permuted)); - CHECK_THAT(permuted, UnorderedEquals(v)); - } - } - - TEST_CASE("Exception matchers that succeed", "[matchers][exceptions][!throws]") { - CHECK_THROWS_MATCHES(throwsSpecialException(1), SpecialException, ExceptionMatcher{1}); - REQUIRE_THROWS_MATCHES(throwsSpecialException(2), SpecialException, ExceptionMatcher{2}); - } - - TEST_CASE("Exception matchers that fail", "[matchers][exceptions][!throws][.failing]") { - SECTION("No exception") { - CHECK_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{1}); - REQUIRE_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{1}); - } - SECTION("Type mismatch") { - CHECK_THROWS_MATCHES(throwsAsInt(1), SpecialException, ExceptionMatcher{1}); - REQUIRE_THROWS_MATCHES(throwsAsInt(1), SpecialException, ExceptionMatcher{1}); - } - SECTION("Contents are wrong") { - CHECK_THROWS_MATCHES(throwsSpecialException(3), SpecialException, ExceptionMatcher{1}); - REQUIRE_THROWS_MATCHES(throwsSpecialException(4), SpecialException, ExceptionMatcher{1}); - } - } - - TEST_CASE("Floating point matchers: float", "[matchers][floating-point]") { - SECTION("Relative") { - REQUIRE_THAT(10.f, WithinRel(11.1f, 0.1f)); - REQUIRE_THAT(10.f, !WithinRel(11.2f, 0.1f)); - REQUIRE_THAT( 1.f, !WithinRel(0.f, 0.99f)); - REQUIRE_THAT(-0.f, WithinRel(0.f)); - SECTION("Some subnormal values") { - auto v1 = std::numeric_limits::min(); - auto v2 = v1; - for (int i = 0; i < 5; ++i) { - v2 = std::nextafter(v1, 0.f); - } - REQUIRE_THAT(v1, WithinRel(v2)); - } - } - SECTION("Margin") { - REQUIRE_THAT(1.f, WithinAbs(1.f, 0)); - REQUIRE_THAT(0.f, WithinAbs(1.f, 1)); - - REQUIRE_THAT(0.f, !WithinAbs(1.f, 0.99f)); - REQUIRE_THAT(0.f, !WithinAbs(1.f, 0.99f)); - - REQUIRE_THAT(0.f, WithinAbs(-0.f, 0)); - - REQUIRE_THAT(11.f, !WithinAbs(10.f, 0.5f)); - REQUIRE_THAT(10.f, !WithinAbs(11.f, 0.5f)); - REQUIRE_THAT(-10.f, WithinAbs(-10.f, 0.5f)); - REQUIRE_THAT(-10.f, WithinAbs(-9.6f, 0.5f)); - } - SECTION("ULPs") { - REQUIRE_THAT(1.f, WithinULP(1.f, 0)); - - REQUIRE_THAT(nextafter(1.f, 2.f), WithinULP(1.f, 1)); - REQUIRE_THAT(0.f, WithinULP(nextafter(0.f, 1.f), 1)); - REQUIRE_THAT(1.f, WithinULP(nextafter(1.f, 0.f), 1)); - REQUIRE_THAT(1.f, !WithinULP(nextafter(1.f, 2.f), 0)); - - REQUIRE_THAT(1.f, WithinULP(1.f, 0)); - REQUIRE_THAT(-0.f, WithinULP(0.f, 0)); - } - SECTION("Composed") { - REQUIRE_THAT(1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1)); - REQUIRE_THAT(1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0)); - REQUIRE_THAT(0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f)); - } - SECTION("Constructor validation") { - REQUIRE_NOTHROW(WithinAbs(1.f, 0.f)); - REQUIRE_THROWS_AS(WithinAbs(1.f, -1.f), std::domain_error); - - REQUIRE_NOTHROW(WithinULP(1.f, 0)); - REQUIRE_THROWS_AS(WithinULP(1.f, static_cast(-1)), std::domain_error); - - REQUIRE_NOTHROW(WithinRel(1.f, 0.f)); - REQUIRE_THROWS_AS(WithinRel(1.f, -0.2f), std::domain_error); - REQUIRE_THROWS_AS(WithinRel(1.f, 1.f), std::domain_error); - } - } - - TEST_CASE("Floating point matchers: double", "[matchers][floating-point]") { - SECTION("Relative") { - REQUIRE_THAT(10., WithinRel(11.1, 0.1)); - REQUIRE_THAT(10., !WithinRel(11.2, 0.1)); - REQUIRE_THAT(1., !WithinRel(0., 0.99)); - REQUIRE_THAT(-0., WithinRel(0.)); - SECTION("Some subnormal values") { - auto v1 = std::numeric_limits::min(); - auto v2 = v1; - for (int i = 0; i < 5; ++i) { - v2 = std::nextafter(v1, 0); - } - REQUIRE_THAT(v1, WithinRel(v2)); - } - } - SECTION("Margin") { - REQUIRE_THAT(1., WithinAbs(1., 0)); - REQUIRE_THAT(0., WithinAbs(1., 1)); - - REQUIRE_THAT(0., !WithinAbs(1., 0.99)); - REQUIRE_THAT(0., !WithinAbs(1., 0.99)); - - REQUIRE_THAT(11., !WithinAbs(10., 0.5)); - REQUIRE_THAT(10., !WithinAbs(11., 0.5)); - REQUIRE_THAT(-10., WithinAbs(-10., 0.5)); - REQUIRE_THAT(-10., WithinAbs(-9.6, 0.5)); - } - SECTION("ULPs") { - REQUIRE_THAT(1., WithinULP(1., 0)); - - REQUIRE_THAT(nextafter(1., 2.), WithinULP(1., 1)); - REQUIRE_THAT(0., WithinULP(nextafter(0., 1.), 1)); - REQUIRE_THAT(1., WithinULP(nextafter(1., 0.), 1)); - REQUIRE_THAT(1., !WithinULP(nextafter(1., 2.), 0)); - - REQUIRE_THAT(1., WithinULP(1., 0)); - REQUIRE_THAT(-0., WithinULP(0., 0)); - } - SECTION("Composed") { - REQUIRE_THAT(1., WithinAbs(1., 0.5) || WithinULP(2., 1)); - REQUIRE_THAT(1., WithinAbs(2., 0.5) || WithinULP(1., 0)); - REQUIRE_THAT(0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1)); - } - SECTION("Constructor validation") { - REQUIRE_NOTHROW(WithinAbs(1., 0.)); - REQUIRE_THROWS_AS(WithinAbs(1., -1.), std::domain_error); - - REQUIRE_NOTHROW(WithinULP(1., 0)); - - REQUIRE_NOTHROW(WithinRel(1., 0.)); - REQUIRE_THROWS_AS(WithinRel(1., -0.2), std::domain_error); - REQUIRE_THROWS_AS(WithinRel(1., 1.), std::domain_error); - } - } - - TEST_CASE("Floating point matchers that are problematic in approvals", "[approvals][matchers][floating-point]") { - REQUIRE_THAT(NAN, !WithinAbs(NAN, 0)); - REQUIRE_THAT(NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123))); - REQUIRE_THAT(NAN, !WithinULP(NAN, 123)); - REQUIRE_THAT(INFINITY, WithinRel(INFINITY)); - REQUIRE_THAT(-INFINITY, !WithinRel(INFINITY)); - REQUIRE_THAT(1., !WithinRel(INFINITY)); - REQUIRE_THAT(INFINITY, !WithinRel(1.)); - REQUIRE_THAT(NAN, !WithinRel(NAN)); - REQUIRE_THAT(1., !WithinRel(NAN)); - REQUIRE_THAT(NAN, !WithinRel(1.)); - } - - TEST_CASE("Arbitrary predicate matcher", "[matchers][generic]") { - SECTION("Function pointer") { - REQUIRE_THAT(1, Predicate(alwaysTrue, "always true")); - REQUIRE_THAT(1, !Predicate(alwaysFalse, "always false")); - } - SECTION("Lambdas + different type") { - REQUIRE_THAT("Hello olleH", - Predicate( - [] (std::string const& str) -> bool { return str.front() == str.back(); }, - "First and last character should be equal") - ); - - REQUIRE_THAT("This wouldn't pass", - !Predicate( - [] (std::string const& str) -> bool { return str.front() == str.back(); } - ) - ); - } - } - - TEST_CASE("Regression test #1", "[matchers][vector]") { - // At some point, UnorderedEqualsMatcher skipped - // mismatched prefixed before doing the comparison itself - std::vector actual = { 'a', 'b' }; - std::vector expected = { 'c', 'b' }; - - CHECK_THAT(actual, !UnorderedEquals(expected)); - } - - TEST_CASE("Predicate matcher can accept const char*", "[matchers][compilation]") { - REQUIRE_THAT("foo", Predicate([] (const char* const&) { return true; })); - } - - TEST_CASE("Vector Approx matcher", "[matchers][approx][vector]") { - using Catch::Matchers::Approx; - SECTION("Empty vector is roughly equal to an empty vector") { - std::vector empty; - REQUIRE_THAT(empty, Approx(empty)); - } - SECTION("Vectors with elements") { - std::vector v1({1., 2., 3.}); - SECTION("A vector is approx equal to itself") { - REQUIRE_THAT(v1, Approx(v1)); - REQUIRE_THAT(v1, Approx({ 1., 2., 3. })); - } - std::vector v2({1.5, 2.5, 3.5}); - SECTION("Different length") { - auto temp(v1); - temp.push_back(4); - REQUIRE_THAT(v1, !Approx(temp)); - } - SECTION("Same length, different elements") { - REQUIRE_THAT(v1, !Approx(v2)); - REQUIRE_THAT(v1, Approx(v2).margin(0.5)); - REQUIRE_THAT(v1, Approx(v2).epsilon(0.5)); - REQUIRE_THAT(v1, Approx(v2).epsilon(0.1).scale(500)); - } - } - } - - TEST_CASE("Vector Approx matcher -- failing", "[matchers][approx][vector][.failing]") { - using Catch::Matchers::Approx; - SECTION("Empty and non empty vectors are not approx equal") { - std::vector empty, t1({1, 2}); - CHECK_THAT(empty, Approx(t1)); - } - SECTION("Just different vectors") { - std::vector v1({2., 4., 6.}), v2({1., 3., 5.}); - CHECK_THAT(v1, Approx(v2)); - } - } - - TEST_CASE("Exceptions matchers", "[matchers][exceptions][!throws]") { - REQUIRE_THROWS_MATCHES(throwsDerivedException(), DerivedException, Message("DerivedException::what")); - REQUIRE_THROWS_MATCHES(throwsDerivedException(), DerivedException, !Message("derivedexception::what")); - REQUIRE_THROWS_MATCHES(throwsSpecialException(2), SpecialException, !Message("DerivedException::what")); - REQUIRE_THROWS_MATCHES(throwsSpecialException(2), SpecialException, Message("SpecialException::what")); - } - - struct CheckedTestingMatcher : Catch::Matchers::MatcherBase { - mutable bool matchCalled = false; - bool matchSucceeds = false; - - bool match(int const&) const override { - matchCalled = true; - return matchSucceeds; - } - std::string describe() const override { - return "CheckedTestingMatcher set to " + (matchSucceeds ? std::string("succeed") : std::string("fail")); - } - }; - - TEST_CASE("Composed matchers shortcircuit", "[matchers][composed]") { - // Check that if first returns false, second is not touched - CheckedTestingMatcher first, second; - SECTION("MatchAllOf") { - first.matchSucceeds = false; - - Detail::MatchAllOf matcher = - Detail::MatchAllOf{} && first && second; - CHECK_FALSE( matcher.match( 1 ) ); - - // These two assertions are the important ones - REQUIRE(first.matchCalled); - REQUIRE(!second.matchCalled); - } - // Check that if first returns true, second is not touched - SECTION("MatchAnyOf") { - first.matchSucceeds = true; - - Detail::MatchAnyOf matcher = - Detail::MatchAnyOf{} || first || second; - CHECK( matcher.match( 1 ) ); - - // These two assertions are the important ones - REQUIRE(first.matchCalled); - REQUIRE(!second.matchCalled); - } - } - - struct CheckedTestingGenericMatcher : Catch::Matchers::MatcherGenericBase { - mutable bool matchCalled = false; - bool matchSucceeds = false; - - bool match(int const&) const { - matchCalled = true; - return matchSucceeds; - } - std::string describe() const override { - return "CheckedTestingGenericMatcher set to " + (matchSucceeds ? std::string("succeed") : std::string("fail")); - } - }; - - TEST_CASE("Composed generic matchers shortcircuit", "[matchers][composed][generic]") { - // Check that if first returns false, second is not touched - CheckedTestingGenericMatcher first, second; - SECTION("MatchAllOf") { - first.matchSucceeds = false; - - Detail::MatchAllOfGeneric - matcher{ first, second }; - - CHECK_FALSE( matcher.match( 1 ) ); - - // These two assertions are the important ones - REQUIRE(first.matchCalled); - REQUIRE(!second.matchCalled); - } - // Check that if first returns true, second is not touched - SECTION("MatchAnyOf") { - first.matchSucceeds = true; - - Detail::MatchAnyOfGeneric - matcher{ first, second }; - CHECK(matcher.match(1)); - - // These two assertions are the important ones - REQUIRE(first.matchCalled); - REQUIRE(!second.matchCalled); - } - } - - - template - struct EqualsRangeMatcher : Catch::Matchers::MatcherGenericBase { - - EqualsRangeMatcher(Range const& range) : m_range{ range } {} - - template - bool match(OtherRange const& other) const { - using std::begin; - using std::end; - - return std::equal(begin(m_range), end(m_range), begin(other), end(other)); - } - - std::string describe() const override { - return "Equals: " + Catch::rangeToString(m_range); - } - - private: - Range const& m_range; - }; - - template - auto EqualsRange(const Range& range) -> EqualsRangeMatcher { - return EqualsRangeMatcher{range}; + REQUIRE_THAT( testStringForMatching2(), + !Matches( "this string contains 'abc' as a substring" ) ); +} + +TEST_CASE( "Regex string matcher", "[matchers][.failing]" ) { + CHECK_THAT( testStringForMatching(), + Matches( "this STRING contains 'abc' as a substring" ) ); + CHECK_THAT( testStringForMatching(), + Matches( "contains 'abc' as a substring" ) ); + CHECK_THAT( testStringForMatching(), + Matches( "this string contains 'abc' as a" ) ); +} + +TEST_CASE( "Matchers can be (AllOf) composed with the && operator", + "[matchers][operators][operator&&]" ) { + CHECK_THAT( testStringForMatching(), + Contains( "string" ) && Contains( "abc" ) && + Contains( "substring" ) && Contains( "contains" ) ); +} + +TEST_CASE( "Matchers can be (AnyOf) composed with the || operator", + "[matchers][operators][operator||]" ) { + CHECK_THAT( testStringForMatching(), + Contains( "string" ) || Contains( "different" ) || + Contains( "random" ) ); + CHECK_THAT( testStringForMatching2(), + Contains( "string" ) || Contains( "different" ) || + Contains( "random" ) ); +} + +TEST_CASE( "Matchers can be composed with both && and ||", + "[matchers][operators][operator||][operator&&]" ) { + CHECK_THAT( testStringForMatching(), + ( Contains( "string" ) || Contains( "different" ) ) && + Contains( "substring" ) ); +} + +TEST_CASE( "Matchers can be composed with both && and || - failing", + "[matchers][operators][operator||][operator&&][.failing]" ) { + CHECK_THAT( testStringForMatching(), + ( Contains( "string" ) || Contains( "different" ) ) && + Contains( "random" ) ); +} + +TEST_CASE( "Matchers can be negated (Not) with the ! operator", + "[matchers][operators][not]" ) { + CHECK_THAT( testStringForMatching(), !Contains( "different" ) ); +} + +TEST_CASE( "Matchers can be negated (Not) with the ! operator - failing", + "[matchers][operators][not][.failing]" ) { + CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ); +} + +template struct CustomAllocator : private std::allocator { + using size_type = size_t; + using difference_type = ptrdiff_t; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using value_type = T; + + template struct rebind { using other = CustomAllocator; }; + + using propagate_on_container_move_assignment = std::true_type; + using is_always_equal = std::true_type; + + CustomAllocator() = default; + + CustomAllocator( const CustomAllocator& other ): + std::allocator( other ) {} + + template CustomAllocator( const CustomAllocator& ) {} + + ~CustomAllocator() = default; + + using std::allocator::allocate; + using std::allocator::deallocate; +}; + +TEST_CASE( "Vector matchers", "[matchers][vector]" ) { + std::vector v; + v.push_back( 1 ); + v.push_back( 2 ); + v.push_back( 3 ); + + std::vector v2; + v2.push_back( 1 ); + v2.push_back( 2 ); + + std::vector v3; + v3.push_back( 1 ); + v3.push_back( 2 ); + v3.push_back( 3 ); + + std::vector v4; + v4.push_back( 1 + 1e-8 ); + v4.push_back( 2 + 1e-8 ); + v4.push_back( 3 + 1e-8 ); + + std::vector> v5; + v5.push_back( 1 ); + v5.push_back( 2 ); + v5.push_back( 3 ); + + std::vector> v6; + v6.push_back( 1 ); + v6.push_back( 2 ); + + std::vector empty; + + SECTION( "Contains (element)" ) { + CHECK_THAT( v, VectorContains( 1 ) ); + CHECK_THAT( v, VectorContains( 2 ) ); + CHECK_THAT( v5, ( VectorContains>( 2 ) ) ); + } + SECTION( "Contains (vector)" ) { + CHECK_THAT( v, Contains( v2 ) ); + CHECK_THAT( v, Contains( { 1, 2 } ) ); + CHECK_THAT( v5, + ( Contains, CustomAllocator>( + v2 ) ) ); + + v2.push_back( 3 ); // now exactly matches + CHECK_THAT( v, Contains( v2 ) ); + + CHECK_THAT( v, Contains( empty ) ); + CHECK_THAT( empty, Contains( empty ) ); + + CHECK_THAT( v5, + ( Contains, CustomAllocator>( + v2 ) ) ); + CHECK_THAT( v5, Contains( v6 ) ); + } + SECTION( "Contains (element), composed" ) { + CHECK_THAT( v, VectorContains( 1 ) && VectorContains( 2 ) ); } - TEST_CASE("Combining templated matchers", "[matchers][templated]") { - std::array container{{ 1,2,3 }}; + SECTION( "Equals" ) { - std::array a{{ 1,2,3 }}; - std::vector b{ 0,1,2 }; - std::list c{ 4,5,6 }; + // Same vector + CHECK_THAT( v, Equals( v ) ); - REQUIRE_THAT(container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c)); + CHECK_THAT( empty, Equals( empty ) ); + + // Different vector with same elements + CHECK_THAT( v, Equals( { 1, 2, 3 } ) ); + v2.push_back( 3 ); + CHECK_THAT( v, Equals( v2 ) ); + + CHECK_THAT( + v5, + ( Equals, CustomAllocator>( v2 ) ) ); + + v6.push_back( 3 ); + CHECK_THAT( v5, Equals( v6 ) ); + } + SECTION( "UnorderedEquals" ) { + CHECK_THAT( v, UnorderedEquals( v ) ); + CHECK_THAT( v, UnorderedEquals( { 3, 2, 1 } ) ); + CHECK_THAT( empty, UnorderedEquals( empty ) ); + + auto permuted = v; + std::next_permutation( begin( permuted ), end( permuted ) ); + REQUIRE_THAT( permuted, UnorderedEquals( v ) ); + + std::reverse( begin( permuted ), end( permuted ) ); + REQUIRE_THAT( permuted, UnorderedEquals( v ) ); + + CHECK_THAT( + v5, + ( UnorderedEquals, CustomAllocator>( + permuted ) ) ); + + auto v5_permuted = v5; + std::next_permutation( begin( v5_permuted ), end( v5_permuted ) ); + CHECK_THAT( v5_permuted, UnorderedEquals( v5 ) ); + } +} + +TEST_CASE( "Vector matchers that fail", "[matchers][vector][.][failing]" ) { + std::vector v; + v.push_back( 1 ); + v.push_back( 2 ); + v.push_back( 3 ); + + std::vector v2; + v2.push_back( 1 ); + v2.push_back( 2 ); + + std::vector v3; + v3.push_back( 1 ); + v3.push_back( 2 ); + v3.push_back( 3 ); + + std::vector v4; + v4.push_back( 1.1 ); + v4.push_back( 2.1 ); + v4.push_back( 3.1 ); + + std::vector empty; + + SECTION( "Contains (element)" ) { + CHECK_THAT( v, VectorContains( -1 ) ); + CHECK_THAT( empty, VectorContains( 1 ) ); + } + SECTION( "Contains (vector)" ) { + CHECK_THAT( empty, Contains( v ) ); + v2.push_back( 4 ); + CHECK_THAT( v, Contains( v2 ) ); } - TEST_CASE("Combining templated and concrete matchers", "[matchers][templated]") { - std::vector vec{ 1, 3, 5 }; + SECTION( "Equals" ) { - std::array a{{ 5, 3, 1 }}; + CHECK_THAT( v, Equals( v2 ) ); + CHECK_THAT( v2, Equals( v ) ); + CHECK_THAT( empty, Equals( v ) ); + CHECK_THAT( v, Equals( empty ) ); + } + SECTION( "UnorderedEquals" ) { + CHECK_THAT( v, UnorderedEquals( empty ) ); + CHECK_THAT( empty, UnorderedEquals( v ) ); - REQUIRE_THAT(vec, - Predicate>([](auto const& v) { - return std::all_of(v.begin(), v.end(), [](int elem) { - return elem % 2 == 1; - }); - }, "All elements are odd") && - !EqualsRange(a)); + auto permuted = v; + std::next_permutation( begin( permuted ), end( permuted ) ); + permuted.pop_back(); + CHECK_THAT( permuted, UnorderedEquals( v ) ); - const std::string str = "foobar"; - const std::array arr{{ 'f', 'o', 'o', 'b', 'a', 'r' }}; - const std::array bad_arr{{ 'o', 'o', 'f', 'b', 'a', 'r' }}; + std::reverse( begin( permuted ), end( permuted ) ); + CHECK_THAT( permuted, UnorderedEquals( v ) ); + } +} - using Catch::Matchers::StartsWith; - using Catch::Matchers::EndsWith; +TEST_CASE( "Exception matchers that succeed", + "[matchers][exceptions][!throws]" ) { + CHECK_THROWS_MATCHES( + throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } ); + REQUIRE_THROWS_MATCHES( + throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } ); +} - REQUIRE_THAT(str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar")); - REQUIRE_THAT(str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar")); +TEST_CASE( "Exception matchers that fail", + "[matchers][exceptions][!throws][.failing]" ) { + SECTION( "No exception" ) { + CHECK_THROWS_MATCHES( + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ); + REQUIRE_THROWS_MATCHES( + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ); + } + SECTION( "Type mismatch" ) { + CHECK_THROWS_MATCHES( + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ); + REQUIRE_THROWS_MATCHES( + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ); + } + SECTION( "Contents are wrong" ) { + CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), + SpecialException, + ExceptionMatcher{ 1 } ); + REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), + SpecialException, + ExceptionMatcher{ 1 } ); + } +} - REQUIRE_THAT(str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar")); - REQUIRE_THAT(str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar")); +TEST_CASE( "Floating point matchers: float", "[matchers][floating-point]" ) { + SECTION( "Relative" ) { + REQUIRE_THAT( 10.f, WithinRel( 11.1f, 0.1f ) ); + REQUIRE_THAT( 10.f, !WithinRel( 11.2f, 0.1f ) ); + REQUIRE_THAT( 1.f, !WithinRel( 0.f, 0.99f ) ); + REQUIRE_THAT( -0.f, WithinRel( 0.f ) ); + SECTION( "Some subnormal values" ) { + auto v1 = std::numeric_limits::min(); + auto v2 = v1; + for ( int i = 0; i < 5; ++i ) { + v2 = std::nextafter( v1, 0.f ); + } + REQUIRE_THAT( v1, WithinRel( v2 ) ); + } + } + SECTION( "Margin" ) { + REQUIRE_THAT( 1.f, WithinAbs( 1.f, 0 ) ); + REQUIRE_THAT( 0.f, WithinAbs( 1.f, 1 ) ); - REQUIRE_THAT(str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar"))); - REQUIRE_THAT(str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr)); + REQUIRE_THAT( 0.f, !WithinAbs( 1.f, 0.99f ) ); + REQUIRE_THAT( 0.f, !WithinAbs( 1.f, 0.99f ) ); + + REQUIRE_THAT( 0.f, WithinAbs( -0.f, 0 ) ); + + REQUIRE_THAT( 11.f, !WithinAbs( 10.f, 0.5f ) ); + REQUIRE_THAT( 10.f, !WithinAbs( 11.f, 0.5f ) ); + REQUIRE_THAT( -10.f, WithinAbs( -10.f, 0.5f ) ); + REQUIRE_THAT( -10.f, WithinAbs( -9.6f, 0.5f ) ); + } + SECTION( "ULPs" ) { + REQUIRE_THAT( 1.f, WithinULP( 1.f, 0 ) ); + + REQUIRE_THAT( nextafter( 1.f, 2.f ), WithinULP( 1.f, 1 ) ); + REQUIRE_THAT( 0.f, WithinULP( nextafter( 0.f, 1.f ), 1 ) ); + REQUIRE_THAT( 1.f, WithinULP( nextafter( 1.f, 0.f ), 1 ) ); + REQUIRE_THAT( 1.f, !WithinULP( nextafter( 1.f, 2.f ), 0 ) ); + + REQUIRE_THAT( 1.f, WithinULP( 1.f, 0 ) ); + REQUIRE_THAT( -0.f, WithinULP( 0.f, 0 ) ); + } + SECTION( "Composed" ) { + REQUIRE_THAT( 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) ); + REQUIRE_THAT( 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) ); + REQUIRE_THAT( 0.0001f, + WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) ); + } + SECTION( "Constructor validation" ) { + REQUIRE_NOTHROW( WithinAbs( 1.f, 0.f ) ); + REQUIRE_THROWS_AS( WithinAbs( 1.f, -1.f ), std::domain_error ); + + REQUIRE_NOTHROW( WithinULP( 1.f, 0 ) ); + REQUIRE_THROWS_AS( WithinULP( 1.f, static_cast( -1 ) ), + std::domain_error ); + + REQUIRE_NOTHROW( WithinRel( 1.f, 0.f ) ); + REQUIRE_THROWS_AS( WithinRel( 1.f, -0.2f ), std::domain_error ); + REQUIRE_THROWS_AS( WithinRel( 1.f, 1.f ), std::domain_error ); + } +} + +TEST_CASE( "Floating point matchers: double", "[matchers][floating-point]" ) { + SECTION( "Relative" ) { + REQUIRE_THAT( 10., WithinRel( 11.1, 0.1 ) ); + REQUIRE_THAT( 10., !WithinRel( 11.2, 0.1 ) ); + REQUIRE_THAT( 1., !WithinRel( 0., 0.99 ) ); + REQUIRE_THAT( -0., WithinRel( 0. ) ); + SECTION( "Some subnormal values" ) { + auto v1 = std::numeric_limits::min(); + auto v2 = v1; + for ( int i = 0; i < 5; ++i ) { + v2 = std::nextafter( v1, 0 ); + } + REQUIRE_THAT( v1, WithinRel( v2 ) ); + } + } + SECTION( "Margin" ) { + REQUIRE_THAT( 1., WithinAbs( 1., 0 ) ); + REQUIRE_THAT( 0., WithinAbs( 1., 1 ) ); + + REQUIRE_THAT( 0., !WithinAbs( 1., 0.99 ) ); + REQUIRE_THAT( 0., !WithinAbs( 1., 0.99 ) ); + + REQUIRE_THAT( 11., !WithinAbs( 10., 0.5 ) ); + REQUIRE_THAT( 10., !WithinAbs( 11., 0.5 ) ); + REQUIRE_THAT( -10., WithinAbs( -10., 0.5 ) ); + REQUIRE_THAT( -10., WithinAbs( -9.6, 0.5 ) ); + } + SECTION( "ULPs" ) { + REQUIRE_THAT( 1., WithinULP( 1., 0 ) ); + + REQUIRE_THAT( nextafter( 1., 2. ), WithinULP( 1., 1 ) ); + REQUIRE_THAT( 0., WithinULP( nextafter( 0., 1. ), 1 ) ); + REQUIRE_THAT( 1., WithinULP( nextafter( 1., 0. ), 1 ) ); + REQUIRE_THAT( 1., !WithinULP( nextafter( 1., 2. ), 0 ) ); + + REQUIRE_THAT( 1., WithinULP( 1., 0 ) ); + REQUIRE_THAT( -0., WithinULP( 0., 0 ) ); + } + SECTION( "Composed" ) { + REQUIRE_THAT( 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) ); + REQUIRE_THAT( 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) ); + REQUIRE_THAT( 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) ); + } + SECTION( "Constructor validation" ) { + REQUIRE_NOTHROW( WithinAbs( 1., 0. ) ); + REQUIRE_THROWS_AS( WithinAbs( 1., -1. ), std::domain_error ); + + REQUIRE_NOTHROW( WithinULP( 1., 0 ) ); + + REQUIRE_NOTHROW( WithinRel( 1., 0. ) ); + REQUIRE_THROWS_AS( WithinRel( 1., -0.2 ), std::domain_error ); + REQUIRE_THROWS_AS( WithinRel( 1., 1. ), std::domain_error ); + } +} + +TEST_CASE( "Floating point matchers that are problematic in approvals", + "[approvals][matchers][floating-point]" ) { + REQUIRE_THAT( NAN, !WithinAbs( NAN, 0 ) ); + REQUIRE_THAT( NAN, !( WithinAbs( NAN, 100 ) || WithinULP( NAN, 123 ) ) ); + REQUIRE_THAT( NAN, !WithinULP( NAN, 123 ) ); + REQUIRE_THAT( INFINITY, WithinRel( INFINITY ) ); + REQUIRE_THAT( -INFINITY, !WithinRel( INFINITY ) ); + REQUIRE_THAT( 1., !WithinRel( INFINITY ) ); + REQUIRE_THAT( INFINITY, !WithinRel( 1. ) ); + REQUIRE_THAT( NAN, !WithinRel( NAN ) ); + REQUIRE_THAT( 1., !WithinRel( NAN ) ); + REQUIRE_THAT( NAN, !WithinRel( 1. ) ); +} + +TEST_CASE( "Arbitrary predicate matcher", "[matchers][generic]" ) { + SECTION( "Function pointer" ) { + REQUIRE_THAT( 1, Predicate( alwaysTrue, "always true" ) ); + REQUIRE_THAT( 1, !Predicate( alwaysFalse, "always false" ) ); + } + SECTION( "Lambdas + different type" ) { + REQUIRE_THAT( "Hello olleH", + Predicate( + []( std::string const& str ) -> bool { + return str.front() == str.back(); + }, + "First and last character should be equal" ) ); + + REQUIRE_THAT( + "This wouldn't pass", + !Predicate( []( std::string const& str ) -> bool { + return str.front() == str.back(); + } ) ); + } +} + +TEST_CASE( "Regression test #1", "[matchers][vector]" ) { + // At some point, UnorderedEqualsMatcher skipped + // mismatched prefixed before doing the comparison itself + std::vector actual = { 'a', 'b' }; + std::vector expected = { 'c', 'b' }; + + CHECK_THAT( actual, !UnorderedEquals( expected ) ); +} + +TEST_CASE( "Predicate matcher can accept const char*", + "[matchers][compilation]" ) { + REQUIRE_THAT( "foo", Predicate( []( const char* const& ) { + return true; + } ) ); +} + +TEST_CASE( "Vector Approx matcher", "[matchers][approx][vector]" ) { + using Catch::Matchers::Approx; + SECTION( "Empty vector is roughly equal to an empty vector" ) { + std::vector empty; + REQUIRE_THAT( empty, Approx( empty ) ); + } + SECTION( "Vectors with elements" ) { + std::vector v1( { 1., 2., 3. } ); + SECTION( "A vector is approx equal to itself" ) { + REQUIRE_THAT( v1, Approx( v1 ) ); + REQUIRE_THAT( v1, Approx( { 1., 2., 3. } ) ); + } + std::vector v2( { 1.5, 2.5, 3.5 } ); + SECTION( "Different length" ) { + auto temp( v1 ); + temp.push_back( 4 ); + REQUIRE_THAT( v1, !Approx( temp ) ); + } + SECTION( "Same length, different elements" ) { + REQUIRE_THAT( v1, !Approx( v2 ) ); + REQUIRE_THAT( v1, Approx( v2 ).margin( 0.5 ) ); + REQUIRE_THAT( v1, Approx( v2 ).epsilon( 0.5 ) ); + REQUIRE_THAT( v1, Approx( v2 ).epsilon( 0.1 ).scale( 500 ) ); + } + } +} + +TEST_CASE( "Vector Approx matcher -- failing", + "[matchers][approx][vector][.failing]" ) { + using Catch::Matchers::Approx; + SECTION( "Empty and non empty vectors are not approx equal" ) { + std::vector empty, t1( { 1, 2 } ); + CHECK_THAT( empty, Approx( t1 ) ); + } + SECTION( "Just different vectors" ) { + std::vector v1( { 2., 4., 6. } ), v2( { 1., 3., 5. } ); + CHECK_THAT( v1, Approx( v2 ) ); + } +} + +TEST_CASE( "Exceptions matchers", "[matchers][exceptions][!throws]" ) { + REQUIRE_THROWS_MATCHES( throwsDerivedException(), + DerivedException, + Message( "DerivedException::what" ) ); + REQUIRE_THROWS_MATCHES( throwsDerivedException(), + DerivedException, + !Message( "derivedexception::what" ) ); + REQUIRE_THROWS_MATCHES( throwsSpecialException( 2 ), + SpecialException, + !Message( "DerivedException::what" ) ); + REQUIRE_THROWS_MATCHES( throwsSpecialException( 2 ), + SpecialException, + Message( "SpecialException::what" ) ); +} + +struct CheckedTestingMatcher : Catch::Matchers::MatcherBase { + mutable bool matchCalled = false; + bool matchSucceeds = false; + + bool match( int const& ) const override { + matchCalled = true; + return matchSucceeds; + } + std::string describe() const override { + return "CheckedTestingMatcher set to " + + ( matchSucceeds ? std::string( "succeed" ) + : std::string( "fail" ) ); + } +}; + +TEST_CASE( "Composed matchers shortcircuit", "[matchers][composed]" ) { + // Check that if first returns false, second is not touched + CheckedTestingMatcher first, second; + SECTION( "MatchAllOf" ) { + first.matchSucceeds = false; + + Detail::MatchAllOf matcher = + Detail::MatchAllOf{} && first && second; + CHECK_FALSE( matcher.match( 1 ) ); + + // These two assertions are the important ones + REQUIRE( first.matchCalled ); + REQUIRE( !second.matchCalled ); + } + // Check that if first returns true, second is not touched + SECTION( "MatchAnyOf" ) { + first.matchSucceeds = true; + + Detail::MatchAnyOf matcher = + Detail::MatchAnyOf{} || first || second; + CHECK( matcher.match( 1 ) ); + + // These two assertions are the important ones + REQUIRE( first.matchCalled ); + REQUIRE( !second.matchCalled ); + } +} + +struct CheckedTestingGenericMatcher : Catch::Matchers::MatcherGenericBase { + mutable bool matchCalled = false; + bool matchSucceeds = false; + + bool match( int const& ) const { + matchCalled = true; + return matchSucceeds; + } + std::string describe() const override { + return "CheckedTestingGenericMatcher set to " + + ( matchSucceeds ? std::string( "succeed" ) + : std::string( "fail" ) ); + } +}; + +TEST_CASE( "Composed generic matchers shortcircuit", + "[matchers][composed][generic]" ) { + // Check that if first returns false, second is not touched + CheckedTestingGenericMatcher first, second; + SECTION( "MatchAllOf" ) { + first.matchSucceeds = false; + + Detail::MatchAllOfGeneric + matcher{ first, second }; + + CHECK_FALSE( matcher.match( 1 ) ); + + // These two assertions are the important ones + REQUIRE( first.matchCalled ); + REQUIRE( !second.matchCalled ); + } + // Check that if first returns true, second is not touched + SECTION( "MatchAnyOf" ) { + first.matchSucceeds = true; + + Detail::MatchAnyOfGeneric + matcher{ first, second }; + CHECK( matcher.match( 1 ) ); + + // These two assertions are the important ones + REQUIRE( first.matchCalled ); + REQUIRE( !second.matchCalled ); + } +} + +template +struct EqualsRangeMatcher : Catch::Matchers::MatcherGenericBase { + + EqualsRangeMatcher( Range const& range ): m_range{ range } {} + + template bool match( OtherRange const& other ) const { + using std::begin; + using std::end; + + return std::equal( + begin( m_range ), end( m_range ), begin( other ), end( other ) ); } - TEST_CASE("Combining concrete matchers does not use templated matchers", "[matchers][templated]") { - using Catch::Matchers::StartsWith; - using Catch::Matchers::EndsWith; - - STATIC_REQUIRE(std::is_same< - decltype(StartsWith("foo") || (StartsWith("bar") && EndsWith("bar") && !EndsWith("foo"))), - Catch::Matchers::Detail::MatchAnyOf - >::value); + std::string describe() const override { + return "Equals: " + Catch::rangeToString( m_range ); } - struct MatcherA : Catch::Matchers::MatcherGenericBase { - std::string describe() const override { return "equals: (int) 1 or (float) 1.0f"; } - bool match(int i) const { return i == 1; } - bool match(float f) const { return f == 1.0f; } - }; +private: + Range const& m_range; +}; - struct MatcherB : Catch::Matchers::MatcherGenericBase { - std::string describe() const override { return "equals: (long long) 1"; } - bool match(long long l) const { return l == 1ll; } - }; +template +auto EqualsRange( const Range& range ) -> EqualsRangeMatcher { + return EqualsRangeMatcher{ range }; +} - struct MatcherC : Catch::Matchers::MatcherGenericBase { - std::string describe() const override { return "equals: (T) 1"; } - template - bool match(T t) const { return t == T{1}; } - }; +TEST_CASE( "Combining templated matchers", "[matchers][templated]" ) { + std::array container{ { 1, 2, 3 } }; - struct MatcherD : Catch::Matchers::MatcherGenericBase { - std::string describe() const override { return "equals: true"; } - bool match(bool b) const { return b == true; } - }; + std::array a{ { 1, 2, 3 } }; + std::vector b{ 0, 1, 2 }; + std::list c{ 4, 5, 6 }; - TEST_CASE("Combining only templated matchers", "[matchers][templated]") { - STATIC_REQUIRE(std::is_same< - decltype(MatcherA() || MatcherB()), - Catch::Matchers::Detail::MatchAnyOfGeneric - >::value); + REQUIRE_THAT( container, + EqualsRange( a ) || EqualsRange( b ) || EqualsRange( c ) ); +} - REQUIRE_THAT(1, MatcherA() || MatcherB()); +TEST_CASE( "Combining templated and concrete matchers", + "[matchers][templated]" ) { + std::vector vec{ 1, 3, 5 }; - STATIC_REQUIRE(std::is_same< - decltype(MatcherA() && MatcherB()), - Catch::Matchers::Detail::MatchAllOfGeneric - >::value); + std::array a{ { 5, 3, 1 } }; - REQUIRE_THAT(1, MatcherA() && MatcherB()); + REQUIRE_THAT( vec, + Predicate>( + []( auto const& v ) { + return std::all_of( + v.begin(), v.end(), []( int elem ) { + return elem % 2 == 1; + } ); + }, + "All elements are odd" ) && + !EqualsRange( a ) ); - STATIC_REQUIRE(std::is_same< - decltype(MatcherA() || !MatcherB()), - Catch::Matchers::Detail::MatchAnyOfGeneric> - >::value); + const std::string str = "foobar"; + const std::array arr{ { 'f', 'o', 'o', 'b', 'a', 'r' } }; + const std::array bad_arr{ { 'o', 'o', 'f', 'b', 'a', 'r' } }; - REQUIRE_THAT(1, MatcherA() || !MatcherB()); + using Catch::Matchers::EndsWith; + using Catch::Matchers::StartsWith; + + REQUIRE_THAT( + str, StartsWith( "foo" ) && EqualsRange( arr ) && EndsWith( "bar" ) ); + REQUIRE_THAT( str, + StartsWith( "foo" ) && !EqualsRange( bad_arr ) && + EndsWith( "bar" ) ); + + REQUIRE_THAT( + str, EqualsRange( arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) ); + REQUIRE_THAT( str, + !EqualsRange( bad_arr ) && StartsWith( "foo" ) && + EndsWith( "bar" ) ); + + REQUIRE_THAT( str, + EqualsRange( bad_arr ) || + ( StartsWith( "foo" ) && EndsWith( "bar" ) ) ); + REQUIRE_THAT( str, + ( StartsWith( "foo" ) && EndsWith( "bar" ) ) || + EqualsRange( bad_arr ) ); +} + +TEST_CASE( "Combining concrete matchers does not use templated matchers", + "[matchers][templated]" ) { + using Catch::Matchers::EndsWith; + using Catch::Matchers::StartsWith; + + STATIC_REQUIRE( + std::is_same>::value ); +} + +struct MatcherA : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { + return "equals: (int) 1 or (float) 1.0f"; + } + bool match( int i ) const { return i == 1; } + bool match( float f ) const { return f == 1.0f; } +}; + +struct MatcherB : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { return "equals: (long long) 1"; } + bool match( long long l ) const { return l == 1ll; } +}; + +struct MatcherC : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { return "equals: (T) 1"; } + template bool match( T t ) const { return t == T{ 1 }; } +}; + +struct MatcherD : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { return "equals: true"; } + bool match( bool b ) const { return b == true; } +}; + +TEST_CASE( "Combining only templated matchers", "[matchers][templated]" ) { + STATIC_REQUIRE( + std::is_same>::value ); + + REQUIRE_THAT( 1, MatcherA() || MatcherB() ); + + STATIC_REQUIRE( + std::is_same>::value ); + + REQUIRE_THAT( 1, MatcherA() && MatcherB() ); + + STATIC_REQUIRE( + std::is_same< + decltype( MatcherA() || !MatcherB() ), + Catch::Matchers::Detail::MatchAnyOfGeneric< + MatcherA, + Catch::Matchers::Detail::MatchNotOfGeneric>>::value ); + + REQUIRE_THAT( 1, MatcherA() || !MatcherB() ); +} + +TEST_CASE( "Combining MatchAnyOfGeneric does not nest", + "[matchers][templated]" ) { + // MatchAnyOfGeneric LHS + some matcher RHS + STATIC_REQUIRE( + std::is_same< + decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), + Catch::Matchers::Detail:: + MatchAnyOfGeneric>::value ); + + REQUIRE_THAT( 1, ( MatcherA() || MatcherB() ) || MatcherC() ); + + // some matcher LHS + MatchAnyOfGeneric RHS + STATIC_REQUIRE( + std::is_same< + decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), + Catch::Matchers::Detail:: + MatchAnyOfGeneric>::value ); + + REQUIRE_THAT( 1, MatcherA() || ( MatcherB() || MatcherC() ) ); + + // MatchAnyOfGeneric LHS + MatchAnyOfGeneric RHS + STATIC_REQUIRE( + std::is_same< + decltype( ( MatcherA() || MatcherB() ) || + ( MatcherC() || MatcherD() ) ), + Catch::Matchers::Detail:: + MatchAnyOfGeneric>:: + value ); + + REQUIRE_THAT( + 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ); +} + +TEST_CASE( "Combining MatchAllOfGeneric does not nest", + "[matchers][templated]" ) { + // MatchAllOfGeneric lhs + some matcher RHS + STATIC_REQUIRE( + std::is_same< + decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), + Catch::Matchers::Detail:: + MatchAllOfGeneric>::value ); + + REQUIRE_THAT( 1, ( MatcherA() && MatcherB() ) && MatcherC() ); + + // some matcher LHS + MatchAllOfGeneric RSH + STATIC_REQUIRE( + std::is_same< + decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), + Catch::Matchers::Detail:: + MatchAllOfGeneric>::value ); + + REQUIRE_THAT( 1, MatcherA() && ( MatcherB() && MatcherC() ) ); + + // MatchAllOfGeneric LHS + MatchAllOfGeneric RHS + STATIC_REQUIRE( + std::is_same< + decltype( ( MatcherA() && MatcherB() ) && + ( MatcherC() && MatcherD() ) ), + Catch::Matchers::Detail:: + MatchAllOfGeneric>:: + value ); + + REQUIRE_THAT( + 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ); +} + +TEST_CASE( "Combining MatchNotOfGeneric does not nest", + "[matchers][templated]" ) { + STATIC_REQUIRE( + std::is_same< + decltype( !MatcherA() ), + Catch::Matchers::Detail::MatchNotOfGeneric>::value ); + + REQUIRE_THAT( 0, !MatcherA() ); + + STATIC_REQUIRE( + std::is_same::value ); + + REQUIRE_THAT( 1, !!MatcherA() ); + + STATIC_REQUIRE( + std::is_same< + decltype( !!!MatcherA() ), + Catch::Matchers::Detail::MatchNotOfGeneric>::value ); + + REQUIRE_THAT( 0, !!!MatcherA() ); + + STATIC_REQUIRE( + std::is_same::value ); + + REQUIRE_THAT( 1, !!!!MatcherA() ); +} + +struct EvilAddressOfOperatorUsed : std::exception { + EvilAddressOfOperatorUsed() {} + const char* what() const noexcept override { + return "overloaded address-of operator of matcher was used instead of " + "std::addressof"; + } +}; + +struct EvilCommaOperatorUsed : std::exception { + EvilCommaOperatorUsed() {} + const char* what() const noexcept override { + return "overloaded comma operator of matcher was used"; + } +}; + +struct EvilMatcher : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { return "equals: 45"; } + + bool match( int i ) const { return i == 45; } + + EvilMatcher const* operator&() const { throw EvilAddressOfOperatorUsed(); } + + int operator,( EvilMatcher const& ) const { throw EvilCommaOperatorUsed(); } +}; + +TEST_CASE( "Overloaded comma or address-of operators are not used", + "[matchers][templated]" ) { + REQUIRE_THROWS_AS( ( EvilMatcher(), EvilMatcher() ), + EvilCommaOperatorUsed ); + REQUIRE_THROWS_AS( &EvilMatcher(), EvilAddressOfOperatorUsed ); + REQUIRE_NOTHROW( EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) ); + REQUIRE_NOTHROW( ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() ); +} + +struct ImmovableMatcher : Catch::Matchers::MatcherGenericBase { + ImmovableMatcher() = default; + ImmovableMatcher( ImmovableMatcher const& ) = delete; + ImmovableMatcher( ImmovableMatcher&& ) = delete; + ImmovableMatcher& operator=( ImmovableMatcher const& ) = delete; + ImmovableMatcher& operator=( ImmovableMatcher&& ) = delete; + + std::string describe() const override { return "always false"; } + + template bool match( T&& ) const { return false; } +}; + +struct MatcherWasMovedOrCopied : std::exception { + MatcherWasMovedOrCopied() {} + const char* what() const noexcept override { + return "attempted to copy or move a matcher"; + } +}; + +struct ThrowOnCopyOrMoveMatcher : Catch::Matchers::MatcherGenericBase { + ThrowOnCopyOrMoveMatcher() = default; + [[noreturn]] ThrowOnCopyOrMoveMatcher( ThrowOnCopyOrMoveMatcher const& ): + Catch::Matchers::MatcherGenericBase() { + throw MatcherWasMovedOrCopied(); + } + [[noreturn]] ThrowOnCopyOrMoveMatcher( ThrowOnCopyOrMoveMatcher&& ): + Catch::Matchers::MatcherGenericBase() { + throw MatcherWasMovedOrCopied(); + } + ThrowOnCopyOrMoveMatcher& operator=( ThrowOnCopyOrMoveMatcher const& ) { + throw MatcherWasMovedOrCopied(); + } + ThrowOnCopyOrMoveMatcher& operator=( ThrowOnCopyOrMoveMatcher&& ) { + throw MatcherWasMovedOrCopied(); } - TEST_CASE("Combining MatchAnyOfGeneric does not nest", "[matchers][templated]") { - // MatchAnyOfGeneric LHS + some matcher RHS - STATIC_REQUIRE(std::is_same< - decltype((MatcherA() || MatcherB()) || MatcherC()), - Catch::Matchers::Detail::MatchAnyOfGeneric - >::value); + std::string describe() const override { return "always false"; } - REQUIRE_THAT(1, (MatcherA() || MatcherB()) || MatcherC()); + template bool match( T&& ) const { return false; } +}; - // some matcher LHS + MatchAnyOfGeneric RHS - STATIC_REQUIRE(std::is_same< - decltype(MatcherA() || (MatcherB() || MatcherC())), - Catch::Matchers::Detail::MatchAnyOfGeneric - >::value); +TEST_CASE( "Matchers are not moved or copied", + "[matchers][templated][approvals]" ) { + REQUIRE_NOTHROW( + ( ThrowOnCopyOrMoveMatcher() && ThrowOnCopyOrMoveMatcher() ) || + !ThrowOnCopyOrMoveMatcher() ); +} - REQUIRE_THAT(1, MatcherA() || (MatcherB() || MatcherC())); +TEST_CASE( "Immovable matchers can be used", + "[matchers][templated][approvals]" ) { + REQUIRE_THAT( 123, + ( ImmovableMatcher() && ImmovableMatcher() ) || + !ImmovableMatcher() ); +} +struct ReferencingMatcher : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { return "takes reference"; } + bool match( int& i ) const { return i == 22; } +}; - // MatchAnyOfGeneric LHS + MatchAnyOfGeneric RHS - STATIC_REQUIRE(std::is_same< - decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD())), - Catch::Matchers::Detail::MatchAnyOfGeneric - >::value); - - REQUIRE_THAT(1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD())); - } - - TEST_CASE("Combining MatchAllOfGeneric does not nest", "[matchers][templated]") { - // MatchAllOfGeneric lhs + some matcher RHS - STATIC_REQUIRE(std::is_same< - decltype((MatcherA() && MatcherB()) && MatcherC()), - Catch::Matchers::Detail::MatchAllOfGeneric - >::value); - - REQUIRE_THAT(1, (MatcherA() && MatcherB()) && MatcherC()); - - // some matcher LHS + MatchAllOfGeneric RSH - STATIC_REQUIRE(std::is_same< - decltype(MatcherA() && (MatcherB() && MatcherC())), - Catch::Matchers::Detail::MatchAllOfGeneric - >::value); - - REQUIRE_THAT(1, MatcherA() && (MatcherB() && MatcherC())); - - - // MatchAllOfGeneric LHS + MatchAllOfGeneric RHS - STATIC_REQUIRE(std::is_same< - decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD())), - Catch::Matchers::Detail::MatchAllOfGeneric - >::value); - - REQUIRE_THAT(1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD())); - } - - TEST_CASE("Combining MatchNotOfGeneric does not nest", "[matchers][templated]") { - STATIC_REQUIRE(std::is_same< - decltype(!MatcherA()), - Catch::Matchers::Detail::MatchNotOfGeneric - >::value); - - REQUIRE_THAT(0, !MatcherA()); - - STATIC_REQUIRE(std::is_same< - decltype(!!MatcherA()), - MatcherA const& - >::value); - - REQUIRE_THAT(1, !!MatcherA()); - - STATIC_REQUIRE(std::is_same< - decltype(!!!MatcherA()), - Catch::Matchers::Detail::MatchNotOfGeneric - >::value); - - REQUIRE_THAT(0, !!!MatcherA()); - - STATIC_REQUIRE(std::is_same< - decltype(!!!!MatcherA()), - MatcherA const & - >::value); - - REQUIRE_THAT(1, !!!!MatcherA()); - } - - struct EvilAddressOfOperatorUsed : std::exception { - EvilAddressOfOperatorUsed() {} - const char* what() const noexcept override { - return "overloaded address-of operator of matcher was used instead of std::addressof"; - } - }; - - struct EvilCommaOperatorUsed : std::exception { - EvilCommaOperatorUsed() {} - const char* what() const noexcept override { - return "overloaded comma operator of matcher was used"; - } - }; - - struct EvilMatcher : Catch::Matchers::MatcherGenericBase { - std::string describe() const override { - return "equals: 45"; - } - - bool match(int i) const { - return i == 45; - } - - EvilMatcher const* operator& () const { - throw EvilAddressOfOperatorUsed(); - } - - int operator,(EvilMatcher const&) const { - throw EvilCommaOperatorUsed(); - } - }; - - TEST_CASE("Overloaded comma or address-of operators are not used", "[matchers][templated]") { - REQUIRE_THROWS_AS((EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed); - REQUIRE_THROWS_AS(&EvilMatcher(), EvilAddressOfOperatorUsed); - REQUIRE_NOTHROW(EvilMatcher() || (EvilMatcher() && !EvilMatcher())); - REQUIRE_NOTHROW((EvilMatcher() && EvilMatcher()) || !EvilMatcher()); - } - - struct ImmovableMatcher : Catch::Matchers::MatcherGenericBase { - ImmovableMatcher() = default; - ImmovableMatcher(ImmovableMatcher const&) = delete; - ImmovableMatcher(ImmovableMatcher &&) = delete; - ImmovableMatcher& operator=(ImmovableMatcher const&) = delete; - ImmovableMatcher& operator=(ImmovableMatcher &&) = delete; - - std::string describe() const override { - return "always false"; - } - - template - bool match(T&&) const { - return false; - } - }; - - struct MatcherWasMovedOrCopied : std::exception { - MatcherWasMovedOrCopied() {} - const char* what() const noexcept override { - return "attempted to copy or move a matcher"; - } - }; - - struct ThrowOnCopyOrMoveMatcher : Catch::Matchers::MatcherGenericBase { - ThrowOnCopyOrMoveMatcher() = default; - [[noreturn]] - ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher const&): Catch::Matchers::MatcherGenericBase() { - throw MatcherWasMovedOrCopied(); - } - [[noreturn]] - ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher &&): Catch::Matchers::MatcherGenericBase() { - throw MatcherWasMovedOrCopied(); - } - ThrowOnCopyOrMoveMatcher& operator=(ThrowOnCopyOrMoveMatcher const&) { - throw MatcherWasMovedOrCopied(); - } - ThrowOnCopyOrMoveMatcher& operator=(ThrowOnCopyOrMoveMatcher &&) { - throw MatcherWasMovedOrCopied(); - } - - std::string describe() const override { - return "always false"; - } - - template - bool match(T&&) const { - return false; - } - }; - - TEST_CASE("Matchers are not moved or copied", "[matchers][templated][approvals]") { - REQUIRE_NOTHROW((ThrowOnCopyOrMoveMatcher() && ThrowOnCopyOrMoveMatcher()) || !ThrowOnCopyOrMoveMatcher()); - } - - TEST_CASE("Immovable matchers can be used", "[matchers][templated][approvals]") { - REQUIRE_THAT(123, (ImmovableMatcher() && ImmovableMatcher()) || !ImmovableMatcher()); - } - - struct ReferencingMatcher : Catch::Matchers::MatcherGenericBase { - std::string describe() const override { - return "takes reference"; - } - bool match(int& i) const { - return i == 22; - } - }; - - TEST_CASE("Matchers can take references", "[matchers][templated][approvals]") { - REQUIRE_THAT(22, ReferencingMatcher{}); - } - -} } // namespace MatchersTests +TEST_CASE( "Matchers can take references", + "[matchers][templated][approvals]" ) { + REQUIRE_THAT( 22, ReferencingMatcher{} ); +} #ifdef __clang__ -#pragma clang diagnostic pop +# pragma clang diagnostic pop #endif diff --git a/tests/SelfTest/UsageTests/Misc.tests.cpp b/tests/SelfTest/UsageTests/Misc.tests.cpp index 5dfef6b1..ee4444f5 100644 --- a/tests/SelfTest/UsageTests/Misc.tests.cpp +++ b/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -19,60 +19,58 @@ #include #include -namespace { namespace MiscTests { +namespace { -#ifndef MISC_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU -#define MISC_TEST_HELPERS_INCLUDED - -inline const char* makeString( bool makeNull ) { - return makeNull ? nullptr : "valid string"; -} -inline bool testCheckedIf( bool flag ) { - CHECKED_IF( flag ) - return true; - else - return false; -} -inline bool testCheckedElse( bool flag ) { - CHECKED_ELSE( flag ) - return false; - - return true; -} - -inline unsigned int Factorial( unsigned int number ) { - return number > 1 ? Factorial(number-1)*number : 1; -} - -static int f() { - return 1; -} - -inline void manuallyRegisteredTestFunction() { - SUCCEED( "was called" ); -} - -struct AutoTestReg { - AutoTestReg() { - REGISTER_TEST_CASE( manuallyRegisteredTestFunction, "ManuallyRegistered" ); + static const char* makeString(bool makeNull) { + return makeNull ? nullptr : "valid string"; } -}; + static bool testCheckedIf(bool flag) { + CHECKED_IF(flag) + return true; + else + return false; + } + static bool testCheckedElse(bool flag) { + CHECKED_ELSE(flag) + return false; -CATCH_INTERNAL_START_WARNINGS_SUPPRESSION -CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS -static AutoTestReg autoTestReg; -CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + return true; + } -template -struct Foo { - size_t size() { return 0; } -}; + static unsigned int Factorial(unsigned int number) { + return number > 1 ? Factorial(number - 1) * number : 1; + } -template -struct Bar { - size_t size() { return S; } -}; -#endif + static int f() { + return 1; + } + + static void manuallyRegisteredTestFunction() { + SUCCEED("was called"); + } + + struct AutoTestReg { + AutoTestReg() { + REGISTER_TEST_CASE(manuallyRegisteredTestFunction, "ManuallyRegistered"); + } + }; + + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS + static AutoTestReg autoTestReg; + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + + template + struct Foo { + size_t size() { return 0; } + }; + + template + struct Bar { + size_t size() { return S; } + }; + +} TEST_CASE( "random SECTION tests", "[.][sections][failing]" ) { int a = 1; @@ -521,5 +519,3 @@ TEMPLATE_TEST_CASE_SIG("#1954 - 7 arg template test case sig compiles", "[regres (1, 1, 1, 1, 1, 0, 0), (5, 1, 1, 1, 1, 0, 0), (5, 3, 1, 1, 1, 0, 0)) { SUCCEED(); } - -}} // namespace MiscTests