Commit Graph

53 Commits

Author SHA1 Message Date
Phil Nash 7fed25ad1f New Matchers implementation
- simpler
- less templates and machinery
- no cloning, copying or unnecessary heap allocations
- better factored
2017-02-14 09:16:54 +00:00
Phil Nash 67d513aa73 Removed single char contains()
- had incorrect prototype anyway
2017-02-13 08:20:45 +00:00
Martin Hořeňovský 9012f95964 Moved some std includes out from catch_common.h 2017-02-12 12:17:07 +01:00
Martin Hořeňovský d0620c3495 Added std:: qualification to some functions from C stdlib
This should solve #543, once Clara changes are in as well.
2017-02-11 23:20:09 +01:00
Martin Hořeňovský 615aa071a8 Merge branch 'dev-performance-round2' 2017-01-30 13:02:48 +01:00
Martin Hořeňovský 15816c5760 Revert "use sizeof(expr) for unevaluated syntax check"
Using sizeof(expr) can trigger a compile-time error,
"lambda expressions are not allowed in an unevaluated context", when passing
expression containing lambda, like a std algorithm. This error is considered
a standard defect, as it is meant to prevent lambdas in decltype
or templates, but not in sizeof.

This reverts commit 227598af47.
2017-01-30 11:56:29 +01:00
Martin Hořeňovský 60f8ebec49 Use const char* for filename in SourceLineInfo
This is sane, because those `const char*`s are given to us by compiler,
from the text area and thus we do not have to manage their lifetimes. We
also never want to change them.

Also moved copy constructor to compiler-generated methods, not sure why
it wasn't -- even before it was the same as a compiler would generate.
2017-01-29 22:03:27 +01:00
Martin Hořeňovský 4ce11d63a6 Merge branch 'dev-performance' 2017-01-25 22:56:36 +01:00
Mickey Rose 227598af47 use sizeof(expr) for unevaluated syntax check 2017-01-19 21:25:27 +01:00
Martin Hořeňovský 3b98a0166f Various small string usage performance improvements.
* Empty strings are now direct constructed as `std::string()`, not as empty string literals.
* `startsWith` and `endsWith` no longer construct new a string. This should be an improvement
for libstdc++ when using older standards, as it doesn't use SSO but COW and thus even short
strings are expensive to first create.
* Various places now use char literal instead of string literals containing single char.
** `startsWith` and `endsWith` now also have overload that takes single char.

