Commit Graph

36 Commits

Author SHA1 Message Date
Martin Hořeňovský d2ddb997a7 Cleanup for performance reasons
* Eliminated some copies
* Made makeTestCase fit into 4 arguments -- avoids spills on Win64
* Made string literals into StringRef literals
2018-03-02 16:24:35 +01:00
Phil Nash ca2455e6e6 Fixed NoAssertions warning 2018-01-26 16:52:28 +00:00
Phil Nash aa9d635014 Refactored StreamRedirect classes 2017-12-05 23:19:28 +00:00
Phil Nash dfa817ae73 Just track whether last assertion passed directly, rather than deduce it from counts 2017-12-02 18:44:23 +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 da86ddc620 Fixed accidental const & formating 2017-11-27 22:28:45 +03: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
Phil Nash db44964e27 Refactored most handle() calls to more specific/ descriptive calls 2017-11-26 21:28:43 +00:00
Phil Nash 9329d97a43 Always debug-break non-inline 2017-11-23 19:14:26 +00:00
Phil Nash e4a898eaaa Removed templated StringRef ctor and added StringRef literal 2017-11-21 11:08:39 +00:00
Phil Nash fcba30569c Refactored to resetAssertionInfo() 2017-11-20 16:33:06 +00:00
Martin Hořeňovský d09fe4459d Stop recounting constant string's length on each passed assertion 2017-11-13 12:27:02 +01:00
Phil Nash 56e1075613 Introduced ReusableStringStream and removed all uses of std::ostringstream from the main path
ReusableStringStream holds a std::ostringstream internally, but only exposes the ostream interface.
It caches a pool of ostringstreams in a vector which is currently global, but will be made thread-local.

Altogether this should enable both runtime and compile-time benefits. although more work is needed to realise the compile time opportunities.
2017-11-07 18:01:10 +00: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ý 4e85267203 Add fatalErrorEncountered method to Reporter/Listener interface
An empty default implementation is provided to keep backward compatibility.
Called when signal or Structured Exception is encountered.

Related to #1005
2017-09-14 19:57:59 +02: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ý e8ec6bd73c General cleanup for C++11
Also less allocations and less stack usage on the fatal condition path
2017-08-31 11:46:37 +02:00
Martin Hořeňovský 0673b9be35 Split RNG related things into its own file
This further removes 2 function declarations from the common path
2017-08-30 15:32:44 +02:00
Martin Hořeňovský dd8e79c529 Streamline includes in external interfaces 2017-08-29 16:44:02 +02:00
Martin Hořeňovský 92444d8b72 Remove catch_context.h from the common include path 2017-08-29 15:36:09 +02:00
Phil Nash b1d0085796 Tweaked how failedButOk assertions are recorded
- fixes issue where sections in !shouldfail or !mayfail test cases that have failing assertions where marked as failed instead of failedButOk
2017-08-25 11:33:40 +01:00
Phil Nash 684cbb2631 Fixes issue with fatal errors and non-failing assertions
Fixes #990
2017-08-10 17:10:13 +01:00
Phil Nash 97c06ca6fb Merge branch 'reevaluate' into dev-modernize 2017-08-10 16:18:05 +01:00
Martin Hořeňovský aa42dd92d1 Merge branch 'master' into dev-modernize 2017-08-10 11:34:26 +02:00
Phil Nash 7df290dfc1 Integrated new AssertionHandler into unexpected exception handling in RunContext 2017-08-09 08:49:59 +01:00
Phil Nash f247ce5bff First cut of new AssertionHandler/ Decomposer
- integrated into INTERNAL_CATCH_TEST. Needs more work to fully replace existing stuff
2017-08-08 17:53:01 +01:00
Phil Nash 59f9bcf1ed Reduced AssertionInfo to a pure record type 2017-08-08 01:08:07 +01:00
Phil Nash 5e60050299 Removed default ctors for AssertionInfo, AssertionResult and SourceLineInfo 2017-08-08 01:02:24 +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ý feca97dfde Split out internal error macros from the common path 2017-08-01 18:46:33 +02:00
Martin Hořeňovský 1a96175bb2 Split out helper functions on std::string from catch_common.h 2017-07-25 21:57:35 +02:00
Martin Hořeňovský 4a1e898eae More method bodies moved out of line 2017-07-19 15:32:58 +02:00
Phil Nash 01a21f67f7 Converted a load of spelt out iterators to auto 2017-07-18 08:08:17 +01:00
Martin Hořeňovský 7ccf11da29 Split out catch_run_context into cpp and hpp file 2017-07-15 16:48:21 +02:00