Commit Graph

3604 Commits

Author SHA1 Message Date
Martin Hořeňovský
bf1e902ca1
Remove <algorithm> include from catch_commandline.cpp 2020-08-14 09:33:42 +02:00
Martin Hořeňovský
49b55d53e4
Prune includes in catch_run_context.cpp 2020-08-14 09:33:28 +02:00
Martin Hořeňovský
07fb96d42c
Don't include catch_random_number_generator.hpp in catch_session.cpp 2020-08-14 09:33:16 +02:00
Martin Hořeňovský
34d9a588bb
Cleanup includes in catch_list.cpp 2020-08-14 09:32:59 +02:00
Martin Hořeňovský
05d7014e75
ApproxMacher uses Approx's overloads for double directly
This saves a tiny little bit of compilation times when the
`ApproxMatcher` is used and `epsilon`, `margin`, or `scale` are
used to customize its behaviour.
2020-08-11 19:07:37 +02:00
Martin Hořeňovský
aa28a917cb
Turn UseColour into enum class 2020-08-11 17:47:54 +02:00
Martin Hořeňovský
b0531404e4
Turn RunTests into TestRunOrder enum class 2020-08-11 17:47:00 +02:00
Martin Hořeňovský
60cc4c293d
Turn ShowDurations into an enum class 2020-08-11 15:03:37 +02:00
Martin Hořeňovský
6dc8345261
IStreamingReporter::list* only uses IConfig instead of full Config
As the full `Config` is not needed, the TUs implementing the `list*`
functions can require the less heavy header `catch_interfaces_config.hpp`
instead of the much heavier `catch_config.hpp`.

This commit also fixes up some other TUs that include `Config`,
while using just `IConfig`, to cleanup the includes further.
2020-08-11 09:39:00 +02:00
Martin Hořeňovský
24b83edf8a
Clara cleanups
* Clara is now split between a header and a cpp file.
* Removed the deprecated `+` and `+=` operators for composing
  a parser.
* Renamed `clara` and `detail` namespaces to be inline with the
rest of Catch2 (they are now `Clara` and `Detail` respectively).
* Taken most of user-exposed types out of the `Detail` namespace
completely (instead of using `using` directives to bring them into
the outer namespace).
2020-08-10 20:30:40 +02:00
Martin Hořeňovský
b824d06844
Fixup missing transitive includes
Found after updating to newest MSVC...
2020-08-10 20:28:14 +02:00
Martin Hořeňovský
e7aa432850
Split TextFlow out from Clara
Now that it has its own header, various reporter TUs that want to
format text do not have to also include Clara. Together with
outlining implementations from a header into a separate TU, this
has noticeably improved the compilation times of the testing impl.

As part of this split, I also implemented some improvements to the
TextFlow code in comparison to the upstream code. These are:

* Replaced the `Spacer` type with a free function that constructs
special `Column` that does the same thing.
* Generic performance improvements, such as eliminating needless
allocations, reserving space in needed allocations, and using smarter
algorithms in some places.
* Because `Column` only ever stored 1 string in its vector, it now
holds the string directly instead.
2020-08-03 23:40:14 +02:00
Martin Hořeňovský
81aa2d5582
Replace ostringstream with ReusableStringStream in ConsoleReporter 2020-08-03 22:59:43 +02:00
Martin Hořeňovský
9d591f19ff
Allow explicitly setting ReusableStringStream's serialized data 2020-08-03 22:59:09 +02:00
Martin Hořeňovský
a4ac07d104
Split out default CATCH_CONFIG_CONSOLE_WIDTH into its own header
This means that code that uses it no longer has to include all of
catch_config.hpp, which seems to provide significant reduction in
size of unoptimized compilation of the final static library.
2020-08-03 22:57:43 +02:00
Martin Hořeňovský
8b0845b1a2
Split catch_config.hpp out of reporter bases 2020-07-30 08:46:07 +02:00
Martin Hořeňovský
c5037743e6
Avoid copying SectionInfo while construction Section 2020-07-29 21:51:10 +02:00
Martin Hořeňovský
9d6ac62aff
Remove unused member from Section 2020-07-29 21:51:08 +02:00
Martin Hořeňovský
ed0ea30149
Apply some IWYU suggestions
This is not nearly all of them, because IWYU does not support the
way Catch2 manages includes -- it expects that non-system includes
are done using `#include "foo/bar/baz.hpp"`, while Catch2 uses
`<foo/bar/baz.hpp>`. This causes trouble, because IWYU suggests
removing every single internal header, and then adding them again,
but using `""` in the include directive... the resulting suggestions
cannot be used without a lot of manual work, as they are largely
bogus.

For bonus points, IWYU also _loves_ to suggest kinda-random stdlib
headers for `size_t` and similar. Still, the resulting inclusion
graph is somewhat better than it was before.
2020-07-29 21:51:05 +02:00
Martin Hořeňovský
35098a62d8
Sanitize includes in random_number_generator.cpp
I have no idea how those got there, but now its dependency graph
is much saner.
2020-07-29 14:58:14 +02:00
Martin Hořeňovský
ba57c17310
Remove some extraneous includes from run_context.hpp 2020-07-29 14:54:55 +02:00
Martin Hořeňovský
4e0af77e29
Push includes for TestCaseInfo down into reporter TUs 2020-07-29 14:43:05 +02:00
Martin Hořeňovský
eaf7113fd3
Cleanup stdlib includes in reporter_bases.hpp 2020-07-29 12:50:51 +02:00
Martin Hořeňovský
d090074da7
Devirtualize handling of ReporterPreferences
The new scheme is that there is one protected member instance of
`ReporterPreferences` in the `IStreamingReporter` base class,
and derived classes can modify it to express their own preferences.

