Commit Graph

3739 Commits

Author SHA1 Message Date
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
Martin Hořeňovský
c1b59b7071
Mark JUnit reporter's internal members as private 2021-06-18 00:00:24 +02:00
AlCash07
c77ba5314a Fix decomposing in presence of universal ADL-found operators
Closes #2121
2021-06-08 23:36:06 +02:00
Martin Hořeňovský
65c9a1d31a
Add test for comparing immovable types 2021-06-07 20:05:03 +02:00
Martin Hořeňovský
fa31d58934
Don't use removed-in-C++20 allocator parts in CustomAllocator tests 2021-06-07 17:44:39 +02:00
Martin Hořeňovský
9ac8cad2d1
Merge pull request #2244 from jbadwaik/devel
Disable CATCH_INTERNAL_IGNORE_BUT_WARN for NVHPC Compilers
2021-06-07 15:22:53 +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ý
e6da4e10ae
Use make_unique instead of unique_ptr(new T) 2021-06-01 00:17:22 +02:00
Martin Hořeňovský
816f69416b
Use TestCaseInfo in tests directly 2021-06-01 00:17:19 +02:00
Martin Hořeňovský
aee31d0620
Disallow empty tags in test case specification 2021-06-01 00:17:13 +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ý
5741de9ccd
Add explicit test for serialization of boolean attributes in XML 2021-05-31 08:41:28 +02:00
Martin Hořeňovský
0e2895934c
Use precomputed string sizes when constructing std::strings 2021-05-31 08:41:26 +02:00
Martin Hořeňovský
a01073d871
Write single characters directly instead of as C-strings in Sonarqube 2021-05-31 08:41:20 +02:00
Martin Hořeňovský
02839ba934
Remove superfluous usings in the Contains matcher 2021-05-31 08:40:09 +02:00
Martin Hořeňovský
8d6a1c27ef
Use StringRef literals where possible in XML using reporters
This let's us avoid running `strlen` at runtime to convert the
plain string literals to `StringRef`s, by guaranteeing that we
instead have the size available after compilation.

In optimized builds the performance improvement should be even
greater, as the `StringRef` UDL and the related constructor
are both `constexpr`, and thus can be baked completely during
compilation.
2021-05-30 13:59:47 +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
Daniel Edwards
aba114d6fe Don't include CTest in non-development builds.
When Catch2 is used as a CMake subproject (via add_subdirectory) and is not built in development mode (CATCH_DEVELOPMENT_BUILD) CTest is not required for the build, as testing is off. When CTest is included it creates various targets (around 20) which are shown in IDEs such as Clion and pollute the list of configurations.

This patch conditionally includes CTest only if Catch2 is built in development mode.
2021-05-29 16:24:44 +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ý
9f091cbe9d
Remove some code duplication from default test listing impl 2021-05-29 14:06:40 +02:00
Martin Hořeňovský
4c1e896d47
Flush less in default test listing impl 2021-05-29 13:52:23 +02:00
Martin Hořeňovský
2c04850f88
Add some constexpr in compact reporter impl 2021-05-29 13:49:33 +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
Martin Hořeňovský
f9ec34ce01
Make operator BenchmarkStats<Duration2> explicit 2021-05-28 23:19:07 +02:00
Martin Hořeňovský
96790b1d23
Always install the used compiler in Github Actions
This avoids the CI breaking again when the base images remove
an older compiler again.
2021-05-28 11:30:06 +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ý
9137e591fa
Cleanup and optimize stringifying of string-like types
More specifically, made the actual implementation of string-like
type handling take argument as `Catch::StringRef`, instead of
taking `std::string const&`.

This means that string-like types that are not `std::string` no
longer need to pay for an extra construction of `std::string`
(including the potential allocation), before they can be stringified.

The actual string stringification routine is now also better about
reserving sufficient space.
2021-05-18 23:15:22 +02:00
Martin Hořeňovský
f50a06affa
Small optimization for stringifying chrono::time_point 2021-05-18 00:17:34 +02:00
Martin Hořeňovský
4cc247cc70
Use constexpr StringRef instance for unprintable strings 2021-05-18 00:17:32 +02:00
Martin Hořeňovský
8ee422d6bf
Remove pointless branch from stringifying matcher assertions 2021-05-15 11:47:02 +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ý
074017f5ad
Inline MessageBuilder's constructor 2021-05-14 16:00:15 +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
Martin Hořeňovský
5eb7aa4f90
Add test for dots in tag names 2021-05-12 21:43:14 +02:00
Martin Hořeňovský
35cba5486d
Remove mention of ANON_TEST_CASE from documentation
It was removed from v3, because the standard `TEST_CASE` can now be
anonymous as well.
2021-05-10 21:49:45 +02:00
Jozef Grajciar
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
Martin Hořeňovský
313071e8fe
Pick release notes for v2.13.6 2021-05-09 23:45:00 +02:00