Commit Graph

832 Commits

Author SHA1 Message Date
Martin Hořeňovský
a153fce724
Improve error messages for TEST_CASE tag parsing errors
Also removes a duplicated test case checking for empty tag error.

Related to #2650
2023-05-20 21:13:48 +02:00
ThePhD
05d7eb5a00
🛠 Add <exception> header where strictly necessary 2023-05-16 12:18:57 -04:00
Martin Hořeňovský
598895d048
Fix Wredundant-decls
Closes #2682
2023-05-12 09:51:13 +02:00
Martin Hořeňovský
0dc82e08df
Move CATCH_INTERNAL_STRINGIFY macro into its own header 2023-05-07 20:58:54 +02:00
Martin Hořeňovský
8ca504cbc9
Move AssertionResult when passing it inside RunContext 2023-05-06 23:58:48 +02:00
Martin Hořeňovský
c57b5cdf43
Move-enable Catch::optional
This avoids copies in couple places through Catch2, e.g. reporter
spec handling, and moving around `AssertionResult` in `RunContext`.
2023-05-06 15:22:02 +02:00
Martin Hořeňovský
d84777c9cb
Fix assertionStarting events being sent after the expr is evaluated
Closes #2678
2023-05-06 11:48:41 +02:00
Martin Hořeňovský
51fdbedd13
Internal linkage for outlier_variance 2023-05-01 13:21:47 +02:00
Martin Hořeňovský
10f0a58643
Some template instantiation reductions 2023-05-01 13:21:45 +02:00
Martin Hořeňovský
fe64c28925
Reduce compilation costs of benchmarks
We replaced some simple std::algorithm usage by loops, and reduced
header inclusion.
2023-05-01 13:21:41 +02:00
Martin Hořeňovský
7d07efc92b
Clean up iterator usage in benchmarks
Specifically we turned `mean`, `classify_outliers`, `jackknife`,
into concrete functions that take only `const_iterator` from vecs,
instead of generic iterators over anything.

I also changed `resample` to take `const_iterator` instead of
plain `iterator`, and similar for `standard_deviation`, and
`analyse_samples`.
2023-05-01 13:21:36 +02:00
Martin Hořeňovský
f3c678c0ab
Constexprify constants in estimate_clock.hpp 2023-05-01 13:21:33 +02:00
Vertexwahn
46539b6d9b Fix spelling 2023-04-29 12:55:51 +02:00
Holger Kaelberer
10596b2278 Fix unreachable-code-return warnings 2023-04-20 14:53:03 +02:00
Martin Hořeňovský
9a2a4eadc0
Bump xml-format-version in XML reporter 2023-04-10 21:59:50 +02:00
Martin Hořeňovský
fb806da76f
Add lineinfo to XML reporter output for INFO/WARN
Closes #1251
2023-04-10 16:32:07 +02:00
Martin Hořeňovský
9f08097f55
Cleanup internal includes by splitting out some event structs
* Split out BenchmarkInfo and BenchmarkStats to their own header
* Outline BenchmarkStats<> declaration to separate header
* Split out TestRunInfo into its own header

These changes let us remove the large `interfaces_reporter.hpp`
include from `benchmark.hpp`, and replace it with
`interfaces_capture.hpp` in `run_context.hpp`.

