23 Nov
2010
23 Nov
'10
6:55 a.m.
Anders Wang Kristensen
If either entry is zero, I can use BOOST_CHECK_SMALL instead with an absolute error:
if (ref==0.0 || val==0.0) BOOST_CHECK_SMALL(ref - val, absolute_error); else BOOST_CHECK_CLOSE(ref, val, relative_error);
But is this really the best way to do this?
Looks reasonable
And if this is the standard way of doing this, shouldn't there be function in boost.test for automating this, like: BOOST_CHECK_NEAR(ref, value, relative_error, absolute_error);
This may or may not be generally useful. And it does not write specifica variation you need for yourself. Gennadiy