Commit Graph
410 Commits
Author SHA1 Message Date
Martin Hořeňovský b406ad52a7 Mark !mayfail tests as skipped in the JUnit reporter
Should fix #2116
2021-10-10 22:21:39 +02:00
Martin Hořeňovský de67278e14 JUnit reporter uses only 3 decimal places when reporting durations
We used to use whatever precision we ended up having from C++'s
stdlib. However, some relatively popular tools, like Jenkins,
use Maven SureFire XML schema to validate JUnit test reports, and
Maven SureFire schema requires the duration to have at most 3
decimal places.

For compatibility, the JUnit reporter will now respect this
limitation.

Closes #2221
2021-10-10 22:10:48 +02:00
Martin Hořeňovský 1d9696d22d Cleanup reporting of rng seed in existing reporters 2021-10-09 00:02:30 +02:00
Martin Hořeňovský ed1f343a41 Provide random-device option for --rng-seed and make it default 2021-10-08 21:35:45 +02:00
Martin Hořeňovský 200a487cf2 Add generateRandomSeed utility to generate randomness seed 2021-10-08 21:35:41 +02:00
Martin Hořeňovský fce42b62ad Generate random rng seed if user did not specify one
Closes #2161
2021-10-08 21:35:29 +02:00
Martin Hořeňovský 4e6d306742 Rename Catch::Option to Optional 2021-10-05 20:39:28 +02:00
Martin Hořeňovský c6c46a168f Add non-empty assertion to Option's deref op 2021-10-05 19:22:22 +02:00
Martin Hořeňovský 48a889859b Simplify how ratio symbol is returned when stringifying ratios 2021-10-03 20:23:10 +02:00
Martin Hořeňovský d65ee04b74 Remove double serialization when stringifying std::optional 2021-10-03 20:19:36 +02:00
Martin Hořeňovský 928e198ef2 Demote some single character strings into plain chars 2021-10-03 10:37:30 +02:00
Martin Hořeňovský 3e9c6fec22 Remove XmlWriter::writeBlankLine
There is no good reason to provide a "add empty line" primitive
for writing XML documents, and the fact that it remains unused
after all the time it was provided only confirms this further.
2021-10-02 14:39:54 +02:00
Martin Hořeňovský 13670f535f Add more tests for XmlWrite::write* members 2021-10-02 14:39:52 +02:00
Martin Hořeňovský c6640e4f47 Improve documentation of CATCH_MOVE and CATCH_FORWARD 2021-09-30 20:40:24 +02:00
Martin Hořeňovský 23f0d94b4f Use CATCH_FORWARD in Detail::make_unique 2021-09-30 20:27:38 +02:00
Martin Hořeňovský 77c7e9803e Improve documentation on Detail::unique_ptr 2021-09-30 20:17:59 +02:00
Martin Hořeňovský 1d79683ea8 Add [[trivial_abi]] to Detail::unique_ptr when compiled with Clang
This decreases code size and improves performance of passing around
`unique_ptr` instances by value somewhat. It virtually guarantees
problems when combining code compiled with Clang and GCC, but that
was never supported anyway.
2021-09-30 20:11:22 +02:00
Anders Schau Knatten eb452e9b35 Bring back useful comment
In b7b346c3e5 this conditional was simplified to just
`while( false)` rather than the current one. Then in 3a33315ff8, that
change was reverted. I found it hard to understand this
complicated conditional, but after some digging in history I found this
comment which used to be here. It was removed in b7b346c3e5, but not
restored together with the revert in 3a33315ff8. Let's revive it.
2021-09-29 18:19:31 +02:00
Martin Hořeňovský 2deafc33e9 Demote getCurrentNanosecondsSinceEpoch to internal linkage 2021-09-29 11:26:38 +02:00
Martin Hořeňovský 5250cf6d58 Remove getEstimatedClockResolution from Timer
It used to be part of the experimental benchmarking support, but
since that was replaced with proper benchmarking support with its
own timer facilities, it is now a dead code and useless.
2021-09-29 11:24:18 +02:00
Martin Hořeňovský 426954032f Rename Contains string matcher builder to ContainsSubstring
The problem with the old name was that it collided with the
range matcher `Contains`, and it was not really possible to
disambiguate them just with argument types.

Closes #2131
2021-09-27 21:28:33 +02:00
Martin Hořeňovský f02c2678a1 Use StringRef for className in TestCaseInfo 2021-09-27 19:07:45 +02:00
Martin Hořeňovský 21b99d6f58 Add StringRef::compare for three way comparison 2021-09-27 18:41:17 +02:00
Martin Hořeňovský d42e7a23a0 Change startsWith(char) to take StringRef as argument 2021-09-27 14:55:28 +02:00
Martin Hořeňovský fb4153e05e Multiple tests can have same name as long as their tags differ
This change also changes it so that test case macros using a
class name can have same name **and** tags as long as the
used class name differs.

