Commit Graph

753 Commits

Author SHA1 Message Date
vient
57b52f208b
Set IWYU pragma export in catch_all.hpp 2023-09-09 08:24:18 +03:00
Martin Hořeňovský
47a2c96938
Reduce the number of templates in Benchmarking
The basic idea was to reduce the number of things dependent on the `Clock`
type. To that end, I replaced `Duration<Clock>` with `IDuration` typedef
for `std::nanoseconds`, and `FloatDuration<Clock>` with `FDuration`
typedef for `Duration<double, std::nano>`. We can generally assume that
any clock's duration can be expressed in nanoseconds, as long as we insert
`duration_cast`s into the right places.

Note that we cannot remove all dependence on `Clock` as a template
arguments, because functions that actually measure the elapsed time have
to use the Clock.

We also changed some template function arguments to pass plain function
pointers, so that the actual implementation can be placed into a cpp file.
2023-09-08 10:04:31 +02:00
Martin Hořeňovský
fb96279aed
Remove superfluous stdlib includes from catch_benchmark.hpp 2023-09-08 10:04:24 +02:00
Martin Hořeňovský
e14a08d734
Remove unused typedef from Benchmark::Environment 2023-09-08 10:04:22 +02:00
Martin Hořeňovský
9bba07cb87
Replace vector iterator args in benchmarks with ptr args 2023-09-08 10:04:19 +02:00
Martin Jeřábek
3a5cde55b7 implement stringify for std::nullopt_t 2023-08-30 16:21:02 +02:00
Martin Hořeňovský
f24d39e42b
Support C arrays and ADL ranges in from_range generator
Closes #2737
2023-08-29 15:38:13 +02:00
Martin Hořeňovský
e09de7222c
Small cleanup in XML reporter 2023-08-14 12:41:52 +02:00
Martin Hořeňovský
a64ff326bf
Change 'estimated' to 'est run time' in console reporter output 2023-08-14 10:22:59 +02:00
Martin Hořeňovský
ad56463477
Flush stream after benchmarkStarting in ConsoleReporter
This means that the user will see the estimation of full benchmark
running time when it is available, unlike now when it often only
ends up flushed after the benchmark is fully finished.

This means that the user will almost immediately see the start
of table like this

```
benchmark name                       samples       iterations    estimated
                                     mean          low mean      high mean
                                     std dev       low std dev   high std dev
-------------------------------------------------------------------------------
Fill vector generated                          100            54     3.0834 ms
```

This presents significant improvement in user experience especially
for long running benchmarks.
2023-08-13 23:09:02 +02:00
Martin Hořeňovský
d7304f0c41
Constify section hints in static-analysis mode
This prevents a `misc-const-correctness` in clang-tidy
2023-08-10 21:02:18 +02:00
rosstang
cd60a0301c
Assert Info reset need to also reset result disposition to normal to handle uncaught exception correctly (#2723)
* AssertionEnd does not reset the assertion info yet. That is done after populateReaction. And reset assertion info would also reset the result disposition to normal, so that any uncaught exception would be reported as failure

* Approving test output changes due to added unit tests

* Unit tests to throw std::runtime_error instead of std::exception

* Add a unit test to test incomplete assertion handler

---------

Co-authored-by: Ross <ross.tang@gfo-x.com>
2023-08-07 22:07:31 +02:00
Martin Hořeňovský
b593be2116
Always default empty destructors 2023-08-05 18:21:38 +02:00
Vitalii Trubchaninov
ed4acded38 Don't define tryTranslators function if exception are disabled
"-Wunused-function -Wall" produces if this function is defined when exceptions are disabled
2023-08-04 15:28:55 +02:00
Riom
4acc51828f
Introduce CATCH_CONFIG_PREFIX_MESSAGES to only prefix a few logging related macros. (#2544)
* Add missing include for VxWorks build.

std::min is defined in algorithm provides std::min. It appears to be transitively included for most platforms. For VxWorks however this explicit include is required.

* Add option CATCH_CONFIG_PREFIX_MESSAGES to selectively prefix message macros only.

In contrast to CATCH_CONFIG_PREFIX_ALL, this will only prefix the following macros:
I.e. INFO, UNSCOPED_INFO, WARN and CATCH_CAPTURE

This is mainly useful for codebases that use INFO or WARN for their own logging macros.
2023-07-19 17:04:43 +02:00
Martin Hořeňovský
6e79e682b7
v3.4.0 2023-07-13 13:37:30 +02:00
Martin Hořeňovský
bf5aa7b383
Experimental static analysis support in TEST_CASE and SECTION
Closes #2681
2023-05-29 21:45:28 +02:00
Martin Hořeňovský
dba9197ec7
Add new config option: STATIC_ANALYSIS_SUPPORT 2023-05-29 00:55:20 +02:00
Martin Hořeňovský
f60c15364b
Add macro for suppressing Wshadow 2023-05-28 21:07:31 +02:00
Martin Hořeňovský
73b93ce6bc
Include catch_user_config.hpp in all catch_config_* files 2023-05-28 21:04:16 +02:00
Cristian Morales Vega
535205e2ac Suppress -Wunused-result warning in gcc
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
2023-05-23 23:31:55 +02:00
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