Commit Graph
180 Commits
Author SHA1 Message Date
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ý f314fa1f8c assertionEnded event in reporters no longer returns bool 2021-09-15 18:57:56 +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ý 12bca890b7 Use StringRefs in SectionTracker's filter bookkeeping 2021-09-09 11:04:34 +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ý 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ý 07018e2fba Force __cdecl calling convention for wmain
Fixes #2219
2021-08-26 23:13:27 +02:00
Martin Hořeňovský 7f3297f7e8 Sweep out unused <utility> includes 2021-08-19 21:44:17 +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
Martin Hořeňovský d2ee7100d2 Replace uses of std::move and std::forward with macros
This improves the SelfTest build times by about 3% (measured
with Clang 10 on random Linux box I had lying around).
2021-08-16 16:22:19 +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ý 3579c055c8 Use Detail::make_unique<T> in more places 2021-08-11 22:51:59 +02:00
Martin Hořeňovský 3ec63324a8 Replace owning naked IStream pointers with unique_ptrs 2021-08-11 22:51:57 +02:00
Martin Hořeňovský 1b1f3a88bc Don't debug log empty strings 2021-08-06 11:38:54 +02:00
Martin Hořeňovský 02ab64da2e Cleanup ExceptionTranslatorRegistry::translateActiveException 2021-08-06 00:56:09 +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ý 849002aec0 Move specialization for global op<< to the proper place
In v2 it was placed in a very central header due to the way it was
stitched together. Now that we don't do that, we can move it to the
proper place, removing the potential for confusion given that the
original header was split apart and renamed.
2021-06-20 19:14:56 +02:00
Martin Hořeňovský 4eb9af51af Use non-reserved identifiers for test autoregistration objects 2021-06-19 23:15:11 +02:00
Martin Hořeňovský a7533707ff Use unique_ptr for passing around exception translators 2021-06-19 20:57:06 +02:00
Martin Hořeňovský 28a33497be Move extractClassName to the single calling TU and make it static 2021-06-18 23:39:07 +02:00
Martin Hořeňovský 70f5392210 Devirtualize more things in trackers 2021-06-18 10:35:02 +02:00
Martin Hořeňovský 61461dfd1d Move default impls of isFooTracker to the interface 2021-06-18 10:35:01 +02:00
Martin Hořeňovský c064322a9d Devirtualize ITracker::parent 2021-06-18 10:34:58 +02:00
Martin Hořeňovský a14d67cace ITracker::parent returns pointer not reference
We were already using it mostly to get pointers rather than
references, so this makes it make more sense.
2021-06-18 10:34:55 +02:00
Martin Hořeňovský 4ce8a23edd Tiny cleanups in tracking 2021-06-18 10:34:43 +02:00
AlCash07 c77ba5314a Fix decomposing in presence of universal ADL-found operators
Closes #2121
2021-06-08 23:36:06 +02:00
Jayesh Badwaik (FZ Juelich) c71f42cc29 Disable CATCH_INTERNAL_IGNORE_BUT_WARN for NVHPC Compilers
- NVHPC's implementation of `__builtin_constant_p` has a bug which
    results in calls to the immediately evaluated lambda expressions to be
    reported as unevaluated lambdas.

    https://developer.nvidia.com/nvidia_bug/3321845.

  - Hence, we disable CATCH_INTERNAL_IGNORE_BUT_WARN for NVHPC Compilers
2021-06-07 12:28:16 +02:00
Martin Hořeňovský c9371865d4 Use StringRef as the argument to benchmark{Failed,Preparing} 2021-05-31 08:42:03 +02:00
Martin Hořeňovský 41ad0fda11 Improve XmlWriter::writeAttribute overload set for string-like types
Previously, string literals and `std::string`s would match the
template variant, which would serialize them into a stream and then
call the `StringRef` overload for resulting string. This caused
bunch of codebloat and unnecessary pessimization for common usage.
2021-05-30 13:06:03 +02:00
Martin Hořeňovský d9f72868b2 Use StringRef instead of std::string in XmlWriter::ScopedElement 2021-05-29 21:47:12 +02:00
Martin Hořeňovský c7241bb76e Use StringRef in XmLWriter when the text is not stored 2021-05-29 21:23:24 +02:00
Martin Hořeňovský 1d04427fcd Use StringRef through XmlEncode
This introduces a potential lifetime risk when using the API, but
the intended way to use the `XmlEncode` class is to use it directly,
e.g. `out << XmlEncode(some-text-argument)`, not to store it around.

