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

@@ -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`