mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Add STATIC_CHECK and STATIC_CHECK_FALSE (#2318)
This commit is contained in:
		| @@ -59,9 +59,9 @@ TEST_CASE( "SUCCEED showcase" ) { | ||||
| } | ||||
| ``` | ||||
|  | ||||
| * `STATIC_REQUIRE` | ||||
| * `STATIC_REQUIRE` and `STATIC_CHECK` | ||||
|  | ||||
| > [Introduced](https://github.com/catchorg/Catch2/issues/1362) in Catch2 2.4.2. | ||||
| > `STATIC_REQUIRE` was [introduced](https://github.com/catchorg/Catch2/issues/1362) in Catch2 2.4.2. | ||||
|  | ||||
| `STATIC_REQUIRE( expr )` is a macro that can be used the same way as a | ||||
| `static_assert`, but also registers the success with Catch2, so it is | ||||
| @@ -77,6 +77,20 @@ TEST_CASE("STATIC_REQUIRE showcase", "[traits]") { | ||||
| } | ||||
| ``` | ||||
|  | ||||
| > `STATIC_CHECK` was [introduced](https://github.com/catchorg/Catch2/pull/2318) in Catch2 X.Y.Z. | ||||
|  | ||||
| `STATIC_CHECK( expr )` is equivalent to `STATIC_REQUIRE( expr )`, with the | ||||
| difference that when `CATCH_CONFIG_RUNTIME_STATIC_REQUIRE` is defined, it | ||||
| becomes equivalent to `CHECK` instead of `REQUIRE`. | ||||
|  | ||||
| Example: | ||||
| ```cpp | ||||
| TEST_CASE("STATIC_CHECK showcase", "[traits]") { | ||||
|     STATIC_CHECK( std::is_void<void>::value ); | ||||
|     STATIC_CHECK_FALSE( std::is_void<int>::value ); | ||||
| } | ||||
| ``` | ||||
|  | ||||
| ## Test case related macros | ||||
|  | ||||
| * `METHOD_AS_TEST_CASE` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Morwenn
					Morwenn