Commit Graph

12 Commits

Author SHA1 Message Date
Martin Hořeňovský 4e4171420d
Support bitand and bitor in REQUIRE/CHECK
This means that bit-flag-like types with conversion to bool can be
asserted on, like so `REQUIRE(var & Flags::AddNewline)`.
2020-04-21 11:00:08 +02:00
Martin Hořeňovský 3a33315ff8
Fix compilation error when lambdas are used in assertions
This is a partial revert of b7b346c3e5.
2020-03-19 13:32:45 +01:00
Martin Hořeňovský b7b346c3e5
Make warnings in assertions fire for GCC/Clang again
The old code caused warnings to fire under MSVC, and Clang <3.8.
I could not find a GCC version where it worked, but I assume that it
did at some point.

This new code causes all of MSVC, GCC, Clang, in current versions,
to emit signed/unsigned comparison warning in test like this:

```cpp
TEST_CASE() {
    int32_t i = -1;
    uint32_t j = 1;
    REQUIRE(i != j);
}
```

Where previously only MSVC would emit the warning.

Fixes #1880
2020-03-19 09:45:41 +01:00
Martin Hořeňovský 3701c2e2e6
Small cleanup of self tests 2019-08-04 13:50:25 +02:00
Martin Hořeňovský 29b3b7ae6b
Namespace our type traits in catch_meta
Previously they could conflict with user-defined type traits that
were in the global namespace.

Fixes #1548
2019-02-23 21:06:20 +01:00
Martin Hořeňovský 054d356332 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
2018-10-16 16:16:00 +02:00
Martin Hořeňovský aaaac35d92 Add tests for #1403 2018-10-13 16:53:30 +02:00
Barry 200d3ad824 Support for parenthesizing types with commas. 2018-04-20 15:11:09 +02:00
Martin Hořeňovský ab30621138 Fix stringifying static array of unsigned chars
The fix leaves an open question: should we keep treating refs
to static array of chars as strings, or should we instead
use `strnlen` to check if it is null-terminated within the buffer

Fixes #1238
2018-04-06 11:43:12 +02:00
Martin Hořeňovský de36b2ada6 Fix compilation for types where relops don't return bool
Closes #1147
2018-01-12 15:49:56 +01:00
Phil Nash 61e838edf2 Reorganised (some) usage tests so they can be included multiple times 2017-11-17 15:46:57 +00:00
Phil Nash 74d3dfd4cc All tests files have .tests.cpp suffix. Also moved tests out of TestMain.cpp and moved up a level 2017-11-13 16:03:27 +00:00