Commit Graph

3721 Commits

Author SHA1 Message Date
Martin Hořeňovský
c26693df23
Fix doccomment on shouldShowDuration reporter helper 2020-08-29 19:55:17 +02:00
Martin Hořeňovský
33ad1ee2ac
Split EventListener base from streaming_base.hpp
The base was also renamed from `TestEventListenerBase` to
`EventListenerBase`, and modified to derive directly from the
reporter interface, rather than deriving from `StreamingReporterBase`.
2020-08-29 19:09:54 +02:00
Martin Hořeňovský
f9fdc96cbf
Push LazyStat down into catch_reporter_streaming_base.hpp 2020-08-24 11:27:21 +02:00
Martin Hořeňovský
360b82620e
Refactor serializeFilters implementation 2020-08-24 10:19:26 +02:00
Martin Hořeňovský
2a8e317cfb
Split various reporter helpers out from streaming_base.hpp
Due to also adding a new TU, there is no improvement to the
compilation times of the static library, but it improves the
compilation times of consumer's reporter TUs.
2020-08-24 10:19:24 +02:00
Martin Hořeňovský
6a08d401aa
Split out ReporterFactory out of catch_interfaces_reporter.hpp 2020-08-23 22:35:01 +02:00
Martin Hořeňovský
9677df6d8b
Split IReporterRegistry into its own header file
Doing this removes `<map>` from the include set of the base reporter
interface, and thus from bunch more TUs. This provides about 1.5%
improvements in the debug build of the static library, and 1% in
release build.
2020-08-23 21:01:04 +02:00
Martin Hořeňovský
ed7eaf2df3
Split catch_reporter_bases.hpp into two separate headers
Each of the two reporter bases now has its own header file, and
cpp file. Even though this adds another TU to the compilation,
the total CPU time taken by compilation is reduced by about 1%
for debug build and ~0.5% for optimized build of the main library.
(The improvement would be roughly doubles without splitting the TUs,
but the maintainability hit is not worth it.)

The code size of the static library build has also somewhat decreased.

Follow up: Introduce combined TU for reporters, and further split
apart the catch_reporter_streaming_base.hpp header into its
constituent parts, as it still contains a whole bunch of other stuff.
2020-08-23 07:30:26 +02:00
Martin Hořeňovský
24559493bf
Anchor some Clara vtables into the cpp file
Anchoring the vtables does 2 things
1) Fixes some instances of `-Wweak-vtables`
2) Decreases code size and linker pressure

However, there are still some unanchored ones, and thus we have
to keep suppressing `-Wweak-vtables` warning for Clang.
2020-08-20 23:16:11 +02:00
Martin Hořeňovský
7500ad1ffd
Turn Clara::Detail::ResultBase::Type into its own enum class 2020-08-20 22:59:06 +02:00
Martin Hořeňovský
1a97af45f1
Cleanup some stuff found by MSVC's /analyze
* Added some missing `noexcept`s on custom destructors.
* Fixed `std::move` being called on a const-reference.
* Initialized `ScopedMessage::m_moved` in class definition, instead
of doing so in constructors explicitly.
* Turned some `enum`s into `enum class`es.
* Initialized `StreamingReporterBase::currentTestCaseInfo` in class
definition.
* Some cleanups in SelfTest code.
2020-08-20 20:42:21 +02:00
Martin Hořeňovský
2e480b6e56
Use StringRef for CasedString::caseSensitivitySuffix return type 2020-08-18 21:02:34 +02:00
Martin Hořeňovský
f16be402f7
Make XmlEncoding tests slightly more efficient 2020-08-18 21:02:31 +02:00
Martin Hořeňovský
e418e75c74
Turn CaseSensitive into proper enum class 2020-08-18 21:02:30 +02:00
Martin Hořeňovský
6a46b344c0
Split out CaseSensitive enum out of catch_common.hpp
Only very few places actually use it, so there is no need to have
it be central to everywhere.
2020-08-18 21:02:25 +02:00
Martin Hořeňovský
e7eb749815
Split the NonCopyable helper out of catch_common.hpp 2020-08-18 21:02:23 +02:00
Martin Hořeňovský
c1bb699d45
Remove superfluous catch_reporter_registrars.hpp includes from reporters
The includes were an artifact of the old design where the built-in
reporter TUs used autoregistration to add the reporters to the
factory. Because the current design is to add them explicitly in
the central reporter factory TU, the includes are useless.
2020-08-14 09:33:53 +02:00
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