Commit Graph

32 Commits

Author SHA1 Message Date
Martin Hořeňovský
597fca3c89 Remove <algorithm> header from the common path
It was only used for std::max<double> within Approx, so we now have
::Catch::Detail::max(double, double) that is used instead.
2017-08-17 20:04:53 +02:00
Martin Hořeňovský
6d4673505d Add missing <algorithm> include in catch_approx.hpp 2017-08-01 22:02:00 +02:00
Martin Hořeňovský
a40add3153 Clean up Approx to take arguments by const& 2017-07-27 11:32:04 +02:00
Martin Hořeňovský
ab0f1dcde9 Remove superfluous include 2017-07-27 11:32:03 +02:00
Martin Hořeňovský
edbe122761 Split out non-templated Approx methods into cpp file 2017-07-19 13:40:00 +02:00
Martin Hořeňovský
67914d8b86 Move back to static StringMaker<T>::convert
This avoids some breakage from the modernization
2017-05-21 23:40:05 +02:00
Martin Hořeňovský
33ed1773f4 Reworked stringification layer, removed Catch::toString
Now the order of stringification checks is

1) StringMaker specialization
2) operator<<

toString overloads and specializations have been removed.
2017-05-02 23:51:03 +02: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ý
2fdd81a33f Removed C++98 backcompat from Approx
Now it always uses type traits to work with all types convertible to
double
2017-04-25 11:11:26 +02:00
Martin Hořeňovský
a34c053f0a All of Approx's member functions now accept strong typedefs
Previously `Approx::operator()`, `Approx::epsilon`, `Approx::margin` and
`Approx::scale` didn't.

Closes #888
2017-04-24 22:01:45 +02:00
Martin Hořeňovský
0354d50278 Added templated constructor to C++11 Approx
When using C++11, comparison operators are already templated to take
anything that can be explicitly converted to double, but constructor
took only doubles. This lead to warnings when an `Approx` was
constructed from floats, which was problematic for some users.

Since just adding float constructor would be a large breaking change, as
suddenly `Approx( 1 )` would become ambiguous, I added a templated
constructor that will take anything that is explicitly convertible to
double. This has the added benefit of allowing constructing `Approx`
instances from instances of strong typedefs, ie allowing
`calculated_temp == Approx( known_temp)`.

Closes #873
2017-04-04 15:19:15 +02:00
Martin Hořeňovský
d5c623b3b6 Merge branch 'develop' of https://github.com/CNugteren/Catch
This adds an optional absolute margin to the Approx checks.
2017-02-27 13:12:13 +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ý
60a9ac7e65 Enabled previous commit under MSVC, introduced new feature toggle 2017-01-26 18:47:29 +01:00
Jonathan Coe
c06afe438e Add support for comparison of Approx with strong typedefs
closes #652
2017-01-26 18:44:03 +01:00
Jonathan B. Coe
37e1e24309 add support for inequalities 2017-01-08 22:28:53 +01:00
CNugteren
3523c39f44 Changed 'auto' into 'bool' for C++98 compatibility 2015-11-12 15:31:42 +01:00
cnugteren
2585d280d1 Added an optional absolute margin to the approximation checks 2015-11-12 15:11:36 +01:00
Phil Nash
97150f27ac Renamed catch_tostring.hpp catch_tostring.h
- in preparation for splitting implementation into catch_tostring.hpp
2014-04-23 06:51:58 +01:00
Phil Nash
1aa60fada9 Changed Approx::toString() to be implemented in terms of toString( double ) (as proposed in #233) 2013-12-19 18:41:55 +00:00
Phil Nash
1e2f1d1603 Fixes toString forward reference issue:
- as raised in https://github.com/philsquared/Catch/pull/195
2013-09-14 19:58:45 +01:00
Phil Nash
f3d1f08c3b Removed all trailing whitespace
- addresses #105
2013-07-03 19:14:59 +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
6730512afa Refactoring ResultData out of ResultInfo/ Builder pt2 2012-10-09 11:48:55 +01:00
Phil Nash
2efc1146bf Reformatting 2012-05-15 07:42:26 +01:00
Phil Nash
2fa72a47cd Added ability to build custom Approx instance 2011-06-06 08:21:21 +01:00
Phil Nash
cae44d8ace Made Approx a little more forgiving (to 100& epsilon of float) and added some more tests for it 2011-06-03 18:56:47 +01:00
Phil Nash
6b6143ccd4 Removed templates from Approx (just uses double) 2011-05-31 07:51:04 +01:00
Phil Nash
0ea29b7d28 Started adding tests for Approx 2011-04-28 08:28:03 +01:00
Phil Nash
dfea75fc05 Allow epsilon and scale to be specified 2011-04-28 08:20:47 +01:00
Phil Nash
d7b8b01f3e Updated to use Richard Harris' approximation formula 2011-04-28 08:11:00 +01:00
Phil Nash
d7c203c3e9 Factored Approx out into own file 2011-04-28 08:03:28 +01:00