Commit Graph

84 Commits

Author SHA1 Message Date
Martin Hořeňovský c045733d05
Add splitReporterSpec helper 2022-04-05 12:57:33 +02:00
Daniel Feist 78e33ce51f
Added TestCaseInfoHasher and tests. (#2394)
Test case hashing includes tags and class name

As the hasher involves more code now, it was split out into its own file
and it got its own set of tests.

Closes #2304
2022-03-31 16:46:41 +02:00
Alan Jowett 18c58667d7
Generate Visual Studio project files with constant project guids
By default, CMake derives a Visual Studio project GUID from the
file path but the GUID can be overridden via a property
(see https://gitlab.kitware.com/cmake/cmake/-/commit/c85367f4).

Using a non-constant GUID can cause problems if other projects/repos
want to reference the catch2 vcxproj files, so we force a constant GUID here.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Resolves: #2388
2022-03-18 00:21:12 +01:00
Martin Hořeňovský 05d4ec62c8
Add common ReporterBase as parent of the helper bases
This is useful as a centralized place for handling common reporter
problems like handling output streams, and soon also colour impl
handling.
2022-03-06 16:28:22 +01:00
Martin Hořeňovský 33ffc3b6fc
Allow passing compile-time configuration options through CMake 2022-02-18 11:15:08 +01:00
Martin Hořeňovský a9ed2c235d
Rename MiscFunctions.cmake -> CatchMiscFunctions.cmake 2022-02-07 00:05:11 +01:00
Martin Hořeňovský 103cb16696
Rename listening reporter to multi reporter 2022-01-05 00:00:28 +01:00
Martin Hořeňovský 187bf6db2b
Split out CaseInsensitiveCmp into its own file 2021-12-26 00:35:46 +01:00
Martin Hořeňovský c95072408f
Add catch_sharding.hpp to CML 2021-11-23 23:16:17 +01:00
Martin Hořeňovský 9200b4078b
Move reporter_registrars.hpp to reporters/ 2021-11-10 23:52:59 +01:00
Martin Hořeňovský f17725a186
Split void_type into its own header and rename it to void_t 2021-10-27 20:01:13 +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ý 4e6d306742
Rename Catch::Option to Optional 2021-10-05 20:39:28 +02:00
Roc 9ac9fb164e
Suffix the library name with 'd' for debug builds 2021-08-28 00:47:54 +02:00
Martin Hořeňovský 03ce304102
Add std::move/std::forward replacement macros
Using the `CATCH_MOVE` and `CATCH_FORWARD` macros instead of the
`std::move` and `std::forward<T>` utility functions can improve
compilation times and debug build's performance, and thus will
be preferred going forward.
2021-08-16 16:22:16 +02:00
Martin Hořeňovský 3d1cf95b32
Fix ulp distance calculation for numbers with different signs
This is a simplification of the fix proposed in #2152, with the
critical function split out so that it can be tested directly,
without having to go through the ULP matcher.

Closes #2152
2021-07-27 21:04:41 +02:00
Martin Hořeňovský 28f6698ec8
Remove unneeded interface IRunner 2021-05-13 09:14:26 +02:00
Martin Hořeňovský d4a3cd9992
Make the static library build reproducible with supported compilers
This is based on bed285af07 from
`v2.x` branch, but done properly for the build in v3 branch,
effectively porting #2141 to devel.
2021-05-09 18:05:34 +02:00
Martin Hořeňovský 551946c45b
Split out INTERNAL_CATCH_UNIQUE_NAME into its own header
Also small cleanup of includes of related headers.
2021-02-24 23:14:18 +01:00
Martin Hořeňovský 4e8832fc88
Split CATCH_CONFIG_COUNTER into its own header
Part of #2041
2020-12-29 11:07:45 +01:00
Martin Hořeňovský 1d269211bd
Split CATCH_CONFIG_WCHAR into its own header
Part of #2041
2020-12-28 20:51:49 +01:00
Martin Hořeňovský 965afc4b2e Split CATCH_CONFIG_ANDROID_LOGWRITE into its own header
Part of #2041
2020-12-28 12:53:52 +01:00
Uriel García Rivas 552af8920d Added AnyMatch, AllMatch and NoneMatch 2020-12-27 20:20:55 +01:00
Martin Hořeňovský a091853f4a
Rename file catch_matchers_floating -> catch_matchers_floating_point
The old name was a legacy of v2 era, where all headers were stitched
into one. With v3 using separate headers, it is better when they have
proper name.
2020-12-13 18:12:20 +01:00
Martin Hořeňovský e7740316e3
Split TestFailureException into its own header 2020-11-28 11:18:54 +01:00
Martin Hořeňovský 72525a3053
Rename catch_common.hpp -> catch_source_line_info.hpp
Previous splitting of catch_common.hpp left it containing only one
actual thing, which is the `SourceLineInfo` type. Given that, there
is no reason to keep the old name.

Also found out that it was included in some places for no reason
(primarily Matchers).
2020-11-28 11:18:51 +01:00
Martin Hořeňovský 1982c0d5ee
Split out the StreamEndStop helper into its own header 2020-11-28 11:18:46 +01:00
Martin Hořeňovský 3f9e779542
Improve detection of std::uncaught_exceptions support
The problem was that Catch2 did not reliably include `<exception>`
before it checked for the feature test macro for
`std::uncaught_exceptions`. To avoid overhead of including
`<exception>` everywhere, the configuration check was split out
into a separate header.

Closes #2021
2020-10-08 12:39:50 +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ý 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ý 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ý 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ý 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ý 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ý 41bbaa6d57
Implement a simplified variant of std::unique_ptr<T>
This simplified variant supports only a subset of the functionality
in `std::unique_ptr<T>`. `Catch::Detail::unique_ptr<T>` only supports
single element pointer (no array support) with default deleter.

By removing the support for custom deleters, we also avoid requiring
significant machinery to support EBO, speeding up instantiations of
`unique_ptr<T>` significantly. Catch2 also currently does not need
to support `unique_ptr<T[]>`, so that is not supported either.
2020-05-31 15:08:47 +02:00
Martin Hořeňovský 4b2f1da02a
Split CATCH_TRANSLATE_EXCEPTION into its own header
As far as I know, only a few users actually use it, but these changes
allow us to avoid including a surprising amount of code in the main
compilation path.
2020-05-20 08:15:11 +02:00
Martin Hořeňovský 579dcd1a76
Ignore Wdeprecated for Clara 2020-05-12 23:56:24 +02:00
Martin Hořeňovský f56832d3ea
Add Catch2::Catch2 alias for Catch2 CMake target 2020-05-11 20:05:10 +02:00
Martin Hořeňovský f64487bf70
Move LazyExpr's and MessageInfo's implementation to the combined TU
Some of the implementations were inlined instead.
2020-05-10 20:21:04 +02:00
Martin Hořeňovský 27f1756d8e
Split out LazyExpr into its own header
This enables us to avoid `catch_reporter_bases.hpp` being indirectly
dependent on `catch_tostring.hpp`, cutting apart quite a bit indirect
inclusions.
2020-05-10 20:21:02 +02:00
Martin Hořeňovský d5e08a4beb
Rename catch_assertionhandler -> catch_assertion_handler 2020-05-10 20:20:56 +02:00
Martin Hořeňovský ed967fd7fc
Split MessageInfo into its own header
This is first step towards splitting apart reporter implementation
and `catch_string.hpp`.
2020-05-10 20:20:52 +02:00
Martin Hořeňovský 7efbc83ae0
Introduce combined TUs for compiling small TUs
This should improve the compilation times by decreasing the number
of TUs compiled, without making overly big TUs that would cause
problems with heavy-tailed compilation times.

There is one "combined TU" for the top level part, and each subpart,
except for Reporters, which currently do not have any trivial TUs.
2020-05-10 15:37:29 +02:00
Martin Hořeňovský 9e498278be
Move StringRef header to internals 2020-05-10 10:09:01 +02:00
Martin Hořeňovský db32550898
Remove catch_default_main.hpp
There are two reasons for this:

1) It is highly unlikely that someone has use for this header,
which has no customization points and only provides simplest
possible main, and cannot link the static library which also
provides a default main implementation.
2) It being a header was causing extra complications with
the convenience headers, and our checking script. This would either
require special handling in the checking script, or would break user's
of the main convenience header.

All in all, it is simpler and better in the long term to remove it,
than to fix its problems.
2020-05-09 18:00:49 +02:00
Martin Hořeňovský e78b4f6be7
Remove file list checking from CMake
I do not think we need a safeguard against not including files in
CMake anymore, and as it is, it caused annoying false positive about
the default main implementation.
2020-05-06 21:23:13 +02:00