diff options
| author | Martin Hořeňovský | 2018-10-13 21:29:59 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2018-10-16 16:16:00 +0200 |
| commit | 054d356332a05ce3590b256597105e1f564c4ea9 (patch) | |
| tree | 215e6bd22dddce4d4d173b5bedbd0a86ef47e2a1 /projects/SelfTest/UsageTests/Compilation.tests.cpp | |
| parent | 0144ae9ad2c6543fef50bba206f65edf947b55d1 (diff) | |
| download | catch3-054d356332a05ce3590b256597105e1f564c4ea9.tar.gz | |
Add STATIC_REQUIRE assertion
By default, it expands into a `static_assert` + `SUCCEED` pair, but
it can also be deferred to runtime by defining
`CATCH_CONFIG_RUNTIME_STATIC_REQUIRE`, which causes it to expand
into plain old `REQUIRE`.
Closes #1362
Closes #1356
Diffstat (limited to 'projects/SelfTest/UsageTests/Compilation.tests.cpp')
| -rw-r--r-- | projects/SelfTest/UsageTests/Compilation.tests.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/projects/SelfTest/UsageTests/Compilation.tests.cpp b/projects/SelfTest/UsageTests/Compilation.tests.cpp index 91b65ca1..325a8142 100644 --- a/projects/SelfTest/UsageTests/Compilation.tests.cpp +++ b/projects/SelfTest/UsageTests/Compilation.tests.cpp @@ -5,13 +5,12 @@ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#include <type_traits> + // Setup for #1403 -- look for global overloads of operator << for classes // in a different namespace. - #include <ostream> - - namespace foo { struct helper_1403 { bool operator==(helper_1403) const { return true; } @@ -25,7 +24,7 @@ std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) { return out << "[1403 helper]"; } /////////////////////////////// - + #include "catch.hpp" #include <cstring> @@ -174,12 +173,17 @@ namespace { namespace CompilationTests { TEST_CASE_METHOD((Fixture_1245<int, int>), "#1245", "[compilation]") { SUCCEED(); } - + TEST_CASE("#1403", "[compilation]") { ::foo::helper_1403 h1, h2; REQUIRE(h1 == h2); } - + + TEST_CASE("Optionally static assertions", "[compilation]") { + STATIC_REQUIRE( std::is_void<void>::value ); + STATIC_REQUIRE_FALSE( std::is_void<int>::value ); + } + }} // namespace CompilationTests |