I also cleaned out `interfaces_repoter.hpp` from reporter headers
that depend on `reporter_common_base.hpp`. This will not change
anything in the actual inclusion set, but makes it logically
more consistent.
2023-03-31 19:31:51 +02:00
Martin Hořeňovský
1f881ab464
Split ITestInvoker into its own header 2023-03-23 16:50:11 +01:00
Martin Hořeňovský
c487b27d9d
Reduce misc includes all around 2023-03-23 16:50:07 +01:00
Martin Hořeňovský
3230760db2
Cleanup in translating exceptions to messages 2023-03-23 12:26:44 +01:00
Martin Hořeňovský
b3ebce715e
Cleanup benchmarking includes 2023-03-23 11:59:40 +01:00
Martin Hořeňovský
d0f70fdfd6
Unify IReporterRegistry and ReporterRegistry
To keep the compilation firewall effect, the implementations
are hidden behind a PIMPL. In this case it is probably not
worth it, but we can inline it later if needed.
2023-03-22 23:58:44 +01:00
Martin Hořeňovský
4f4ad8ada9
Sprinkle some constexpr around 2023-03-22 19:12:32 +01:00
Martin Hořeňovský
5b665be643
Cut out catch_interfaces_capture.hpp include from the main include 2023-03-22 19:12:03 +01:00
Martin Hořeňovský
2598116aa6
Mark various anonymous classes final 2023-03-20 22:56:43 +01:00
Martin Hořeňovský
173aa3f1f4
Devirtualize Context 2023-03-20 20:46:41 +01:00
Martin Hořeňovský
28437e1214
Remove pointless member variable from RunContext 2023-03-20 20:34:58 +01:00
Martin Hořeňovský
3c8fb6bbb2
Internal linkage for generator trackers 2023-03-20 19:37:58 +01:00
Martin Hořeňovský
72f3ce4db5
Outline the actual registering of listener factories to cpp file 2023-03-20 19:37:27 +01:00
Martin Hořeňovský
62167d756e
Reduce internal includes 2023-03-20 19:24:52 +01:00
Martin Hořeňovský
7b4dd326c0
Remove obsolete comment in multireporter 2023-03-12 13:27:07 +01:00
Martin Hořeňovský
1dfaa8abe7
Outline throwing of TestSkipException 2023-03-12 00:45:31 +01:00
Martin Hořeňovský
ba94278bdd
Inline trivial function in AssertionHandler 2023-03-12 00:41:25 +01:00
Martin Hořeňovský
8e5a4b6f70
Remove superfluous pointer copy in AssertionStats constructor 2023-03-12 00:39:18 +01:00
Martin Hořeňovský
9b884d8107
Fix refactoring 2023-03-11 23:59:47 +01:00
Martin Hořeňovský
3a1ef14097
Use hasMessage() instead of getMessage().empty() 2023-03-11 21:27:11 +01:00
Martin Hořeňovský
13fae1e2ff
Move exception's translation into AssertionResultData message 2023-03-11 16:14:06 +01:00
jushar
3220ae6d4a Add support for the IAR compiler 2023-03-08 20:55:41 +01:00
Martin Hořeňovský
0a0ebf5003
Support elements without op!= in VectorEquals
Closes #2648
2023-03-05 00:11:38 +01:00
Martin Hořeňovský
3f0283de7a
v3.3.2 2023-02-27 15:12:49 +01:00
Martin Hořeňovský
6fbb3f0723
Add IsNaN matcher 2023-02-26 00:14:32 +01:00
Martin Hořeňovský
9ff3cde87b
Simplify test name creation for list-templated test cases 2023-02-23 15:12:14 +01:00
Martin Hořeňovský
4d802ca58f
Use StringRef UDL in more preprocessor-generated strings 2023-02-23 13:25:08 +01:00
Martin Hořeňovský
13711be7cf
Use StringRef UDL for generated generator names 2023-02-23 13:25:07 +01:00
Martin Hořeňovský
584973a485
Early evaluate line loc in NameAndLoc::operator==
I do not know if checking the tracker name or the tracker's file
part of the location first would provide better results, but
in the common case, the line part of the location check should be
rather unique, because different `SECTION`s will have different
source lines where they are defined.

