Boost logo

Boost :

Subject: Re: [boost] [test] BOOST_TEST - universal testing tool
From: Rhys Ulerich (rhys.ulerich_at_[hidden])
Date: 2012-11-06 06:12:42


>> 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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk