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

summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorMorwenn2021-11-15 00:28:27 +0100
committerGitHub2021-11-15 00:28:27 +0100
commitf41d76167431eeb0ae8e82703e5597769c0531b8 (patch)
treec8d12223841b561eee975fc5ba8a9043ca6fe6e7 /tests
parentedc2f6e8a35b6261e83db9c685f44cb3a4c24d04 (diff)
downloadcatch3-f41d76167431eeb0ae8e82703e5597769c0531b8.tar.gz
Add STATIC_CHECK and STATIC_CHECK_FALSE (#2318)
Diffstat (limited to 'tests')
-rw-r--r--tests/ExtraTests/X01-PrefixedMacros.cpp2
-rw-r--r--tests/ExtraTests/X02-DisabledMacros.cpp4
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/console.std.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/console.sw.approved.txt10
-rw-r--r--tests/SelfTest/Baselines/junit.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/tap.sw.approved.txt6
-rw-r--r--tests/SelfTest/Baselines/xml.sw.approved.txt2
-rw-r--r--tests/SelfTest/UsageTests/Compilation.tests.cpp2
9 files changed, 27 insertions, 5 deletions
diff --git a/tests/ExtraTests/X01-PrefixedMacros.cpp b/tests/ExtraTests/X01-PrefixedMacros.cpp
index 43452d76..9110bbba 100644
--- a/tests/ExtraTests/X01-PrefixedMacros.cpp
+++ b/tests/ExtraTests/X01-PrefixedMacros.cpp
@@ -62,6 +62,8 @@ CATCH_TEST_CASE("PrefixedMacros") {
CATCH_STATIC_REQUIRE( std::is_void<void>::value );
CATCH_STATIC_REQUIRE_FALSE( std::is_void<int>::value );
+ CATCH_STATIC_CHECK( std::is_void<void>::value );
+ CATCH_STATIC_CHECK_FALSE( std::is_void<int>::value );
CATCH_FAIL("");
}
diff --git a/tests/ExtraTests/X02-DisabledMacros.cpp b/tests/ExtraTests/X02-DisabledMacros.cpp
index c2d997c9..5a756d70 100644
--- a/tests/ExtraTests/X02-DisabledMacros.cpp
+++ b/tests/ExtraTests/X02-DisabledMacros.cpp
@@ -32,6 +32,10 @@ foo f;
TEST_CASE( "Disabled Macros" ) {
std::cout << "This should not happen\n";
FAIL();
+
+ // Test that static assertions don't fire when macros are disabled
+ STATIC_CHECK( 0 == 1 );
+ STATIC_REQUIRE( !true );
}
#if defined(__clang__)
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index e0dac422..3cd8ba4c 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -948,6 +948,8 @@ Tricky.tests.cpp:<line number>: passed: !False for: true
Tricky.tests.cpp:<line number>: passed: !(False) for: !{?}
Compilation.tests.cpp:<line number>: passed: with 1 message: 'std::is_void<void>::value'
Compilation.tests.cpp:<line number>: passed: with 1 message: '!(std::is_void<int>::value)'
+Compilation.tests.cpp:<line number>: passed: with 1 message: 'std::is_void<void>::value'
+Compilation.tests.cpp:<line number>: passed: with 1 message: '!(std::is_void<int>::value)'
Condition.tests.cpp:<line number>: failed: data.int_seven > 7 for: 7 > 7
Condition.tests.cpp:<line number>: failed: data.int_seven < 7 for: 7 < 7
Condition.tests.cpp:<line number>: failed: data.int_seven > 8 for: 7 > 8
diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt
index db80f75d..17f9d281 100644
--- a/tests/SelfTest/Baselines/console.std.approved.txt
+++ b/tests/SelfTest/Baselines/console.std.approved.txt
@@ -1427,5 +1427,5 @@ due to unexpected exception with message:
===============================================================================
test cases: 376 | 299 passed | 70 failed | 7 failed as expected
-assertions: 2147 | 1991 passed | 129 failed | 27 failed as expected
+assertions: 2149 | 1993 passed | 129 failed | 27 failed as expected
diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt
index 74c0df93..32654bc3 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -7320,6 +7320,14 @@ Compilation.tests.cpp:<line number>: PASSED:
with message:
!(std::is_void<int>::value)
+Compilation.tests.cpp:<line number>: PASSED:
+with message:
+ std::is_void<void>::value
+
+Compilation.tests.cpp:<line number>: PASSED:
+with message:
+ !(std::is_void<int>::value)
+
-------------------------------------------------------------------------------
Ordering comparison checks that should fail
-------------------------------------------------------------------------------
@@ -17268,5 +17276,5 @@ Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 376 | 283 passed | 86 failed | 7 failed as expected
-assertions: 2164 | 1991 passed | 146 failed | 27 failed as expected
+assertions: 2166 | 1993 passed | 146 failed | 27 failed as expected
diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt
index f4469f58..0047eb70 100644
--- a/tests/SelfTest/Baselines/junit.sw.approved.txt
+++ b/tests/SelfTest/Baselines/junit.sw.approved.txt
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
- <testsuite name="<exe-name>" errors="17" failures="129" tests="2164" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="129" tests="2166" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt
index 405d1108..087064df 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -1878,6 +1878,10 @@ ok {test-number} - !(False) for: !{?}
ok {test-number} - with 1 message: 'std::is_void<void>::value'
# Optionally static assertions
ok {test-number} - with 1 message: '!(std::is_void<int>::value)'
+# Optionally static assertions
+ok {test-number} - with 1 message: 'std::is_void<void>::value'
+# Optionally static assertions
+ok {test-number} - with 1 message: '!(std::is_void<int>::value)'
# Ordering comparison checks that should fail
not ok {test-number} - data.int_seven > 7 for: 7 > 7
# Ordering comparison checks that should fail
@@ -4330,5 +4334,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
-1..2164
+1..2166
diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt
index 2b5e3378..008cd139 100644
--- a/tests/SelfTest/Baselines/xml.sw.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.approved.txt
@@ -20238,6 +20238,6 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="1991" failures="146" expectedFailures="27"/>
+ <OverallResults successes="1993" failures="146" expectedFailures="27"/>
<OverallResultsCases successes="283" failures="86" expectedFailures="7"/>
</Catch2TestRun>
diff --git a/tests/SelfTest/UsageTests/Compilation.tests.cpp b/tests/SelfTest/UsageTests/Compilation.tests.cpp
index c40c09f8..866644e3 100644
--- a/tests/SelfTest/UsageTests/Compilation.tests.cpp
+++ b/tests/SelfTest/UsageTests/Compilation.tests.cpp
@@ -172,6 +172,8 @@ TEST_CASE("#1403", "[compilation]") {
TEST_CASE("Optionally static assertions", "[compilation]") {
STATIC_REQUIRE( std::is_void<void>::value );
STATIC_REQUIRE_FALSE( std::is_void<int>::value );
+ STATIC_CHECK( std::is_void<void>::value );
+ STATIC_CHECK_FALSE( std::is_void<int>::value );
}
TEST_CASE("#1548", "[compilation]") {