]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/test/doc/examples/tolerance_03.run-fail.cpp
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)
6 // See http://www.boost.org/libs/test for the library home page.
9 #define BOOST_TEST_MODULE tolerance_03
10 #include <boost/test/included/unit_test.hpp>
11 namespace utf
= boost::unit_test
;
16 BOOST_AUTO_TEST_CASE(passing
, * utf::tolerance(0.0001))
18 BOOST_TEST(x
== x
+ d
); // equal with tolerance
19 BOOST_TEST(x
>= x
+ d
); // ==> greater-or-equal
21 BOOST_TEST(d
== .0); // small with tolerance
24 BOOST_AUTO_TEST_CASE(failing
, * utf::tolerance(0.0001))
26 BOOST_TEST(x
- d
< x
); // less, but still too close
27 BOOST_TEST(x
- d
!= x
); // unequal but too close
29 BOOST_TEST(d
> .0); // positive, but too small
30 BOOST_TEST(d
< .0); // not sufficiently negative