]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | ||
6 | // See http://www.boost.org/libs/test for the library home page. | |
7 | ||
8 | //[example_code | |
9 | #define BOOST_TEST_MODULE tolerance_01 | |
10 | #include <boost/test/included/unit_test.hpp> | |
11 | namespace utf = boost::unit_test; | |
12 | ||
13 | BOOST_AUTO_TEST_CASE(test1, * utf::tolerance(0.00001)) | |
14 | { | |
15 | double x = 10.0000000; | |
16 | double y = 10.0000001; | |
17 | double z = 10.001; | |
18 | BOOST_TEST(x == y); // irrelevant difference | |
19 | BOOST_TEST(x == z); // relevant difference | |
20 | } | |
21 | //] |