I also propagated this same check into `ITracker::findChild`,
because this significantly improves performance of section tracking
in Debug builds -> 10% in macro benchmark heavily focused on section
tracking. In Release build there is usually no difference, because
the inliner will inline `NameAndLoc::operator==` into `findChild`,
and then eliminate the redundant check. (If the inliner decides
against, then this still improves the performance on average).
2023-02-20 15:19:57 +01:00
Martin Hořeňovský
4f7c8cb28a
Avoid copying NameAndLocationRef when passed as argument
`NameAndLocationRef` is pretty large type, so even in release build,
it is unlikely to be passed in registers. In addition to the fact
that some platforms currently do not allow passing even small types
in register (Windows ABI!!), it is better to pass it as a ref,
effectively passing around a pointer.
2023-02-20 15:17:35 +01:00
Martin Hořeňovský
e1dbad4c9e
Inline StringRef::operator==
This enables its inlining even without LTO, which in turns enables
callers to determine that two StringRefs are unequals with simple
comparison of two numbers, without any function calls.
2023-02-20 15:05:09 +01:00
Martin Hořeňovský
2befd98da2
Inline some non-virtual functions in ITracker and TrackerContext 2023-02-20 15:02:50 +01:00
Martin Hořeňovský
00f259aeb2
Move captured output into TestCaseStats when sending testCaseEnded 2023-02-20 14:48:39 +01:00
Martin Hořeňovský
fed1436246
Avoid allocating trimmed name for SectionTracker 2023-02-20 14:32:46 +01:00
Martin Hořeňovský
0477326ad9
Directly construct empty string for invalid SectionInfo 2023-02-20 14:32:14 +01:00
Martin Hořeňovský
f04c93462b
Small refactoring in AssertionResult 2023-02-20 14:32:12 +01:00
Martin Hořeňovský
1af351cea1
Remove unused TrackerContext::endRun function 2023-02-20 14:32:10 +01:00
Martin Hořeňovský
dcc9fa3f38
Use StringRef UDL for more string literals when expanding macros
* for the name of the listener when registering listener
* for the original expression in assertion macros
2023-02-20 14:31:26 +01:00
Martin Hořeňovský
6135a78c31
Don't insert the foo part of [.foo] tag twice when parsing test spec 2023-02-13 22:16:53 +01:00
Martin Hořeňovský
e8ba329b6c
Add support for iterator+sentinel pairs in Contains matcher 2023-02-10 23:25:45 +01:00
Martin Hořeňovský
4aa88299af
Preconstruct error message in RunContext::handleIncomplete 2023-02-10 21:36:04 +01:00
Martin Hořeňovský
76cdaa3b51
Merge pull request #2637 from jbadwaik/nvhpc_unused_warning
Suppress declared_but_not_referenced warning for NVHPC
2023-02-08 19:51:39 +01:00
Jayesh Badwaik (FZ Juelich)
644294df60
Suppress declared_but_not_referenced warning for NVHPC
Catch2 suppresses unused variable and equivalent warnings in a couple
  of places, but most importantly, in the declaration of autoRegistrar
  in test registry. This warning gets triggered by NVHPC compiler. The
  current patch adds three macros, namely:

      CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
      CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS
      CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION

  for the NVHPC Compiler which in particular prevents that warning from
  occurring. The compiler is detected completely separately from the
  other compilers in this patch, because from what I found out, NVHPC
  defines __GNUC__ as well for some reason. (I suspect because it
  advertises itself as GNU compatible.)

  We also add a condition to make sure that the `__GNUC__` path is not
  taken by the NVHPC compiler.
