Commit Graph

44 Commits

Author SHA1 Message Date
Martin Hořeňovský
9500ded83b
Improved generator tracking
* Successive executions of the same `GENERATE` macro (e.g. because
of a for loop) no longer lead to multiple nested generators.
* The same line can now contain multiple `GENERATE` macros without
issues.

Fixes #1913
2020-06-01 19:06:51 +02: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
Omer Ozarslan
99575b45db Add unscoped info functionality
This adds UNSCOPED_INFO macro, creating a log message that is stored
until the end of next assertion or the end of test case, whichever comes
first. These messages are not scoped locally, unlike messages created by
INFO macro.
2019-03-06 22:04:35 +01:00
Phil Nash
7c25dae9ea First attempt at data generator support
The support is to be considered experimental, that is, the interfaces,
the first party generators and helper functions can change or be removed
at any point in time.

Related to #850
2018-08-24 13:31:51 +02:00
Phil Nash
533cdc6bc1 Revirtualised IResultCapture methods
Didn't really impact runtime anyway, but will need to use interface for threading support.
2017-12-05 16:23:10 +00:00
Phil Nash
57c346a46d Removed assertionRun() and rolled its logic into assertionPassed() and assertionEnded() 2017-12-02 18:44:23 +00:00
Phil Nash
4b614ee1d1 Moved all AssertionHandler logic into RunContext and de-virtualised interface
This makes the assertion handling much less "chatty". AssertionHandler is now just a thin shim over RunContext
2017-11-27 22:23:15 +03:00
Martin Hořeňovský
40209d1ae0 Use StringRef on fatal error path
So far the fatal error path only uses string literals, so this removes
an allocation from that context
2017-09-14 20:05:25 +02:00
Martin Hořeňovský
255f7d7369 Minor cleanup 2017-08-30 15:53:39 +02:00
Phil Nash
8d21b4a916 Removed some unnecessary #includes
- and don't #include "catch_debugger.h" in the header path when CATCH_CONFIG_FAST_COMPILE is defined
2017-08-09 10:51:50 +01:00
Phil Nash
a9b6813ad9 First draft of (experimental) benchmarking support 2017-08-04 19:23:30 +01:00
Neal Coombes
2212cdfe26 Eliminate some work when results won't be reported. 2017-08-01 22:49:27 +02:00
Martin Hořeňovský
95d85fb186 Fixed up CATCH_CONFIG_FAST_COMPILE for REQUIREs
Unexpected exceptions no longer cause abort and there should be no more
potential for false negatives.

The trade-off now is that exceptions are no longer translated.
2017-04-03 11:36:55 +02:00
Phil Nash
166ca2e819 Do uncaught_exception checking before calling sectionEnded
- split the uncaught handling (adding to unfinishedSections) into separate method
2015-09-26 18:12:21 -07:00
Phil Nash
05743eeaa1 FatalErrorConditions now full close reporter states
- so the console reporter(s) show final summary and the xml reporters close their tags
2014-08-22 19:33:28 +01:00
Phil Nash
c1a8e1c5dd Added signal handlers (and placeholder for SEH handlers)
- based on PR 232 (https://github.com/philsquared/Catch/pull/232 - thanks Lukasz Forynski)
- Writes to reporter, so gets all the usual context, but then exits directly (since the stack cannot be resumed) so no summary
- On Windows does nothing, as yet.
2014-08-22 08:07:39 +01:00
Phil Nash
10801c2876 Folded ExpressionResultBuilder into ResultBuilder
(even more SRP violations!)
2014-05-29 07:50:19 +01:00
Phil Nash
9438a03d5b Big assertion capture refactoring.
- moved as much logic out of the macros as possible
- moved most logic into new ResultBuilder class, which wraps ExpressionResultBuilder (may take it over next), subsumes ResultAction and also takes place of ExpressionDecomposer.

This introduces many SRP violations - but all in the name of minimising macro logic!
2014-05-28 18:53:01 +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
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
b5fd5a6496 INFO and CAPTURE are now scoped
- SCOPED_INFO and SCOPED_CAPTURE are now just aliases
2013-06-28 17:09:57 +01:00
Phil Nash
2a9d8d9e36 Changed "const X ref"s to "X const ref"s
- Brought older code up to current convention (with the help of a Python script)
2013-04-23 18:58:56 +01:00
Phil Nash
ad654867f1 Removed deprecated message code 2013-02-02 20:36:36 +00:00
Phil Nash
207b27b3c5 Changed the way info messages are handled.
This fixes issue with SCOPED_INFO and makes output more readable.
Needs some refactoring.
2013-02-02 19:58:04 +00:00
Phil Nash
ad6701d222 SectionInfo now goes via new streaming reporter interface 2012-11-30 08:58:46 +00:00
Phil Nash
06a671a349 Renamed TestCaseInfo -> TestCase 2012-11-22 19:17:20 +00:00
Phil Nash
81cb69ef18 AssertionInfo captures more info (for test cases and sections) 2012-11-04 21:09:22 +00:00
Phil Nash
2e203a1834 Fixed remaining reporting regressions 2012-10-29 19:55:13 +00:00
Phil Nash
f847186ebb AssertionResultBuilder -> ExpressionResultBuilder 2012-10-26 08:45:23 +01:00
Phil Nash
e3b111a39a streamlined acceptResult 2012-10-18 22:59:16 +01:00
Phil Nash
3ad13256e1 Refactored assertion builder stuff out of expression builder 2012-10-18 08:39:44 +01:00
Phil Nash
c96f9330a0 Collect assertion info up front 2012-10-17 08:14:22 +01:00
Phil Nash
c597a893fa ResultInfo -> AssertionResult filenames and variables 2012-10-16 08:31:05 +01:00
Phil Nash
d16955f63a Renamed ResultInfo -> AssertionResult 2012-10-16 08:27:21 +01:00
Phil Nash
4b93fb81b5 Added some surrogate cpps
(and fixed up missing includes they uncovered)
2012-09-28 19:21:14 +01:00
Phil Nash
a695eb9006 Builds almost completely cleanly with -WEverything in LLVM 2012-08-13 07:46:10 +01:00
Phil Nash
d0be9ed5d9 More reformatting 2012-05-15 08:02:36 +01:00
Phil Nash
e83f839741 Renamed MutableResultInfo to ResultInfoBuilder 2012-05-08 19:32:18 +01:00
Phil Nash
5d1c8f2c6d Replaced all file/ line pairings with SourceLineInfo 2012-05-08 19:16:18 +01:00
Phil Nash
8d93949b19 Used Counts class in IResultCapture interface 2012-02-23 08:57:51 +00:00
Phil Nash
a162e22fa3 Added CHECKED_IF and CHECKED_ELSE 2012-02-10 08:30:13 +00:00
Phil Nash
823ea3efd4 Re-org 2011-04-26 08:32:40 +01:00