
29 Dec
2017
29 Dec
'17
9:33 a.m.
Hi all, I am trying to find a way to make the boost unit test framework use an absolute difference for floating point comparison instead of the relative difference. I searched the documentation to try to find a suitable decorator but couldn’t find anything. Any help is much appreciated! #define BOOST_TEST_MODULE example #include <boost/test/included/unit_test.hpp> // boost::unit_test::tolerance uses relative difference and hence this test will pass; // is there anything I can use here to indicate absolute difference? BOOST_AUTO_TEST_CASE(my_test, * boost::unit_test::tolerance(0.1) ) { BOOST_TEST(10.1 == 10.3); }