2 Copyright 2021 Glen Joseph Fernandes
5 Distributed under the Boost Software License, Version 1.0.
6 (http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_UNITS_TEST_CLOSE_HPP
9 #define BOOST_UNITS_TEST_CLOSE_HPP
11 #include <boost/core/lightweight_test.hpp>
17 Provide a predicate for BOOST_TEST_WITH that is equivalent to
18 what was provided by the previous test framework.
22 explicit close_to(double f)
25 bool operator()(double l, double r) const {
26 return std::abs(l - r) <=
27 (std::max)(f_ * (std::max)(std::abs(l), std::abs(r)), 0.);
34 #define BOOST_UNITS_TEST_CLOSE(l,r,f) BOOST_TEST_WITH((l),(r),close_to((f)))