diff --git a/CMake/CatchMiscFunctions.cmake b/CMake/CatchMiscFunctions.cmake index ce66542b..73c8b4dd 100644 --- a/CMake/CatchMiscFunctions.cmake +++ b/CMake/CatchMiscFunctions.cmake @@ -56,6 +56,7 @@ function(add_warnings_to_targets targets) "-Wexit-time-destructors" "-Wextra" "-Wextra-semi" + "-Wfloat-equal" "-Wglobal-constructors" "-Winit-self" "-Wmisleading-indentation" diff --git a/src/catch2/benchmark/detail/catch_stats.cpp b/src/catch2/benchmark/detail/catch_stats.cpp index 10511d4c..02350806 100644 --- a/src/catch2/benchmark/detail/catch_stats.cpp +++ b/src/catch2/benchmark/detail/catch_stats.cpp @@ -137,6 +137,15 @@ namespace Catch { namespace Benchmark { namespace Detail { +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + bool directCompare( double lhs, double rhs ) { return lhs == rhs; } +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic pop +#endif + double weighted_average_quantile(int k, int q, std::vector::iterator first, std::vector::iterator last) { auto count = last - first; double idx = (count - 1) * k / static_cast(q); @@ -144,7 +153,9 @@ namespace Catch { double g = idx - j; std::nth_element(first, first + j, last); auto xj = first[j]; - if (g == 0) return xj; + if ( directCompare( g, 0 ) ) { + return xj; + } auto xj1 = *std::min_element(first + (j + 1), last); return xj + g * (xj1 - xj); diff --git a/src/catch2/benchmark/detail/catch_stats.hpp b/src/catch2/benchmark/detail/catch_stats.hpp index 998616e1..db93fa29 100644 --- a/src/catch2/benchmark/detail/catch_stats.hpp +++ b/src/catch2/benchmark/detail/catch_stats.hpp @@ -24,6 +24,10 @@ namespace Catch { namespace Detail { using sample = std::vector; + // Used when we know we want == comparison of two doubles + // to centralize warning suppression + bool directCompare( double lhs, double rhs ); + double weighted_average_quantile(int k, int q, std::vector::iterator first, std::vector::iterator last); template @@ -103,7 +107,9 @@ namespace Catch { long n = static_cast(resample.size()); double prob_n = std::count_if(resample.begin(), resample.end(), [point](double x) { return x < point; }) / static_cast(n); // degenerate case with uniform samples - if (prob_n == 0) return { point, point, point, confidence_level }; + if ( directCompare( prob_n, 0. ) ) { + return { point, point, point, confidence_level }; + } double bias = normal_quantile(prob_n); double z1 = normal_quantile((1. - confidence_level) / 2.); diff --git a/src/catch2/internal/catch_floating_point_helpers.hpp b/src/catch2/internal/catch_floating_point_helpers.hpp index 3e73b3a7..f1212813 100644 --- a/src/catch2/internal/catch_floating_point_helpers.hpp +++ b/src/catch2/internal/catch_floating_point_helpers.hpp @@ -10,6 +10,7 @@ #include +#include #include #include #include @@ -24,6 +25,15 @@ namespace Catch { } // end namespace Detail + +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic push + // We do a bunch of direct compensations of floating point numbers, + // because we know what we are doing and actually do want the direct + // comparison behaviour. +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + /** * Calculates the ULP distance between two floating point numbers * @@ -83,6 +93,11 @@ namespace Catch { return lc - rc; } +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic pop +#endif + + } // end namespace Catch #endif // CATCH_FLOATING_POINT_HELPERS_HPP_INCLUDED diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 7221ac6a..1d2bf38b 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -396,32 +396,32 @@ Using code: 0 C " 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: 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (string) "1" 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: 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (string) "1" 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: 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" 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: 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" 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: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" 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: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" 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: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) 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: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) 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: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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" ) diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 6945b6be..fbce2de2 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -394,32 +394,32 @@ Using code: 0 C " 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: 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (string) "1" 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: 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (string) "1" 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: 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" 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: 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" 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: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" 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: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" 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: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) 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: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) 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: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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" ) diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index d4a434cc..ae8af438 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -3096,7 +3096,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) Matchers.tests.cpp:: PASSED: @@ -3107,7 +3107,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) Matchers.tests.cpp:: PASSED: @@ -3119,7 +3119,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) ------------------------------------------------------------------------------- @@ -3136,7 +3136,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) Matchers.tests.cpp:: PASSED: @@ -3147,7 +3147,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) Matchers.tests.cpp:: PASSED: @@ -3159,7 +3159,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) ------------------------------------------------------------------------------- @@ -3176,7 +3176,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !MatcherA() ) with expansion: - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" Matchers.tests.cpp:: PASSED: with message: @@ -3185,7 +3185,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!MatcherA() ) with expansion: - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" Matchers.tests.cpp:: PASSED: with message: @@ -3195,7 +3195,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !!!MatcherA() ) with expansion: - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" Matchers.tests.cpp:: PASSED: with message: @@ -3204,7 +3204,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!!!MatcherA() ) with expansion: - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" ------------------------------------------------------------------------------- Combining concrete matchers does not use templated matchers @@ -3232,7 +3232,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || MatcherB() ) with expansion: - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) Matchers.tests.cpp:: PASSED: with message: @@ -3242,7 +3242,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() && MatcherB() ) with expansion: - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) Matchers.tests.cpp:: PASSED: with message: @@ -3253,7 +3253,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || !MatcherB() ) with expansion: - 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) ------------------------------------------------------------------------------- Combining templated and concrete matchers diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index 97b95f13..3ae6d321 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -3094,7 +3094,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) Matchers.tests.cpp:: PASSED: @@ -3105,7 +3105,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) Matchers.tests.cpp:: PASSED: @@ -3117,7 +3117,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) ------------------------------------------------------------------------------- @@ -3134,7 +3134,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) Matchers.tests.cpp:: PASSED: @@ -3145,7 +3145,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) Matchers.tests.cpp:: PASSED: @@ -3157,7 +3157,7 @@ with message: Matchers.tests.cpp:: PASSED: 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 + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) ------------------------------------------------------------------------------- @@ -3174,7 +3174,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !MatcherA() ) with expansion: - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" Matchers.tests.cpp:: PASSED: with message: @@ -3183,7 +3183,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!MatcherA() ) with expansion: - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" Matchers.tests.cpp:: PASSED: with message: @@ -3193,7 +3193,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !!!MatcherA() ) with expansion: - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" Matchers.tests.cpp:: PASSED: with message: @@ -3202,7 +3202,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!!!MatcherA() ) with expansion: - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" ------------------------------------------------------------------------------- Combining concrete matchers does not use templated matchers @@ -3230,7 +3230,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || MatcherB() ) with expansion: - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) Matchers.tests.cpp:: PASSED: with message: @@ -3240,7 +3240,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() && MatcherB() ) with expansion: - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) Matchers.tests.cpp:: PASSED: with message: @@ -3251,7 +3251,7 @@ with message: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || !MatcherB() ) with expansion: - 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) ------------------------------------------------------------------------------- Combining templated and concrete matchers diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index ed0d9e0c..b032e98a 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -740,57 +740,57 @@ ok {test-number} - streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC # Combining MatchAllOfGeneric does not nest 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 (string) "1" 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' # 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 (string) "1" 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' # 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 (string) "1" 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' # 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 (string) "1" 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' # 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 (string) "1" 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' # 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 (string) "1" 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' # Combining MatchNotOfGeneric does not nest -ok {test-number} - 0, !MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f +ok {test-number} - 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest 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 +ok {test-number} - 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest 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 +ok {test-number} - 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest 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 +ok {test-number} - 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" # Combining concrete matchers does not use templated matchers ok {test-number} - with 1 message: 'std::is_same>::value' # Combining only templated matchers 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 ) +ok {test-number} - 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) # Combining only templated matchers 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 ) +ok {test-number} - 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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< 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 ) +ok {test-number} - 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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 } ) # Combining templated and concrete matchers diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 874a825c..6118bddc 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -738,57 +738,57 @@ ok {test-number} - streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC # Combining MatchAllOfGeneric does not nest 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 (string) "1" 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' # 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 (string) "1" 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' # 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 (string) "1" 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' # 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 (string) "1" 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' # 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 (string) "1" 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' # 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 (string) "1" 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' # Combining MatchNotOfGeneric does not nest -ok {test-number} - 0, !MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f +ok {test-number} - 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest 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 +ok {test-number} - 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest 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 +ok {test-number} - 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest 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 +ok {test-number} - 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" # Combining concrete matchers does not use templated matchers ok {test-number} - with 1 message: 'std::is_same>::value' # Combining only templated matchers 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 ) +ok {test-number} - 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) # Combining only templated matchers 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 ) +ok {test-number} - 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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< 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 ) +ok {test-number} - 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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 } ) # Combining templated and concrete matchers diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 1dad9f6f..c541226a 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -3374,7 +3374,7 @@ C 1, ( MatcherA() && MatcherB() ) && MatcherC() - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) @@ -3382,7 +3382,7 @@ C 1, MatcherA() && ( MatcherB() && MatcherC() ) - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) @@ -3390,7 +3390,7 @@ C 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 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) @@ -3401,7 +3401,7 @@ C 1, ( MatcherA() || MatcherB() ) || MatcherC() - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) @@ -3409,7 +3409,7 @@ C 1, MatcherA() || ( MatcherB() || MatcherC() ) - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) @@ -3417,7 +3417,7 @@ C 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 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) @@ -3428,7 +3428,7 @@ C 0, !MatcherA() - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" @@ -3436,7 +3436,7 @@ C 1, !!MatcherA() - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" @@ -3444,7 +3444,7 @@ C 0, !!!MatcherA() - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" @@ -3452,7 +3452,7 @@ C 1, !!!!MatcherA() - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" @@ -3466,7 +3466,7 @@ C 1, MatcherA() || MatcherB() - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) @@ -3474,7 +3474,7 @@ C 1, MatcherA() && MatcherB() - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) @@ -3482,7 +3482,7 @@ C 1, MatcherA() || !MatcherB() - 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 6e432e40..29222820 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -3374,7 +3374,7 @@ C 1, ( MatcherA() && MatcherB() ) && MatcherC() - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) @@ -3382,7 +3382,7 @@ C 1, MatcherA() && ( MatcherB() && MatcherC() ) - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) @@ -3390,7 +3390,7 @@ C 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 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) @@ -3401,7 +3401,7 @@ C 1, ( MatcherA() || MatcherB() ) || MatcherC() - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) @@ -3409,7 +3409,7 @@ C 1, MatcherA() || ( MatcherB() || MatcherC() ) - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) @@ -3417,7 +3417,7 @@ C 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 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) @@ -3428,7 +3428,7 @@ C 0, !MatcherA() - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" @@ -3436,7 +3436,7 @@ C 1, !!MatcherA() - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" @@ -3444,7 +3444,7 @@ C 0, !!!MatcherA() - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" @@ -3452,7 +3452,7 @@ C 1, !!!!MatcherA() - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" @@ -3466,7 +3466,7 @@ C 1, MatcherA() || MatcherB() - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) @@ -3474,7 +3474,7 @@ C 1, MatcherA() && MatcherB() - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) @@ -3482,7 +3482,7 @@ C 1, MatcherA() || !MatcherB() - 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) diff --git a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp index b25de054..2aad184d 100644 --- a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -6,6 +6,10 @@ // SPDX-License-Identifier: BSL-1.0 +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + #include #include #include diff --git a/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp b/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp index ead52356..f51f7bd9 100644 --- a/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp @@ -7,6 +7,12 @@ // SPDX-License-Identifier: BSL-1.0 // Adapted from donated nonius code. + +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + + #include #include #include @@ -283,8 +289,8 @@ TEST_CASE("analyse", "[approvals][benchmark]") { } auto analysis = Catch::Benchmark::Detail::analyse(config, env, samples.begin(), samples.end()); - CHECK(analysis.mean.point.count() == 23); - CHECK(analysis.mean.lower_bound.count() < 23); + CHECK( analysis.mean.point.count() == 23 ); + CHECK( analysis.mean.lower_bound.count() < 23 ); CHECK(analysis.mean.lower_bound.count() > 22); CHECK(analysis.mean.upper_bound.count() > 23); CHECK(analysis.mean.upper_bound.count() < 24); diff --git a/tests/SelfTest/UsageTests/Class.tests.cpp b/tests/SelfTest/UsageTests/Class.tests.cpp index 128f8711..2bdc8d81 100644 --- a/tests/SelfTest/UsageTests/Class.tests.cpp +++ b/tests/SelfTest/UsageTests/Class.tests.cpp @@ -6,6 +6,10 @@ // SPDX-License-Identifier: BSL-1.0 +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + #include #include #include diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp index afb12495..5b4e9e03 100644 --- a/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -845,10 +845,10 @@ TEST_CASE( "Combining concrete matchers does not use templated matchers", struct MatcherA : Catch::Matchers::MatcherGenericBase { std::string describe() const override { - return "equals: (int) 1 or (float) 1.0f"; + return "equals: (int) 1 or (string) \"1\""; } bool match( int i ) const { return i == 1; } - bool match( float f ) const { return f == 1.0f; } + bool match( std::string s ) const { return s == "1"; } }; struct MatcherB : Catch::Matchers::MatcherGenericBase {