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

summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-03-18 20:59:25 +0100
committerMartin Hořeňovský2020-04-29 21:27:57 +0200
commit60cfaa38fbd7a9a0fa2366e70367aef3696efc73 (patch)
tree6687b0c01a3813858e88b508fcbdb3d9a6b9e656 /tests
parent38a0dfca6d9e6d62098b80d4f87ad56cf135b09e (diff)
downloadcatch3-60cfaa38fbd7a9a0fa2366e70367aef3696efc73.tar.gz
Make warnings in assertions fire for GCC/Clang again
The old code caused warnings to fire under MSVC, and Clang <3.8. I could not find a GCC version where it worked, but I assume that it did at some point. This new code causes all of MSVC, GCC, Clang, in current versions, to emit signed/unsigned comparison warning in test like this: ```cpp TEST_CASE() { int32_t i = -1; uint32_t j = 1; REQUIRE(i != j); } ``` Where previously only MSVC would emit the warning. Fixes #1880
Diffstat (limited to 'tests')
-rw-r--r--tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp2
-rw-r--r--tests/SelfTest/UsageTests/Compilation.tests.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp b/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp
index 50c17169..0a3895a8 100644
--- a/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp
@@ -300,7 +300,7 @@ TEST_CASE("analyse", "[approvals][benchmark]") {
CHECK(analysis.outliers.low_severe == 0);
CHECK(analysis.outliers.high_mild == 0);
CHECK(analysis.outliers.high_severe == 0);
- CHECK(analysis.outliers.samples_seen == samples.size());
+ CHECK(analysis.outliers.samples_seen == static_cast<int>(samples.size()));
CHECK(analysis.outlier_variance < 0.5);
CHECK(analysis.outlier_variance > 0);
diff --git a/tests/SelfTest/UsageTests/Compilation.tests.cpp b/tests/SelfTest/UsageTests/Compilation.tests.cpp
index 1c43c1c3..839a1662 100644
--- a/tests/SelfTest/UsageTests/Compilation.tests.cpp
+++ b/tests/SelfTest/UsageTests/Compilation.tests.cpp
@@ -202,10 +202,19 @@ namespace { namespace CompilationTests {
inline static void synchronizing_callback( void * ) { }
}
+#if defined (_MSC_VER)
+#pragma warning(push)
+// The function pointer comparison below triggers warning because of
+// calling conventions
+#pragma warning(disable:4244)
+#endif
TEST_CASE("#925: comparing function pointer to function address failed to compile", "[!nonportable]" ) {
TestClass test;
REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg);
}
+#if defined (_MSC_VER)
+#pragma warning(pop)
+#endif
TEST_CASE( "#1027: Bitfields can be captured" ) {
struct Y {