Commit Graph

89 Commits

Author SHA1 Message Date
John Bytheway
46fde0c597 Add --min-duration option
A test runner already has a --durations option to print durations.
However, this isn't entirely satisfactory.

When there are many tests, this produces output spam which makes it hard
to find the test failure output.  Nevertheless, it is helpful to be
informed of tests which are unusually slow.

Therefore, introduce a new option --min-duration that causes all
durations above a certain threshold to be printed.  This allows slow
tests to be visible without mentioning every test.
2020-07-06 11:35:02 +02:00
khyperia
ccb1f70629 Make CATCH_BREAK_INTO_DEBUGGER be user-configurable 2020-02-01 17:01:50 +01:00
Martin Hořeňovský
e340ab8db6
Various improvements to the benchmarking support
* Units from <ratio> are no longer redeclared in our own namespace
* The default clock is `steady_clock`, not `high_resolution_clock`,
because, as HH says "high_resolution_clock is useless. If you want
measure the passing of time, use steady_clock. If you want user
friendly time, use system_clock".
* Benchmarking support is opt-in, not opt-out, to avoid the large
(~10%) compile time penalty.
* Benchmarking-related options in CLI are always present, to decrease
the amount of code that is only compiled conditionally and making
the whole shebang more maintainble.
2019-06-06 21:28:56 +02:00
Joachim Meyer
ce2560ca95 Integrate Nonius benchmark into Catch2
Changes done to Nonius:
* Moved things into "Catch::Benchmark" namespace
* Benchmarks were integrated with `TEST_CASE`/`SECTION`/`GENERATE` macros
* Removed Nonius's parameters for benchmarks, Generators should be used instead
* Added relevant methods to the reporter interface (default-implemented, to avoid
breaking existing 3rd party reporters)
* Async processing is guarded with `_REENTRANT` macro for GCC/Clang, used by default
on MSVC
* Added a macro `CATCH_CONFIG_DISABLE_BENCHMARKING` that removes all traces of
benchmarking from Catch
2019-06-06 19:33:37 +02:00
Martin Hořeňovský
c3c82f539c
Merge pull request #1336 from ax3l/topic-overrideVirtualRedundant
Refactor: override implies virtual
2019-04-18 14:10:24 +02:00
Ziv Shahaf
8af8704089 support for printing test filters (PR #1585) 2019-04-03 20:24:52 +02:00
Axel Huebl
5347ff9e5f
Refactor: override implies virtual
If not used with `final`, override implies `virtual`.
Detected via CodeFactor score.

Another reference on SO:
  https://stackoverflow.com/questions/43466863/isnt-virtual-keyword-redundant-when-override-or-final-specifiers-are-used
2018-07-12 14:27:06 +02:00
Martin Hořeňovský
f00257e374 Call listeners before calling reporters
Catch2's documentation promises that listeners are called _before_
reporters, but because of the previous implementation, they were
called _after_ reporters. This commit fixes that.

Closes #1234
2018-04-07 12:25:03 +02:00
Martin Hořeňovský
414dcae34a Allow only 1 reporter at a time 2018-04-07 12:05:29 +02:00
dvirtz
ca8470fbad https://github.com/catchorg/Catch2/issues/1175 - don't list hidden tests by default 2018-02-09 19:55:40 +01:00
dvirtz
355b3f9952 Add option to warn when no tests ran
Closes #1158
2018-02-09 18:49:36 +01:00
Martin Hořeňovský
9aa96712ae Sweep out some extra warnings
Swept:
`-Wpadded` in some places (where it caused extra size, instead of just
saying "hey, we padded struct at the end to align, just as standard says")
`-Wweak-vtables` everywhere (Clang)
`-Wexit-time-destructors` everywhere (Clang)
`-Wmissing-noreturn` everywhere (Clang)

The last three are enabled for Clang compilation going forward.

Also enabled `-Wunreachable-code` for Clang and GCC
2017-09-07 17:25:15 +02:00
Phil Nash
c5608f0202 Changed all .hpp extensions to .h where there is now a corresponding .cpp 2017-09-07 11:24:33 +01:00
Martin Hořeňovský
e871742534 Move session to internal, split apart implementation 2017-08-31 10:31:52 +02:00
Martin Hořeňovský
dd8e79c529 Streamline includes in external interfaces 2017-08-29 16:44:02 +02:00
Phil Nash
699e571400 Documented benchmark-resolution-multiple command line option
- and increased default to 100
2017-08-15 19:51:22 +01:00
Phil Nash
917a51da6b Added libidentify support, including option for waiting for keypress on exit (and/ or start) 2017-08-15 13:48:14 +01:00
Phil Nash
eed4ae86ad Added config to control multiple of clock resolution to run benchmark iterations for 2017-08-11 22:24:52 +01:00
Phil Nash
f0890dcdf8 removed redundant virtuals on override functions (and added a couple of overrides) 2017-07-20 16:23:52 +01:00
Martin Hořeňovský
cf2678dce6 Merge branch 'dev-better-verbosity' of https://github.com/BMBurstein/Catch 2017-07-19 23:17:19 +02:00
Martin Hořeňovský
4a1e898eae More method bodies moved out of line 2017-07-19 15:32:58 +02:00
Baruch Burstein
f749347523 Check that reporter supports requested verbosity 2017-07-06 01:25:49 +03:00
Baruch Burstein
1e7000ed55 Merged implemention of #934, but using 'verbose' option on command line instead.
(see 616f7235ef on master for original merge)
2017-06-26 17:15:28 +01:00
Phil Nash
4c5af2089a Added CATCH_ENFORCE (and updated CATCH_INTERNAL_ERROR to be stream based)
replaced all ad-hoc exceptions (where appropriate) with CATCH_ENFORCE or CATCH_INTERNAL_ERROR - no explicit ostringstreams.
2017-05-05 15:43:31 +01:00
Phil Nash
338ba6b9ba Migrated Config and IConfig to shared_ptr (from Ptr) 2017-04-25 21:56:14 +01:00
Phil Nash
e749724a11 A load more C++11 tweaks - mostly moving initialisations from constructors to inline 2017-04-25 19:30:53 +01:00
Martin Hořeňovský
71df66365e Gutted catch_compiler_capabilities
All C++11 toggles are now removed. What is left is either platform
specific (POSIX_SIGNALS, WINDOWS_SEH), or possibly still needed
(USE_COUNTER).

If current CLion is compatible with `__COUNTER__`, then we should also
force `__COUNTER__` usage.

Changed
* CATCH_AUTO_PTR    -> std::unique_ptr
* CATCH_OVERRIDE    -> override
* CATCH_NULL        -> nullptr
* CATCH_NOEXCEPT    -> noexcept
* CATCH_NOEXCEPT_IS -> noexcept

Removed
* CATCH_CONFIG_CPP11_UNIQUE_PTR
* CATCH_CONFIG_CPP11_SHUFFLE
* CATCH_CONFIG_CPP11_TYPE_TRAITS
* CATCH_CONFIG_CPP11_OVERRIDE
* CATCH_CONFIG_CPP11_LONG_LONG
* CATCH_CONFIG_CPP11_TUPLE
* CATCH_CONFIG_CPP11_IS_ENUM
* CATCH_CONFIG_CPP11_GENERATED_METHODS
* CATCH_CONFIG_CPP11_NOEXCEPT
* CATCH_CONFIG_CPP11_NULLPTR
* CATCH_CONFIG_VARIADIC_MACROS
2017-04-25 12:43:19 +02:00
Phil Nash
1f3ba8a0b6 Converted (almost) all for-loops with iterators or indices to range-based 2017-04-25 11:07:02 +01:00
Martin Hořeňovský
bc68b9f454 More include simplifications 2017-02-13 14:12:22 +01:00
Martin Hořeňovský
9012f95964 Moved some std includes out from catch_common.h 2017-02-12 12:17:07 +01:00
Phil Nash
005787f1c5 Marked IConfig implementations in Config CATCH_OVERRIDE
(silences warnings)
2017-02-10 22:39:27 +00:00
Phil Nash
e7bcbb35c0 First cut of -c/—section option for running specific sections 2017-01-23 12:36:03 +00:00
Phil Nash
a74d760d74 Switched remaining std::auto_ptrs to use CATCH_AUTO_PTR 2016-06-08 19:14:54 +01:00
Phil Nash
8ccb18daa9 Added --use-colour option to give finer control over colourisation.
--force-colour is still present but deprecated (will remove in v2)
2016-02-29 08:03:48 +00:00
Phil Nash
e91738103c Stripped trailing whitespace from all source code lines
(replaces need for PRs #310 and #504)
2015-11-04 18:04:15 +00:00
Phil Nash
b8515929b8 Moved all new tracking impl into catch_test_case_tracker.pp 2015-11-02 06:14:52 +00:00
Phil Nash
d43a47efca Refactored stream related stuff
- simpler, polymorphic hierarchy-based, approach
- less bitty conditionals spread across the code
- all resolved up-front so now config class is immutable
(it had evolved the way it was and in need of a clean-up sweep for a long time)
2015-09-29 19:23:06 +01:00
Phil Nash
4cb74761d9 Support for multiple reporters
- can't (yet) specify different targets for each reporter (e.g. different files)
2015-08-05 19:02:17 +01:00
Phil Nash
088c5bc53e --filenames-as-tags 2015-07-02 08:20:18 +01:00
Peter Huene
e5280b2c57 Add --force-colour option to force colour output.
Adding a --force-colour option to force colour output on POSIX systems,
provided a debugger is not attached.

This allows for Catch to output colours even if STDOUT is not a tty,
which can be the case when the test executable is being spawned by a
parent process (e.g. CMake's ctest).
2015-02-11 13:12:42 -08:00
Phil Nash
383d7c06a1 Only use std::cout/ cert via Catch::cout/ cert - and make those conditional on CATCH_CONFIG_NOSTDOUT 2014-10-02 19:08:19 +01:00
Phil Nash
fa0122bf54 Allow testing ordering to be specified as declaration, lexicographical, or random. Allow random seed to be specified 2014-09-15 18:39:31 +01:00
Phil Nash
1d210ebd37 Tag aliases feature 2014-06-30 07:33:17 +01:00
Phil Nash
ae75b3774a Switched over to new name/ tag parser 2014-05-16 18:24:07 +01:00
Phil Nash
7059b2cdac Added ability to show “invisibles” in strings (just tabs and newline chars, for now). 2014-04-22 18:23:42 +01:00
Phil Nash
c4a089c12b Refactored a lot of code from headers into impl headers only compiled into one TU
- also added noimpl option to single header script - which only generates the non impl code
2013-12-03 18:52:41 +00:00
Phil Nash
782c2b5891 Added ability to load names of tests to run from a file
- use -f to specify filename. Blank lines and lines starting with # are ignored
- also added --list-test-names-only to list test names out to file in a form that can be immediate read in by -f
2013-11-26 20:57:34 +00:00
Phil Nash
6339254cb2 First cut of Timer class.
- started integrating with reporters (now (optionally) supported in console reporter).
- introduced Node<> template to help with cumulative reporting and used it instead of ThreadedSectionInfo.
2013-08-07 18:56:35 +01:00
Phil Nash
f3d1f08c3b Removed all trailing whitespace
- addresses #105
2013-07-03 19:14:59 +01:00
Phil Nash
11381c146c Tweaked indentation of errors and test lists 2013-06-07 19:06:30 +01:00