Stephen Newell
d6fce7bf34
Fix warnings generated with -Wshadow
2019-04-18 15:30:38 +02:00
Martin Hořeňovský
86da2846af
Replace most naked throws with macros from catch_enforce.h
...
This is a first step towards support a no-exceptions mode
2018-09-03 18:07:34 +02:00
Martin Hořeňovský
84fa76e985
Move Approx's validity checks out of line into cpp file
...
This avoids having to include <stdexcept> in the main include path
and speeds up the compilation if Approx is used with multiple
different types.
2018-09-03 10:15:51 +02:00
Henry Schreiner
283e2e6d41
Add float/int literal for Approx
2018-07-15 17:03:12 +02: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ý
22ac9d2184
Approx cleanup: More tests, INFINITY handling, etc
2017-11-01 07:30:11 +01:00
Pfiffikus
00af677577
Approx rework: default scale == 0, epsilon applies to Approx::value
...
Also adds check to Approx::epsilon that the new epsilon has a valid
(ie one between 0 and 1)
Based on
http://realtimecollisiondetection.net/blog/?p=89
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://en.wikipedia.org/wiki/Approximation_error#Formal_Definition
The given epsilon should refer to the target value, otherwise
the result would be unexpected, e.g. 101.02 == Approx(100).epsilon(0.01)
is true.
The default scale should be invisible, thus,
e.g. 101.01 == Approx(100).epsilon(0.01) gets false.
Finally even 101.000001 == Approx(100).epsilon(0.01) is false
2017-10-31 15:43:42 +01:00
Phil Nash
2eb93f47f7
enclosed more min/ max in parentheses to default MFC macros
2017-10-13 13:46:39 +01: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ý
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ý
edbe122761
Split out non-templated Approx methods into cpp file
2017-07-19 13:40:00 +02:00