Add STATIC_CHECK and STATIC_CHECK_FALSE (#2318)

This commit is contained in:
Morwenn
2021-11-15 00:28:27 +01:00
committed by GitHub
parent edc2f6e8a3
commit f41d761674
11 changed files with 55 additions and 7 deletions

View File

@@ -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("");
}

View File

@@ -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__)