Generally the performance improvements under VS2015 are small, as going from short string
to char is mostly meaningless because of SSO (Catch doesn't push string handling that hard)
and previous commit removed most string handling if tests pass, which is the expect case.
2017-01-15 10:05:01 +01:00
Phil Nash b68e8f9a24 Added missing #include so CATCH_CONFIG_COUNTER properly takes into account the current compiler.
May address #677 and #435 and others.
2017-01-11 16:27:16 +00:00
Phil Nash 13a887ad24 Use __COUNTER__ when generating unique names instead of __LINE__, if available.
Based on PR #351
2016-03-14 07:55:00 +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 72868920bb Exception message assertions now work with matchers 2015-07-15 23:02:25 +01:00
Phil Nash d87e551efa reseeds rng before each test case and provides access to seed through Catch::rngSeed() function 2015-07-02 23:02:35 +01:00
Phil Nash e86daf8bdd Reorganised C+11 feature detection a bit
and added CATCH_CONFIG_CPP11_NULLPTR for VS2015
2015-05-19 22:31:57 +01:00
Phil Nash 5eb7748a55 Changed relative #includes and made SourceLineInfo sortable (added < op) 2015-03-04 07:17:12 +00:00
Phil Nash 458b3ae257 Fixed replace(inPlace) function
and added tests (should have done that in the first place - I'll never learn!)
2014-12-19 18:16:19 +00:00
Phil Nash 12fe67cc82 Updated NonCopyable (to include C++11 version) and use for Session and Section 2014-10-03 08:15:27 +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 d7e1790347 Merge branch 'master' of https://github.com/gnzlbg/Catch
# By gnzlbg
# Via gnzlbg
* 'master' of https://github.com/gnzlbg/Catch:
  Conditionally removes usage of deprecated features

Conflicts (resolved):
	include/internal/catch_common.h
	include/internal/catch_section.hpp
2014-04-18 08:49:35 +01:00
gnzlbg ce6598599b Conditionally removes usage of deprecated features
-add macros to test for C++ version and features
to catch_compiler_capabilities.hpp
- replaces dynamic exception specifications (deprecated)
with noexcept in C++ Version >= 11
- defines defaulted copy constructor/move constructors/assignment
in C++ Version >= 11 since their implicit generation is deprecated
under some circumstances.
- fixes #259
2014-03-20 14:03:51 +01:00
Phil Nash 274ed3ea76 Allow FAIL() to be empty 2013-12-12 23:02:31 +00:00
Phil Nash a1e87a4b7d trim test/ section names in xml reporter
- BDD-style test names have leading spaces for alignment in the console reporter
2013-12-10 08:20:46 +00:00
Phil Nash 87b20e8dab SourceLineInfo takes char*s instead of std::strings 2013-12-04 08:12:30 +00: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 2ddb9d3802 Completed CumulativeReporterBase and reimplemented JUnitReporter in terms of it 2013-08-15 18:39:55 +01:00
Phil Nash f3d1f08c3b Removed all trailing whitespace
- addresses #105
2013-07-03 19:14:59 +01:00
Phil Nash bf37e6879a Removed use of compiler specific techniques for denoting non-returning functions
- use if( Catch::isTrue( true) ) to guard throws instead
2013-04-23 20:52:49 +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 2c90533a26 More formatting/ colour tweaks 2013-04-01 11:25:54 +01:00
Phil Nash 6ba2057abd refactored toLower 2013-03-22 19:00:42 +00:00
Phil Nash 17479c6e49 Tag and test case name querying are now case insensitive 2013-03-12 18:47:53 +00:00
Phil Nash e57a56bb28 Converted tabs to spaces in some files where they have crept back in 2013-03-08 09:26:20 +00:00
Phil Nash 3682433c2f console_reporter refactoring 2013-01-18 17:50:21 +00:00
Phil Nash 42aef1d99c Fairly major reworking of console reporter (still in progress).
Changed reporter interface a bit.
2013-01-13 21:51:44 +00:00
Phil Nash 6f2343bf64 Sections use vector instead of a map
Uses brute-force search, but only ever for small vectors
2012-11-29 09:17:08 +00:00
Phil Nash 81cb69ef18 AssertionInfo captures more info (for test cases and sections) 2012-11-04 21:09:22 +00:00
Phil Nash a4e088c999 Removed __FUNCTION__ from SourceLineInfo 2012-11-02 08:29:03 +00:00
Phil Nash e04e74f896 More AssertionResult refactoring 2012-10-24 21:59:47 +01:00
Phil Nash 4c97fc5619 WIldcards at both ends 2012-08-24 08:23:50 +01:00
Phil Nash 56d5c42912 First cut of new filtering mechanism 2012-08-23 20:08:50 +01:00
Phil Nash a695eb9006 Builds almost completely cleanly with -WEverything in LLVM 2012-08-13 07:46:10 +01:00
Phil Nash 02006d85d7 Disabled use of __FUNCTION__ for now 2012-07-05 23:12:22 +01:00
Phil Nash abf271672f Added NotImplementedException 2012-07-05 18:37:58 +01:00
Phil Nash 163088a11f Refactored command line parser to be more cohesive
Also added a set of unit tests for them (incomplete)
2012-05-31 19:40:26 +01:00
Phil Nash d0be9ed5d9 More reformatting 2012-05-15 08:02:36 +01:00
Phil Nash 8d69208a58 Fixed some warnings
As referenced in GitHub issue #83
2012-05-11 19:05:53 +01:00
Phil Nash d06dcedfdc Some more reformatting.
Also fixed some warnings
2012-05-09 08:17:51 +01:00
Phil Nash 5d1c8f2c6d Replaced all file/ line pairings with SourceLineInfo 2012-05-08 19:16:18 +01:00