Closes #1915
Closes #1999
2021-09-25 21:37:03 +02:00
Martin Hořeňovský 2c82f82ee2 Mark first party reporters final
They are not intended to be derived from, so forbidding it
explicitly improves our ability to refactor them later.
2021-09-15 21:29:18 +02:00
Martin Hořeňovský 785436cd74 Make benchmark* and fatalError reporter events pure virtual 2021-09-15 21:17:39 +02:00
Martin Hořeňovský f314fa1f8c assertionEnded event in reporters no longer returns bool 2021-09-15 18:57:56 +02:00
Martin Hořeňovský 013edc208b Refactor noMatchingTestCases and skipTests reporter methods
They now take `StringRef` as the argument, and are virtual only
in the basic interface.

Also cleaned out the various reporters and their overrides
of these members which were often empty or delegating up.
2021-09-15 18:08:31 +02:00
Martin Hořeňovský 10fb93cce8 Add new reporter event called for each test case enter/exit
This means that e.g. for `TEST_CASE` with two sibling `SECTION`s
the event will fire twice, because the `TEST_CASE` will be entered
twice.

Closes #2107 (the event mentioned there already exists, but this
is its counterpart that we also want to provide to users)
2021-09-14 13:19:45 +02:00
Martin Hořeňovský 4dcf8382c7 Default-implement assertion* events in StreamingReporterBase
This means that a reporter deriving from `StreamingReporterBase`
does not have to override them if it isn't interested in the individual
assertions.
2021-09-14 12:41:24 +02:00
Martin Hořeňovský 12bca890b7 Use StringRefs in SectionTracker's filter bookkeeping 2021-09-09 11:04:34 +02:00
Martin Hořeňovský 317db82396 Use StringRef in more places in reporters 2021-09-09 10:41:09 +02:00
Martin Hořeňovský cf5ccaa9df AssertionResult::getMessage returns StringRef to internal string 2021-09-08 10:08:07 +02:00
Martin Hořeňovský b3a84c7983 Use StringRef in pluralise implementation
This means that it can no longer be safely made ahead of time,
but nothing in our existing code used it like that. Normally it
is constructed and used in the same expression, which is now
more efficient.
2021-09-08 00:24:40 +02:00
Martin Hořeňovský c0f866c7cf Make CumulativeReporterBase's members protected 2021-09-08 00:23:37 +02:00
Martin Hořeňovský 29caae5ce5 Pass around the test suite name by StringRef 2021-09-08 00:01:31 +02:00
Martin Hořeňovský ea49210eae Remove Config::getProcessName because it was unused 2021-09-08 00:00:16 +02:00
Martin Hořeňovský 290c1b60e6 Store singular TestRunNode in CumulativeReporterBase
There can never be more than one, so there is no reason to provide
genericity over multiple nodes.
2021-09-07 21:18:48 +02:00
Martin Hořeňovský e5938007f7 Completely remove the testGroup events
This was done because they were 1:1 mapping to testRun events, and
I could not think of a reasonable way to make them their own thing.
2021-09-07 20:00:22 +02:00
Martin Hořeňovský ab3fe0053d Remove superfluous warning suppression from console reporter 2021-09-07 19:57:55 +02:00
Martin Hořeňovský 07018e2fba Force __cdecl calling convention for wmain
Fixes #2219
2021-08-26 23:13:27 +02:00
Martin Hořeňovský ff0a5227ca Make Approx::operator() const
Closes #2273
2021-08-26 21:27:43 +02:00
Martin Hořeňovský 54edab53bf Add missing include to benchmark/catch_execution_plan.hpp
Fixes #2275
2021-08-26 20:19:25 +02:00
Martin Hořeňovský 0a8516aeea Use make_unique when registering an exception translator 2021-08-21 21:32:15 +02:00
Martin Hořeňovský 928ecbaccf Change callable/model::clone to return a unique_ptr 2021-08-21 21:00:00 +02:00
Martin Hořeňovský 7f3297f7e8 Sweep out unused <utility> includes 2021-08-19 21:44:17 +02:00
Martin Hořeňovský 7ff54ebc06 Add _t suffix typedef for internal traits 2021-08-19 21:29:41 +02:00
Martin Hořeňovský 4113a12c69 Fix Wreserved-identifier for UDLs in Catch2
See #578
2021-08-19 19:15:46 +02:00
Martin Hořeňovský edad4d0af7 Prefer _t over ::type form for std type traits 2021-08-19 00:21:13 +02:00