The REQUIRE_THROWS and CATCH_REQUIRE_THROWS macros have
a subtle inconsistency in their implementation which can
cause a warning if [-Wunused-value] is used.
This commit changes CATCH_REQUIRE_THROWS so it has the
same implementation as REQUIRE_THROWS
It looks like REQUIRE_THROWS was change in commit
fae0fa4ec but not CATCH_REQUIRE_THROWS.
Similar changes for CATCH_CHECK_THROWS
The clock estimator has a potential division by zero.
Using `iteration + 1` seems also more logical to me for
an average.
Found with coverity in a downstream project.
The ostream passed as reference to `hexEscapeChar` is manipulated
and its original state not restored. This fixes it.
Seen via coverity in a downstream project.
As explained in issue #1273, `operator&&` and `operator||` should give
a proper compile time error on use instead of the compiler complaining
about them not being defined. This commit adds an `always_false` type in
`catch_meta.hpp` used for implementing a nice `static_assert` for both
of the abovementioned operators.
Closes#1273
This doesn't cause trouble with GCC/Clang and libstdc++, but IAR
and its stdlib apparently doesn't compile when you use `fno-exceptions`
and `std::current_exception`/`std::rethrow_exception`.
Fixes#1462
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes#1454
The previous implemetation was just plain broken for most of
possible uses, the new one should work (even though it is ugly
as all hell, and should be improved ASAP).
Fixes#1436
This adds support for templated tests and test methods via
`TEMPLATE_TEST_CASE` and `TEMPLATE_TEST_CASE_METHOD` macros. These
work mostly just like their regular counterparts*, but take an
unlimited** number of types as their last arguments.
* Unlike the plain `TEST_CASE*` macros, the `TEMPLATE*` variants
require a tag string.
** In practice there is limit of about 300 types.
This is a temporarily workaround until we can nuke the current
verbosities system from the orbit and replace it with something
actually sane.
Fixes#1426
No matcher actually uses it, and there is no good reason for it,
as the best it can do for user is removing a single indirection
when using the pointer inside the matcher. Given the overhead of
other code that will be running during such time, it is completely
meaningless.
This also fixes compilation for PredicateMatcher<const char*>.
simple code with provided main function which just returns 0
leaks memory due to fact that singletons are not cleaned up
running valgrind on such simple application reports that 752 bytes
are still available in 11 blocks
this commit adds destructor to Catch::LeakDetector which calls
Catch::cleanUp()
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#1362Closes#1356
* Session::applyCommandLine overload on wchar_t
This allows users on Windows to use Catch::Session::applyCommandLine
with wchar_t * arguments of application.
With this change Session::run became templated so both char and wchar_t
version have the same implementation.
Xml result of reported will now contain value of rng-seed in case it
is not zero.
The value will be stored in element Randomness and it's attribute seed.
Relates to #1402
Some platforms set the signedness of char to unsigned (eg. ARM).
Convert from char should not assume the signedness of char.
Fix build issue with -Werror,-Wtautological-unsigned-zero-compare flags.
Signed-off-by: Miguel Gaio <mgaio35@gmail.com>