diff options
| author | Morwenn | 2021-11-15 00:28:27 +0100 |
|---|---|---|
| committer | GitHub | 2021-11-15 00:28:27 +0100 |
| commit | f41d76167431eeb0ae8e82703e5597769c0531b8 (patch) | |
| tree | c8d12223841b561eee975fc5ba8a9043ca6fe6e7 /docs | |
| parent | edc2f6e8a35b6261e83db9c685f44cb3a4c24d04 (diff) | |
| download | catch3-f41d76167431eeb0ae8e82703e5597769c0531b8.tar.gz | |
Add STATIC_CHECK and STATIC_CHECK_FALSE (#2318)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/other-macros.md | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/other-macros.md b/docs/other-macros.md index 5e7f0af0..ce33c1d8 100644 --- a/docs/other-macros.md +++ b/docs/other-macros.md @@ -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` |