These tools are used to check that supplied values is small enough. The "smallness" is defined by absolute value of the tolerance supplied as a second argument. Note that to use these tools you need to include additional header floating_point_comparison.hpp. Use these tools with caution. To compare to values on closeness it's preferable to use BOOST_<level>_CLOSE tools.
The first parameter is the value to check. The second parameter is the tolerance .
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp> BOOST_AUTO_TEST_CASE( test ) { double v = -1.23456e-3; BOOST_CHECK_SMALL( v, 0.000001 ); }
Running 1 test case...
test.cpp(9): error in "test": absolute value of v{-0.00123456}
exceeds 1e-06
*** 1 failure detected in test suite "Master
Test Suite"