Boost logo

Boost :

Subject: [boost] boost-test, why is there no DOUBLES_EQUAL?
From: Sebastian Nowozin (nowozin_at_[hidden])
Date: 2011-03-29 11:20:55


Hello,

I am a regular user of the boost test library, having used CPPunit
before. I miss the following macro:

   BOOST_CHECK_DOUBLES_EQUAL(first, second, absolute_tolerance);

which would check whether "std::fabs(first-second) <=
absolute_tolerance" is true. It seems the boost test library does not
support it, and instead forces/encourages users to use

   BOOST_CHECK_CLOSE(first, second, percent_relative_tolerance);

The above macro does not really make sense in my application, I really
need to check for absolute tolerances, irrespectively of the magnitude
of the numbers.
CPPunit has this feature as DOUBLES_EQUAL.

Would you consider adding this?

Thanks,
Sebastian


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