2023-02-08 12:40:55 +01:00
Martin Hořeňovský
cefa8fcf32
Enable use of UnorderedRangeEquals with iterator+sentinel pairs 2023-02-06 15:34:38 +01:00
Martin Hořeňovský
772fa3f790
Add Catch::Detail::is_permutation that supports sentinels
Also split out helpers for testing matcher ranges (types whose
begin/end/empty/etc require ADL lookup, types whose iteration
uses iterator + sentinel pair, etc) into their own file.
2023-02-06 15:29:01 +01:00
Martin Hořeňovský
f3c0a3cd09
Fix RangeEquals matcher to handle iterator + sentinel ranges
Also added tests for types that require ADL lookup for their
`begin` and `end`.
2023-02-03 18:22:41 +01:00
Martin Hořeňovský
388f7e1737
Cleanup unneeded allocations from reporters
The CompactReporter changes save 21 (430764 -> 430743) allocations
when running the SelfTest binary in default configuration. They
save about 500 allocations when running the binary with `-s`.
2023-01-30 15:30:36 +01:00
Martin Hořeňovský
2ab20a0e00
v3.3.1 2023-01-29 23:18:57 +01:00
Martin Hořeňovský
60264b8807
Avoid copying strings in sonarqube when sorting tests by file 2023-01-29 20:45:13 +01:00
Martin Hořeňovský
65ffee5189
Don't take ownership of SECTION's name for inactive sections
This eliminates 1945 (432709 -> 430764) allocations from running
`./tests/SelfTest -o /dev/null`. In general terms, this saves
an allocation every time an unvisited `SECTION` is passed, which
means that the saved allocations are quadratic in number of sibling
(same level) `SECTION`s in a test case.
2023-01-29 10:44:20 +01:00
Martin Hořeňovský
43f02027e4
Avoid allocations when looking for trackers
Now we delay allocating owning `NameAndLocation` instances until
we construct a new tracker (because a tracker's lifetime can be
significantly different from the underlying tracked-thing's name).

This saves 4239 allocations (436948 -> 432709) when running
`./tests/SelfTest -o /dev/null`, at some cost to code clarity
due to introducing a new ref type, `NameAndLocationRef`.
2023-01-29 10:14:20 +01:00
Martin Hořeňovský
906552f8c8
Clean up extraneous copies in Messages
This removes 109 allocations from running `tests/SelfTest`
(437057 -> 436948).
2023-01-28 22:14:37 +01:00
Martin Hořeňovský
356dfc1439
Move name and sample analysis in benchmarks into BenchmarkStats
This always saves 1 allocation per benchmark, and another two
allocations if the benchmark name is longer than the SSO buffer.
2023-01-28 21:40:59 +01:00
Martin Hořeňovský
e5d1eb757f
Move AssertionResultData into AssertionResult in RunContext
When running `./tests/SelfTest -o /dev/null`, this saves 109
allocations (437167 -> 437058).
2023-01-28 19:57:38 +01:00
Martin Hořeňovský
2403f5620e
Move SectionEndInfo into sectionEnded call in SECTION's destructor
When running `./tests/SelfTest -o /dev/null`, this saves 1272
allocations (437439 -> 437167). In general, this saves multiple
allocations per end of an entered `SECTION`, if the section name
was too long for SSO, because `RunContext::sectionEnded` can then
move the section's name further down the callstack.
2023-01-28 13:00:30 +01:00
Martin Hořeňovský
d58491c85a
Move sectionInfo into sectionEndInfo when SECTION ends
When running `./tests/SelfTest -o /dev/null`, this saves 468
allocations (438907 -> 437439). In general, this saves 1 allocation
every time an entered `SECTION` ends and the section name was long
enough to move out of the SSO buffer.
2023-01-28 12:56:29 +01:00
Martin Hořeňovský
c837cb4a8a
v3.3.0 2023-01-22 19:53:12 +01:00
Martin Hořeňovský
8359a6b244
Stop exceptions in generator constructors from aborting the binary
Fixes #2615
2023-01-22 16:04:16 +01:00
John Beard
efca9a0f18
Added ElementsAre and UnorderedElementsAre (#2377)
Co-authored-by: Garz4 <fancygarz4@gmail.com>
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2023-01-22 00:33:04 +01:00
Chris Thrasher
baab9e8d28
Export symbols for all compilers on Windows 2023-01-20 16:16:30 -07:00
Martin Hořeňovský
2d3c9713a3
Remove VS2015 workaround from Detail::generate 2023-01-19 10:34:57 +01:00
Tommy Carozzani
aa8da505ec Fix compatibility with previous CUDA versions 2023-01-18 11:57:00 +01:00
Martin Hořeňovský
e27bb7198d Fix macro-redefinition issue with MSVC+CUDA
Closes #2603
2023-01-18 11:57:00 +01:00
Sergey Fedorov
b5be642042
catch_debugger.hpp: restore PPC support (#2619) 2023-01-14 00:03:30 +01:00
Philip Salzmann
d548be26e3
Add new SKIP macro for skipping tests at runtime (#2360)
* Add new SKIP macro for skipping tests at runtime

This adds a new `SKIP` macro for dynamically skipping tests at runtime.
The "skipped" status of a test case is treated as a first-class citizen,
like "succeeded" or "failed", and is reported with a new color on the
console.

* Don't show "skipped assertions" in console/compact reporters

Also extend skip tests to cover a few more use cases.

* Return exit code 4 if all test cases are skipped

* Use LightGrey for the skip colour

This isn't great, but is better than the deep blue that was borderline
invisible on dark backgrounds. The fix is to redo the colouring
a bit, including introducing light-blue that is actually visible.

* Add support for explicit skips in all reporters

* --allow-running-no-tests also allows all tests to be skipped

* Add docs for SKIP macro, deprecate IEventListener::skipTest

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2023-01-12 15:01:47 +01:00
Sam James
52066dbc2a Fix build with GCC 13 (add missing <cstdint> include)
GCC 13 (as usual for new compiler releases) shuffles around some
internal includes and so <cstdint> is no longer transitively included.

Explicitly include <cstdint> for uint64_t.

```
FAILED: src/CMakeFiles/Catch2.dir/catch2/internal/catch_clara.cpp.o
/usr/lib/ccache/bin/g++-13  -I/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/.. -I/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1_build/generated-includes  -O2 -pipe
-march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -D_GLIBCXX_ASSERTIONS  -ggdb3 -fdiagnostics-color=always
-ffile-prefix-map=/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1=. -Wall -Wc++20-compat -Wcast-align -Wcatch-value -Wdeprecated -Wexceptions -Wextra -Wextra-semi -Wfloat-equal -Winit-self
-Wmisleading-indentation -Wmismatched-new-delete -Wmismatched-tags -Wmissing-braces -Wmissing-declarations -Wmissing-noreturn -Wnull-dereference -Wold-style-cast -Woverloaded-virtual -Wparentheses
-Wpedantic -Wreorder -Wshadow -Wstrict-aliasing -Wsuggest-override -Wundef -Wuninitialized -Wunreachable-code -Wunused -Wunused-function -Wunused-parameter -Wvla -MD -MT
src/CMakeFiles/Catch2.dir/catch2/internal/catch_clara.cpp.o -MF src/CMakeFiles/Catch2.dir/catch2/internal/catch_clara.cpp.o.d -o src/CMakeFiles/Catch2.dir/catch2/internal/catch_clara.cpp.o -c
/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/internal/catch_clara.cpp
In file included from /var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/internal/catch_clara.cpp:12:
/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/../catch2/internal/catch_string_manip.hpp:47:14: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
   47 |         std::uint64_t m_count;
      |              ^~~~~~~~
      |              wint_t
/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/../catch2/internal/catch_string_manip.hpp:51:42: error: expected ')' before 'count'
   51 |         constexpr pluralise(std::uint64_t count, StringRef label):
      |                            ~             ^~~~~~
      |                                          )
```
2023-01-08 20:08:58 +01:00
Chris Thrasher
1be954ff70
Keep generated headers within project binary directory
This stops them from appearing in the build directories of projects
that may consume Catch2.
2022-12-26 22:44:35 -06:00
lbckmnn
e3fc97dffb
fix compiler warning in parseUint and catch only relevant exceptions (#2572) 2022-12-12 12:15:42 +01:00
lbckmnn
9c0533a905
Add MessageMatches matcher for exception (#2570) 2022-12-12 00:40:47 +01:00
Martin Hořeňovský
ed02710b83
Make AutoReg in test registration macros const 2022-12-10 21:37:21 +01:00
Martin Hořeňovský
ab6c7375be
v3.2.1 2022-12-09 23:10:18 +01:00
Martin Hořeňovský
24607694cb
Move Catch::always_false into decomposer.hpp 2022-12-09 16:18:33 +01:00
Martin Hořeňovský
28e651f152
Move SFINAE in decomposer into return type
This is needed so that we can use conjunction and other logical
type traits to workaround issue with older GCC versions (8 and
below), when they run into types that have ambiguous constructor
from `0`, see e.g. #2571.

However, using conjunction and friends in the SFINAE constraint
in the template parameter breaks for C++20 and up, due to the new
comparison operator rewriting rules. With C++20, when the compiler
see `a == b`, it also tries `b == a` and collects overload set
for both of these expressions.

In Catch2, this means that e.g. `REQUIRE( 1 == 2 )` would lead
the compiler to check overloads for both `ExprLhs<int> == int`
and `int == ExprLhs<int>`. Since the overload set and SFINAE
constraints assume that `ExprLhs<T>` is always on the left side,
when the compiler tries to resolve the template parameters, all
hell breaks loose and the compilation fails.

By moving the SFINAE constraints to the return type, the compiler
can discard the switched expression without having to resolve
the complex SFINAE constraints, and thus everything works the
way it is supposed to.

Fixes #2571
2022-12-09 00:40:01 +01:00
Martin Hořeňovský
a20200be7e
Revert "Fix old GCC + types with ambiguous constructor from 0"
This reverts commit 291c502f66.

The issue is that it breaks under C++20 for some reason.
2022-11-22 15:23:03 +01:00
Martin Hořeňovský
291c502f66
Fix old GCC + types with ambiguous constructor from 0
Closes #2571
2022-11-20 17:07:32 +01:00
Martin Hořeňovský
ae1644e7e9
Add logical trait polyfills 2022-11-20 17:03:29 +01:00
Martin Hořeňovský
65cc7fd2ae
v3.2.0 2022-11-16 20:05:48 +01:00
Tim Blechmann
e932bcf7a3 silence clang's -Wcomma 2022-11-14 13:06:52 +01:00
Emery Goss (AIVAS-v2:Ubuntu-20.04)
b980d408b1 Make MatcherGenericBase copy constructor take const parameter. 2022-11-12 12:22:35 +01:00
Robert Blaauboer
b65c0e27e9 Make ScopedMessage in INFO logging macro const
If users have const correctness checks enabled then this would flagged forcing users to wrap the INFO macro themselves or forego using it altogether.
2022-11-10 18:56:20 +01:00
Martin Hořeňovský
6e77e16ea8
Remove unused StringRef argument from MatchExpr
Apart from cleaning up the code, this change also improves the
compilation time of `UsageTests/Matchers.tests.cpp` by about 2%.
2022-11-10 15:25:51 +01:00
Martin Hořeňovský
943c6e3dee
Add version field to the XML reporter output
We start at version 2, with version 1 being taken up by the output
from Catch2 v2.
2022-11-10 12:04:51 +01:00
Masashi Fujita
b7f4a2efb8
Add support for PlayStation platforms (#2562)
* Add new `CATCH_CONFIG` option for using `std::getenv`, because PS does not support env vars
* Add PS to platforms that have disabled posix signals.
* Small workaround for PS toolchain bug that prevents it from compiling `std::set` with lambda based comparator.
2022-11-09 14:47:55 +01:00
Martin Hořeňovský
f8006aa6d4
More cleanups for src/CMakeLists.txt
* Sort source file lists
* Better source_group for cleanup in IDEs
* More uniform source lists
2022-11-09 13:12:42 +01:00
Martin Hořeňovský
3b139ae51a
Decomposer checks for 0 when assuming an int arg was 0 literal 2022-11-05 20:43:52 +01:00
Martin Hořeňovský
5f9d4ef331
Move throwing test failure exceptions into a helper 2022-11-05 00:22:45 +01:00
Martin Hořeňovský
ec59cd8736
Support decomposing types that only compare with literal 0
This is primarily done to support new `std::*_ordering` types,
but the refactoring also supports any other type with this
property.

The compilation overhead is surprisingly low. Testing it with
clang on a Linux machine, compiling our SelfTest project takes
only 2-3% longer with these changes than it takes otherwise.

Closes #2555
2022-11-04 19:24:44 +01:00
Martin Hořeňovský
d7f8c36e4c
Add traits for checking whether types are comparable 2022-11-04 19:24:42 +01:00
Martin Hořeňovský
3b40cf13eb
Split out parseTestSpec into test-only helpers 2022-10-28 13:27:46 +02:00
Lars Toenning
f1084fb309
Fix references to license file
The license file was renamed with 6a502cc2f5
2022-10-28 11:30:15 +02:00
Martin Hořeňovský
d41da10c54
Change reporters to report filters in round-trippable format 2022-10-27 20:46:59 +02:00
Martin Hořeňovský
e19ed221bd
Provide round-tripping serialization for TestSpec 2022-10-27 18:23:59 +02:00
Martin Hořeňovský
ffa152095c
Report used filters in the SonarQube reporter 2022-10-26 00:05:00 +02:00
Martin Hořeňovský
0ce8c25566
Report used filters in the TAP reporter 2022-10-26 00:04:49 +02:00
Philip Salzmann
6185d0cc0a Use console reporter's totals summary for compact reporter
This changes the compact reporter's summary of test run totals to use
the same format as the console reporter. This means that while output is
no longer on a single line (two instead), it now includes totals for
`failedButOk` test cases and assertions, which were previously missing.
2022-10-25 20:02:26 +02:00
Martin Hořeňovský
a43f67962e
Refactor parsing of shard index/count in cmdline handling
This worsens the message for negative numbers a bit, but
simplifies the code enough that this is still a win.
2022-10-23 00:10:05 +02:00
Martin Hořeňovský
f1361ef624
Refactor how the RNG seed is parsed when handling cmdline 2022-10-22 22:18:30 +02:00
Martin Hořeňovský
d1e7544e9f
Simplify handling of environment in Bazel's support 2022-10-22 22:18:27 +02:00
Martin Hořeňovský
3fed2307e7
Add Detail::getEnv wrapper that compiles under UWP
Under UWP it will always return nullptr, so UWP will essentially
behave as if the environment was just empty.
2022-10-22 22:18:24 +02:00
Martin Hořeňovský
80d58a791d
Add support for Bazel's sharding env variables
Closes #2491
2022-10-21 10:53:53 +02:00
Martin Hořeňovský
d7341b5dc1
Add parseUInt utility function
There is an increasing number of places where Catch2 wants to parse
strings into numbers, but being stuck in C++14 world, we do not
have good stdlib facilities to do this (`strtoul` and `stoul`
are both bad).
2022-10-21 10:53:50 +02:00
Martin Hořeňovský
9d08689845
Add support for Bazel's TESTBRIDGE_TEST_ONLY env var
Closes #2490
2022-10-20 21:34:32 +02:00
Martin Hořeňovský
afc017ef52
Rename provideBazelReporterOutput -> enableBazelEnvSupport
The new name better reflects that we are adding support for more
Bazel environment variables.
2022-10-20 21:34:27 +02:00
Martin Hořeňovský
5df88da16e
3.1.1 2022-10-17 19:57:58 +02:00
Teskann
bdf30834eb Mute the sign conversion warning with explicit cast 2022-10-09 19:02:32 +02:00
Jonathan Wright
0e139b73e4
add versioning to shared libs (#2516)
* add versioning to shared libs

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2022-10-04 15:49:09 +02:00
Roland Kaminski
97313f9033 fix compilation on cygwin
Use std::char_traits<char>::find instead of strnlen for better
portability.
2022-10-04 10:50:18 +02:00
Rosen Penev
6a9bf2e0af
meson cleanups with muon (#2539)
* meson: run through muon's fmt to fix formatting

* meson: switch arrays to files

Allows muon to alphabetically sort files. switch headers back to arrays
as split() can only be used on strings.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-10-03 17:23:38 +02:00
Dimitrij Mijoski
980c20694e
Don't expose header windows.h in catch_all.hpp (#2526)
* Don't expose header windows.h in catch_all.hpp
* Fix generateAmalgamatedFiles.py
2022-10-03 15:36:37 +02:00
Mike Crowe
4db8b50aab
Add support for building with Meson (#2530)
The Meson[1] build system makes it easier incorporate third-party
libaries into a project if they also build using Meson.

Let's add a minimal Meson build that's compatible with the CMake build,
along with a GitHub workflow to check that it builds and that at least
the simplest SelfTest runs.

The handling of catch_user_config.hpp is inspired by BUILD.bazel and
doesn't attempt to support any configuratons options. Such features
could be added later.

Meson strongly discourages using wildcards to specify sources, so the
source and header lists are copied from CMakeLists.txt.

Add a new test workflow to test the Meson builds. I was unable to get
these tests to pass with Ubuntu 20.04, so they use Ubuntu 22.04.

I'm neither a CMake nor a Meson expert, but the results seem to work for
me.

[1] https://mesonbuild.com/

Co-authored-by: Mike Crowe <mcrowe@brightsign.biz>
2022-10-01 23:28:30 +02:00
Sergey Evsegneev
4a7cefe601 Unused variable removed 2022-09-28 16:02:10 +02:00
Rutayan Patro
97d0b1e00e
Suppress clang-tidy warnings for TEMPLATE_TEST_CASE (#2536)
* Suppress clang-tidy *-avoid-c-arrays for TEMPLATE_TEST_CASE
* Made globalRegistrar `const` to avoid `cppcoreguidelines-avoid-non-const-global-variables`

Fixes #2095
2022-09-26 18:07:50 +02:00
Dimitrij Mijoski
c0e582e659 Fix building as shared library with MSVC. 2022-09-24 15:15:50 +02:00
Björn Schäpers
0de60d8e7e Suppress -Wuseless-cast Warning
Fixes #2520.
2022-09-22 21:00:05 +02:00
Zhi Wang
d6bbd3fdef warning: storage class is not first
This pull request fixes the warning issued by `nvc++`
(the C++ compiler in Nvidia HPC SDK/PGI),
and is similar to pull request #1717.
2022-09-21 20:14:12 +02:00
Dimitrij Mijoski
4b3defe4af Suppress warning "-Wstrict-aliasing" for GCC 5 and 6 2022-09-15 13:40:16 +02:00
Tim Blechmann
359542d53e FileStream: enable automatic flushing
when a test executable is killed by a signal (e.g. when executed by
ctest with timeout), the reporter files are not flushed. this can lead
to incomplete (or empty) report files.
to avoid this we enable automatic flushing via `std::unitbuf`

compare #663
2022-09-11 23:49:15 +02:00
Riom
32eae0ecce
Add missing include for VxWorks build. (#2515)
`catch_sharding.hpp` was using `std::min` without including `<algorithm>`.
This worked on most platforms, but it wasn't transitively included in
the VxWorks toolchain.
2022-09-08 10:21:36 +02:00
Martin Hořeňovský
7b2e7d623b
Disable Bazel's env checking on UWP
UWP does not support environment variables and so it cannot
compile code using getenv.
2022-09-02 07:11:28 +02:00
Martin Hořeňovský
3ca5cf32e5
Add CATCH_PLATFORM_WINDOWS_UWP detection macro 2022-09-02 07:10:38 +02:00
Martin Hořeňovský
dc001fa935
Allow easy retrieval of RNG seed by the users
This makes it so that they don't need parallel RNG seed passing
infrastructure for randomized data generation (e.g. inputs for
benchmarks).
2022-08-18 23:23:18 +02:00
Haowei Hsu
2b0fd854e2 Modify the install directories into convention. 2022-07-25 10:43:41 +02:00
Martin Hořeňovský
97c48e0c34
v3.1.0 2022-07-17 20:18:44 +02:00
Martin Hořeňovský
9c9f35068e
Normalize C++ namespace in JUnit's reporter classname field
Closes #2468
2022-07-17 19:15:20 +02:00
Raphael Schaller
1bd233866c Add AllTrue, AnyTrue, NoneTrue matchers 2022-07-16 16:16:05 +02:00
Martin Hořeňovský
cc0e91472a
Different way of checking for support of local warning suppression
Closes #2474
2022-07-15 19:34:35 +02:00
Martin Hořeňovský
3bd0c58878
Fix Wunused-variable warning for MinGW
Closes #2132
2022-07-11 22:28:15 +02:00
Niels Kristian Kjærgård Madsen
5f9109a8dc
Fix nvcc compile error (#2477)
Co-authored-by: Niels Kristian Kjærgård Madsen <nkm@kvantify.dk>
2022-07-07 00:03:02 +02:00
Martin Hořeňovský
5a1ef7e4a6
Redo visibility fallback 2022-06-27 13:10:22 +02:00
Martin Hořeňovský
bea58bf8bb
Allow building Catch2 as dynamic library
Also have a check that warns users if they try to combined dynamic
library with hidden visibility, which we do not support.

Closes #2397
Closes #2398
2022-06-24 16:26:12 +02:00
Martin Hořeňovský
8730260457
Split apart combined TUs
The compile time improvements from using combined TUs mostly isn't
worth the annoyance they cause with various IDE shortcuts, like
when switching between header and its impl. file.

Splitting them apart also fixes the issue of empty subdirs being
installed due to `foo/internal` folders that only contained the
combined TUs and no headers.

Closes #2457
Closes #2463
2022-06-21 18:48:44 +02:00
Martin Hořeňovský
165647abbc
Change provideBazelReporterOutput to local linkage 2022-06-17 18:23:06 +02:00
Brandon Jones
7e4ec432d0 Change Bazel XML support to depend upon BAZEL_TEST 2022-06-17 16:36:14 +02:00
Morwenn
a0ece7b252
Compatility fixes for GCC5 (#2448)
* GCC5 compat: work around inherited constructor issues

Don't use inherited constructors, forward manually instead. This
basically reverts 61f803126d.

I believe that GCC5 does not implement P0136, a C++17 change that made
inherited constructors actually usable and was backported as a DR all
the way to C++11.

* GCC5 compat: bypass std::pair construction issue

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2022-06-07 18:46:46 +02:00