Retrieving the preferences is now a non-virtual operation, which
makes it much cheaper to read them frequently. Previously, we
avoided doing so by caching the preferences in another variable,
but we still read them at least once per test case run.
2020-07-28 09:24:57 +02:00
Martin Hořeňovský
d218d6f9e2
Avoid recalculating string-literal size on root tracker construction
This is a tiiiiiiny performance optimization, but it's free.
2020-07-27 20:08:44 +02:00
Martin Hořeňovský
ef92178058
Devirtualize nested tracker handling 2020-07-27 19:53:54 +02:00
Martin Hořeňovský
125d4b4164
Devirtualize test case registration 2020-07-27 08:49:49 +02:00
Martin Hořeňovský
c9b4867441
Move some impls of StreamingReporterBase members to .cpp file 2020-07-27 08:46:35 +02:00
Martin Hořeňovský
258cac63f8
Move impls of CumulativeReporterBase member functions to .cpp file
`catch_reporter_bases.hpp` turned out fairly expensive for parsing
when building the main library, and the significant amount of code
in headers likely doesn't help. Since the reason it is in the header
is legacy from CRTP reporter bases, moving as much of the
implementations to the .cpp file is free compilation perf.
2020-07-27 07:32:21 +02:00
Martin Hořeňovský
5f6990d746
Only start Section's timer if the duration will be used
This is a small potential runtime optimization on systems with
virtual syscalls, and a significant runtime optimization on systems
without.
2020-07-26 21:33:49 +02:00
Martin Hořeňovský
5ca68829e1
Refactor how shortcircuiting of old style matchers is tested 2020-07-26 21:31:29 +02:00
Martin Hořeňovský
ac54ba7e12
Add test for shortcircuiting behaviour of generic matcher combinators 2020-07-26 21:24:05 +02:00
Reinhold Gschweicher
95c0c88d84
Fix CMake add test helper for CMake 3.18.0
With CMake 3.18.0 the `add_test(NAME)` handling changed. The escaped
double quotes confuse the new call. Work around this upstream change.

fixes: https://github.com/catchorg/Catch2/issues/1984
2020-07-26 15:15:50 +02:00
Martin Hořeňovský
6efeecc179
Cherry-pick doc updates for v2.13.0 2020-07-26 15:14:38 +02:00
Martin Hořeňovský
6b3c563c38
Remove pointless CompactReporter::getPreferences override 2020-07-26 14:07:19 +02:00
Martin Hořeňovský
a004423c7f
Improve documentation for --min-duration 2020-07-26 14:06:52 +02:00
Martin Hořeňovský
4b344f11ea
Document GENERATE's new usage between SECTIONs 2020-07-26 14:06:34 +02:00
Gavin S
87d0197cbd
Update catch_reporter_tap.hpp
TAP format requires all results to be reported.
Removed extraneous preferences function (handled by parent)
Incorporated fix from 3d9e7db2e0
Simplified total printing
2020-07-26 14:00:10 +02:00
Martin Hořeňovský
4565b826cf
Modify generator tracking to allow GENERATEs between SECTIONs
This means that code such as

```cpp
TEST_CASE() {
    SECTION("first") { SUCCEED(); }
    auto _ = GENERATE(1, 2);
    SECTION("second") { SUCCEED(); }
}
```

will run and report 3 assertions, 1 from section "first" and 2
from section "second". This also applies for greater and potentially
more confusing nesting, but fundamentally it is up to the user to
avoid overly complex and confusing nestings, just as with `SECTION`s.

The old behaviour of `GENERATE` as first thing in a `TEST_CASE`,
`GENERATE` not followed by a `SECTION`, etc etc should be unchanged.

Closes #1938
2020-07-26 11:35:06 +02:00
Martin Hořeňovský
250d9b9c72
Fix how testRandomOrder.py builds tag arguments 2020-07-26 10:51:55 +02:00
Martin Hořeňovský
90d6fd849e
Increase tolerances in --min-duration tests
The underpowered and oversubscribed CI servers are hell.
2020-07-26 10:48:03 +02:00
Martin Hořeňovský
13917c44b4
--min-duration is overriden by -d no 2020-07-26 10:48:01 +02:00
Martin Hořeňovský
e6d947f6d4
Refactor tests for duration reporting threshold 2020-07-26 10:47:58 +02:00
John Bytheway
80b0d6975c
Add --min-duration option
A test runner already has a --durations option to print durations.
However, this isn't entirely satisfactory.

When there are many tests, this produces output spam which makes it hard
to find the test failure output.  Nevertheless, it is helpful to be
informed of tests which are unusually slow.

Therefore, introduce a new option --min-duration that causes all
durations above a certain threshold to be printed.  This allows slow
tests to be visible without mentioning every test.
2020-07-26 10:47:53 +02:00
Eric Huber
36131f7ffa
Escaping literal "*" ("times") to fix markdown 2020-07-24 22:36:58 +02:00
Martin Hořeňovský
f52018205d
Cherry pick release notes for v2.12.4 2020-07-24 22:36:13 +02:00
Martin Hořeňovský
b32d2fa016
Update FUNDING file (-Patreon, +PayPal) 2020-07-24 22:35:17 +02:00
George Rhoten
a25c1a24af
Fix for macOS on ARM 2020-07-24 22:34:22 +02:00
Martin Hořeňovský
e28018c659
Cherry pick release notes for v2.12.3 2020-07-24 22:33:59 +02:00
Martin Hořeňovský
2a25a267ea
Cherry pick release notes for v2.12.2 2020-07-24 22:33:26 +02:00