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.
It is almost never true. Related error gives you much better estimate of closeness.
I agree with that most of the time but this is not always true. Just imagine the case you compare lattitude, longitude. In this case, only absolute values make sense.
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 ?
Don't. Specify relative tolerance (or percent tolerance) and keep using BOOST_CHECK_CLOSE.
Relative tolerance will give me false bug report, I want a point to be equal to (0, 0) with a small absolute error and I don't care if it is -1e-15 or +1e-10 so BOOST_CHECK_CLOSE is not an option here and I have to use BOOST_CHECK_SMALL with the absolute difference. The problem with BOOST_CHECK_SMALL(fabs(x - expected_x), 1e-3); Is that when it fails with the message that does not print the values "x" and "expected_x" and does not say something like x(2.0) is not equal to "expected_x(0.0)" with an difference of 1e-3. I can probably write my own macro combining BOOST_TEST_MESSAGE() and some glues to obtain what I want but I was wondering if someone had the same problem and a solution. Thanks Renaud