The benefit is that we avoid allocations for strings that do not fit
into SSO for given platform.
2021-05-29 16:41:57 +02:00
Martin Hořeňovský 0221148ac3 Cleanup string escaping in XmlWriter with raw string literals 2021-05-29 14:11:50 +02:00
Martin Hořeňovský c9027375a3 Replace std::endl with \n and flush
In some places the `std::flush` was not added, as it was sufficiently
obvious that the flush semantics are not intended. There are likely
other places where the flush semantics aren't intended, but that
is a cleanup for later.
2021-05-29 13:15:46 +02:00
Martin Hořeňovský 2ae28fc852 Use make_unique instead of unique_ptr(new T) in more places 2021-05-28 23:43:15 +02:00
Dimitrij Mijoski 86f86c4c23 Fix compiling with C++17 + Clang 5 + libstdc++ v5
This basically tests the combination where the compiler supports most
of C++17 but the library does not.
2021-05-26 00:34:23 +02:00
Martin Hořeňovský 023b5306b4 Add deep const to unique_ptr::operator-> 2021-05-19 11:00:53 +02:00
Martin Hořeňovský 0c0f73a48d Constexprify NameAndTags constructor 2021-05-15 00:02:09 +02:00
Martin Hořeňovský 61e16416a9 Pass other StringRef arguments by value instead of by-ref
Apart from being clearer, it also improves the overall codesize
of the implementation library, and should improve the performance
as well, by removing one level of indirection.
2021-05-14 23:45:59 +02:00
Martin Hořeňovský 0a89e7f0c4 Pass StringRef by value instead of by const-ref 2021-05-14 15:59:42 +02:00
Martin Hořeňovský 28f6698ec8 Remove unneeded interface IRunner 2021-05-13 09:14:26 +02:00
Martin Hořeňovský b36f8daaad Clarify bunch of default, out of line destructors 2021-05-12 23:55:46 +02:00
Martin Hořeňovský d86cb5f95d Add override to virtual destructor of derived class 2021-05-12 23:23:02 +02:00
Jozef GrajciarandMartin Hořeňovský eb911aa995 Suppress failure of CHECKED_IF and CHECKED_ELSE (#2187)
Resolves #1390

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2021-05-10 21:42:47 +02:00
Matteo Beniamino baf0cd0be4 Fixed [dis]engage_platform declarations mismatch 2021-05-09 23:34:17 +02:00
Martin Hořeňovský c0d0a50bdb Significantly refactor fatal error handling
Because new glibc has changed `MINSIGSTKSZ` to be a syscall instead
of being constant, the signal posix handling needed changes, as it
used the value in constexpr context, for deciding size of an array.
It would be simple to fix it by having the handler determine the
signal handling stack size and allocate the memory every time the
handler is being installed, but that would add another allocation
and a syscall every time a test case is entered.

Instead, I split apart the idea of preparing fatal error handlers,
and engaging them, so that the memory can be allocated only once
and still be guarded by RAII.

Also turns out that Catch2's use of `MINSIGSTKSZ` was wrong, and
we should've been using `SIGSTKSZ` the whole time, which we use now.

Closes #2178
2021-05-09 23:34:15 +02:00
Pavel Kamenov cbcab2dbcd Add lcc to the list of unwanted compilers that mimic gcc 2021-05-09 18:12:58 +02:00
Tom de Geus b325c6d81e Making target detection on Mac more robust 2021-05-09 18:05:37 +02:00