Commit Graph

17 Commits

Author SHA1 Message Date
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ý bcaa2f9646 Use char literal instead of string literal with 1 char
In reality, this is a relatively small performance improvement,
especially with the previous improvements removing lots of superfluous
string handling, but still was measurable.
2017-01-29 23:07:15 +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
Alexander Ryabykin 02a69b449f Compilation warnings fix (#791)
* Compilation warnings fix

* Removed unused argument from reportFatal function
2017-01-27 09:32:58 +01:00
Martin Hořeňovský 83f4b39680 Added benchmark for previous commit, added iterations to failure bench. 2017-01-25 22:39:43 +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
Billy Robert O'Neal III c17ba0870a Fix transform without a lambda
Catch apparently supports targeting C++03, so use an inline function
instead.
2016-10-14 14:28:15 -07:00
Billy Robert O'Neal III 79f01100e3 Fix transform narrowing warnings
Catch passes ::tolower into std::transform with string iterators.
::tolower has the signature int(int), which triggers a stealth narrowing
warning inside std::transform, because transform calls
*_Dest = _Fn(*_First), which implicitly narrows an int to a char.

For this particular application the narrowing is fine, so explicitly
narrow in a lambda.
2016-10-14 14:16:21 -07: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 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 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 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 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