]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/test/doc/examples/example08.run-fail.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / test / doc / examples / example08.run-fail.cpp
CommitLineData
7c673cae
FG
1// (C) Copyright Gennadiy Rozental 2011-2015.
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_ALTERNATIVE_INIT_API
10#include <boost/test/included/unit_test.hpp>
11#include <boost/test/floating_point_comparison.hpp>
12#include <boost/test/parameterized_test.hpp>
13#include <boost/bind.hpp>
14using namespace boost::unit_test;
15namespace tt=boost::test_tools;
16using namespace boost;
17
18class test_class {
19public:
20 void test_method( double d )
21 {
22 BOOST_TEST( d * 100 == (double)(int)(d*100), tt::tolerance(0.0001) );
23 }
24} tester;
25
26bool init_unit_test()
27{
28 double params[] = { 1., 1.1, 1.01, 1.001, 1.0001 };
29
30 boost::function<void (double)> test_method = bind( &test_class::test_method, &tester, _1);
31
32 framework::master_test_suite().
33 add( BOOST_PARAM_TEST_CASE( test_method, params, params+5 ) );
34
35 return true;
36}
37//]