tolerance_01.run-fail.cpp 627 B

123456789101112131415161718192021
  1. // Copyright (c) 2015 Boost.Test team
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //[example_code
  7. #define BOOST_TEST_MODULE tolerance_01
  8. #include <boost/test/included/unit_test.hpp>
  9. namespace utf = boost::unit_test;
  10. BOOST_AUTO_TEST_CASE(test1, * utf::tolerance(0.00001))
  11. {
  12. double x = 10.0000000;
  13. double y = 10.0000001;
  14. double z = 10.001;
  15. BOOST_TEST(x == y); // irrelevant difference
  16. BOOST_TEST(x == z); // relevant difference
  17. }
  18. //]