Commit Graph

1569 Commits

Author SHA1 Message Date
Martin Hořeňovský
dbbab8727c
v2.6.1 2019-02-12 19:58:12 +01:00
Darren Gilroy
9ccea82d7f Catch: resolve inconsistency in CATCH_REQUIRE_THROWS
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
2019-02-09 17:42:53 +01:00
Berkus Karchebnyy
dd3d27de57 Fix TAP protocol reporter
According to TAP protocol version 13, the comments after the test name
only may contain Directives - # TODO or # SKIP. We should put
the comment (aka suite name) on a separate line before the test.

See http://testanything.org/tap-version-13-specification.html#directives
2019-02-08 10:48:32 +01:00
Jozef Grajciar
7f229b4ff1 fix SEGFAULTs
issue was that mutable context had no config thus trying to get stream
caused SEGFAULT

Closes #1533, #1534
2019-02-08 10:41:23 +01:00
Nathaniel Dosé
17686ba571 junit reporter reports random seed (--rng-seed)
Fixes #1520
2019-02-01 10:34:20 +01:00
Martin Hořeňovský
d75e9b3c0f
v2.6.0 2019-01-31 22:32:55 +01:00
Robin Moussu
16dc219704 Add to string for std::optional 2019-01-31 15:35:13 +01:00
Martin Hořeňovský
5929d9530c
Add generic generator modifiers
This means mutiple generic generators and some inference helper
* take(n, generator)
* filter(predicate, generator)
* map(func, generator)
* repeat(generator, repeats)
2019-01-31 10:43:15 +01:00
Martin Hořeňovský
e46a70f829
Redo generator interface 2019-01-31 10:43:06 +01:00
Martin Hořeňovský
64a9c02315
Remove obsolete IndexTracker 2019-01-29 14:45:52 +01:00
Robin Moussu
50fefd059a fix variant detection with non-clang compiler 2019-01-26 18:35:14 +01:00
Martin Hořeňovský
d9e99dc2ca
Improve explanation of why -Wparentheses suppression leaks
Related to #1508
2019-01-25 21:29:12 +01:00
Jozef Grajciar
899c5ed3df Console Colour: fix compilation 2019-01-19 23:12:54 +01:00
Martin Hořeňovský
084b1d5fe6
Fix colourized output to file
This change should be backwards compatible, but it would be better
to make the console colour API take an argument in the long term.

Fixes #1502
2019-01-19 13:32:39 +01:00
Martin Hořeňovský
61e1ea9185
Merge pull request #1492 from Lotterleben/fix_1394
fix #1394: avoid superfluous re-run when specific section is selected
2019-01-18 16:46:40 +01:00
Lotte Steenbrink
d084162b2f Avoid superfluous re-run when specific section is selected
Fixes #1394
2019-01-18 15:13:40 +01:00
Martin Hořeňovský
75200b462c
Change CATCH_BREAK_INTO_DEBUGGER to always expand into a function call
This avoids -Wextra-semi-stmt warning inside our code
2019-01-13 23:22:36 +01:00
Martin Hořeňovský
17e09be3b9
Fix stupid (C4800) warning 2019-01-13 19:01:12 +01:00
Martin Hořeňovský
1c99b0ff81
Minor cleanup in decomposer 2019-01-13 16:23:20 +01:00
Martin Hořeňovský
64a0f466ec
Add missing noexcept in move constructors
Because both copy and move operations are trivial, this doesn't
actually change anything, but it silences a static analysis warning.
2019-01-13 16:17:42 +01:00
Axel Huebl
47602ac556 RunContext: Uninit Member
Fix an uninitialized member in `RunContext`.

Found with coverity in a downstream project.
2019-01-13 10:26:47 +01:00
Axel Huebl
d1e7344f16 ClockEstimate: DivByZero
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.
2019-01-11 11:55:51 +01:00
Jozef Grajciar
bdee512057 small cleanup of code 2019-01-10 13:07:54 +01:00
Axel Huebl
188b3e6511 hexEscapeChar: restore stream
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.
2019-01-10 13:05:36 +01:00
Antonio Mallia
bbf70ca74b Missing <type_traits> include 2019-01-10 12:52:15 +01:00
Martin Hořeňovský
c1720d0c42
Fix assert message
I messed up copy-paste when modifying the assert messages in last
commit.
2019-01-03 10:14:15 +01:00
hbina4326
d54c2258e0 Add additional static_assert for the REQUIRE(a == b && c == d) case 2019-01-02 22:44:54 +01:00
BiCapitalization
b3faceede2 Add nice error messages for unsupported && and ||
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
2019-01-01 19:13:47 +01:00
Khem Raj
799c7a2eed Remove redundant move to avoid Wredundant-move with Clang
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-12-29 22:56:37 +01:00
Martin Hořeňovský
9bc15939a5
Don't use exception-related std:: functions with -fno-exceptions
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
2018-12-18 20:19:39 +01:00
Jozef Grajciar
21a1cd5683 Template tests: added TEMPLATE_PRODUCT_TEST_CASE
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
2018-12-10 08:22:09 +01:00
Martin Hořeňovský
6ccd467094
v2.5.0 2018-11-26 20:50:38 +01:00
Martin Hořeňovský
59087f74d9
Fix CAPTURE macro for nontrivial uses
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
2018-11-21 16:48:09 +01:00
Martin Hořeňovský
c6a89f14c2
Add std::isnan polyfill, fixing compilation under Embarcadero
Fixes #1438
2018-11-17 20:52:18 +01:00
Jozef Grajciar
2d906a92cb Add support for templated tests
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.
2018-11-16 21:21:23 +01:00
Jozef Grajciar
489a41012e ConsoleReporter: minor formatting fix
PASSED will now appear on the same line as filename and line number,
just like the case with FAILED message formatting
2018-11-10 19:35:25 +01:00
Martin Hořeňovský
c51f2edfb1 Make TestEventListenerBase register all verbosities
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
2018-11-05 20:05:17 +01:00
Martin Hořeňovský
de6bfb5c25 Remove obsolete comment 2018-11-05 20:05:17 +01:00
Martin Hořeňovský
d0eb9dfb9b Remove unused partial specialization for MatcherMethod<T>
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*>.
2018-11-04 00:00:36 +01:00
Martin Hořeňovský
03d122a35c v2.4.2 2018-10-26 21:14:16 +02:00
Martin Hořeňovský
779e83bc20 Update Clara to v1.1.5 to fix TextFlow bugs 2018-10-26 18:48:28 +02:00
Maciej Patro
8b3c09c137 Catch's CLI now checks whether requested reporter exists
Fixes #1351
2018-10-25 15:43:30 +02:00
Maciej Patro
b7f41237b1 Remove unused parameter from listReporters() 2018-10-25 15:43:30 +02:00
Jozef Grajciar
ab98afe68b Catch::LeakDetector: added cleanup call to destructor
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()
2018-10-18 11:47:21 +02: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
JoeyGrajciar
e1307016f0 Session::applyCommandLine overload on wchar_t (#1401)
* 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.
2018-10-13 19:29:53 +02:00
Jozef Grajciar
9f8b848fe5 XmlReporter: add information about rng-seed
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
2018-10-13 16:53:44 +02:00
Eddie
6cede0101a Fix different operator<< overload sets used for SFINAE and insertion 2018-10-13 16:53:30 +02:00
Miguel Gaio
f1faaa9c10 Fix convert from char on ARM build
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>
2018-10-13 12:56:05 +02:00
Martin Hořeňovský
9e1bdca466 v2.4.1 2018-09-28 15:52:51 +02:00