Boost logo

Boost Users :

Subject: [Boost-users] unit test BOOST_CHECK_CLOSE absolute
From: Renaud Lepère (lepere.renaud_at_[hidden])
Date: 2015-01-10 08:09:52

I am doing unit tests using boost utf but I have sometimes problems with
BOOST_CHECK_SMALL because it checks relative value.

For example, I am comparing coordinates in 2d spaces and the relative
value is not important, the meaningfull value is the absolute difference
between coordinates.

I have seen that I can do a
BOOST_CHECK_SMALL(fabs(x - expected_x), 1e-3);

but in this can I don't have a good message when the test fails (it does
not show the value of x and the expected_x).

In fact I would like to have something like BOOST_CHECK_CLOSE_ABSOLUTE ?
Is there something equivalent or how can I do something like this ?

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at