Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-05-14 15:37:39 +0200
committerMartin Hořeňovský2022-05-14 15:47:20 +0200
commitfc3d11b1d1090a5bcbcc9e410a460f9bf6a1f474 (patch)
tree226e86969f762eb65eb41877413f9578c79c1cfe
parent1ef65d60f182059297cb07498ca211884a868c48 (diff)
downloadcatch3-fc3d11b1d1090a5bcbcc9e410a460f9bf6a1f474.tar.gz
Add Wfloat-equal to default-enabled warnings
This is kinda messy, because there is no good way to signal to the compiler that some code uses direct comparison of floating point numbers intentionally, so instead we have to use diagnostic pragmas. We also have to over-suppress the test files, because Clang (and possibly GCC) still issue warnings from template instantiation even if the instantion site is under warning suppression, so the template definition has to be under warning suppression as well. Closes #2406
-rw-r--r--CMake/CatchMiscFunctions.cmake1
-rw-r--r--src/catch2/benchmark/detail/catch_stats.cpp13
-rw-r--r--src/catch2/benchmark/detail/catch_stats.hpp8
-rw-r--r--src/catch2/internal/catch_floating_point_helpers.hpp15
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt26
-rw-r--r--tests/SelfTest/Baselines/compact.sw.multi.approved.txt26
-rw-r--r--tests/SelfTest/Baselines/console.sw.approved.txt26
-rw-r--r--tests/SelfTest/Baselines/console.sw.multi.approved.txt26
-rw-r--r--tests/SelfTest/Baselines/tap.sw.approved.txt26
-rw-r--r--tests/SelfTest/Baselines/tap.sw.multi.approved.txt26
-rw-r--r--tests/SelfTest/Baselines/xml.sw.approved.txt26
-rw-r--r--tests/SelfTest/Baselines/xml.sw.multi.approved.txt26
-rw-r--r--tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp4
-rw-r--r--tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp10
-rw-r--r--tests/SelfTest/UsageTests/Class.tests.cpp4
-rw-r--r--tests/SelfTest/UsageTests/Matchers.tests.cpp4
16 files changed, 157 insertions, 110 deletions
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<double>::iterator first, std::vector<double>::iterator last) {
auto count = last - first;
double idx = (count - 1) * k / static_cast<double>(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<double>;
+ // 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<double>::iterator first, std::vector<double>::iterator last);
template <typename Iterator>
@@ -103,7 +107,9 @@ namespace Catch {
long n = static_cast<long>(resample.size());
double prob_n = std::count_if(resample.begin(), resample.end(), [point](double x) { return x < point; }) / static_cast<double>(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 <catch2/internal/catch_polyfills.hpp>
+#include <cassert>
#include <cmath>
#include <cstdint>
#include <utility>
@@ -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:<line number>: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric<MatcherA, MatcherB, MatcherC>>::value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric<MatcherA, MatcherB, MatcherC>>::value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD>>:: value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC>>::value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC>>::value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD>>:: value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA>>::value'
-Matchers.tests.cpp:<line number>: passed: 0, !MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f
+Matchers.tests.cpp:<line number>: passed: 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1"
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( !!MatcherA() ), MatcherA const&>::value'
-Matchers.tests.cpp:<line number>: passed: 1, !!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f
+Matchers.tests.cpp:<line number>: passed: 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1"
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA>>::value'
-Matchers.tests.cpp:<line number>: passed: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f
+Matchers.tests.cpp:<line number>: passed: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1"
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( !!!!MatcherA() ), MatcherA const&>::value'
-Matchers.tests.cpp:<line number>: passed: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f
+Matchers.tests.cpp:<line number>: passed: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1"
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( StartsWith( "foo" ) || ( StartsWith( "bar" ) && EndsWith( "bar" ) && !EndsWith( "foo" ) ) ), Catch::Matchers::Detail::MatchAnyOf<std::string>>::value'
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( MatcherA() || MatcherB() ), Catch::Matchers::Detail:: MatchAnyOfGeneric<MatcherA, MatcherB>>::value'
-Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 )
+Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 )
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( MatcherA() && MatcherB() ), Catch::Matchers::Detail:: MatchAllOfGeneric<MatcherA, MatcherB>>::value'
-Matchers.tests.cpp:<line number>: passed: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 )
+Matchers.tests.cpp:<line number>: passed: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 )
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric<MatcherB>>>::value'
-Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 )
+Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 )
Matchers.tests.cpp:<line number>: passed: 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 ) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } )
Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric<MatcherA, MatcherB, MatcherC>>::value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric<MatcherA, MatcherB, MatcherC>>::value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD>>:: value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC>>::value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC>>::value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD>>:: value'
-Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: passed: with 1 message: 'std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA>>::value'
-Matchers.tests.cpp:<line number>: passed: 0, !MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f
+Matchers.tests.cpp:<line number>: passed: 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1"
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( !!MatcherA() ), MatcherA const&>::value'
-Matchers.tests.cpp:<line number>: passed: 1, !!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f
+Matchers.tests.cpp:<line number>: passed: 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1"
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA>>::value'
-Matchers.tests.cpp:<line number>: passed: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f
+Matchers.tests.cpp:<line number>: passed: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1"
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( !!!!MatcherA() ), MatcherA const&>::value'
-Matchers.tests.cpp:<line number>: passed: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f
+Matchers.tests.cpp:<line number>: passed: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1"
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( StartsWith( "foo" ) || ( StartsWith( "bar" ) && EndsWith( "bar" ) && !EndsWith( "foo" ) ) ), Catch::Matchers::Detail::MatchAnyOf<std::string>>::value'
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( MatcherA() || MatcherB() ), Catch::Matchers::Detail:: MatchAnyOfGeneric<MatcherA, MatcherB>>::value'
-Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 )
+Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 )
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same<decltype( MatcherA() && MatcherB() ), Catch::Matchers::Detail:: MatchAllOfGeneric<MatcherA, MatcherB>>::value'
-Matchers.tests.cpp:<line number>: passed: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 )
+Matchers.tests.cpp:<line number>: passed: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 )
Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric<MatcherB>>>::value'
-Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 )
+Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 )
Matchers.tests.cpp:<line number>: passed: 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 ) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } )
Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: 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:<line number>: PASSED:
@@ -3107,7 +3107,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
@@ -3119,7 +3119,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: PASSED:
@@ -3147,7 +3147,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
@@ -3159,7 +3159,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: PASSED:
with message:
@@ -3185,7 +3185,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
with message:
@@ -3195,7 +3195,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
with message:
@@ -3204,7 +3204,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: PASSED:
with message:
@@ -3242,7 +3242,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
with message:
@@ -3253,7 +3253,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: PASSED:
@@ -3105,7 +3105,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
@@ -3117,7 +3117,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: PASSED:
@@ -3145,7 +3145,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
@@ -3157,7 +3157,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: PASSED:
with message:
@@ -3183,7 +3183,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
with message:
@@ -3193,7 +3193,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
with message:
@@ -3202,7 +3202,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: 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:<line number>: PASSED:
with message:
@@ -3240,7 +3240,7 @@ with message:
Matchers.tests.cpp:<line number>: 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:<line number>: PASSED:
with message:
@@ -3251,7 +3251,7 @@ with message:
Matchers.tests.cpp:<line number>: 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<MatcherA, MatcherB, MatcherC>>::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<MatcherA, MatcherB, MatcherC>>::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<MatcherA, MatcherB, MatcherC, MatcherD>>:: 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<MatcherA, MatcherB, MatcherC>>::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<MatcherA, MatcherB, MatcherC>>::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<MatcherA, MatcherB, Mat