
6 Nov
2012
6 Nov
'12
11:12 a.m.
BOOST_TEST(a == 0.003, unit_test::percent_tolerance(1e-6) );
It turned out that for around 95% of the checks on floating-point values we need the very same (percent) tolerance. And it is inconvenient to have to type the same constant time and again. It would be nice if there was a way to define (as an option) a "default tolerance".
Could you simply macro-up the default tolerance? #define MY_TEST_WITH_DEFAULT_TOLERANCE(expr) \ BOOST_TEST(expr, unit_test::percent_tolerance(whatever)) - Rhys