]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/test/example/unit_test_example_07.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / test / example / unit_test_example_07.cpp
1 // (C) Copyright Gennadiy Rozental 2005-2014.
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 // Boost.Test
9 #define BOOST_TEST_MODULE Unit_test_example_07
10 #include <boost/test/unit_test.hpp>
11 #include <boost/mpl/list.hpp>
12
13 //____________________________________________________________________________//
14
15 struct F {
16 F() : i( 9 ) { BOOST_TEST_MESSAGE( "setup fixture" ); }
17 ~F() { BOOST_TEST_MESSAGE( "teardown fixture" ); }
18
19 int i;
20 };
21
22 //____________________________________________________________________________//
23
24 BOOST_FIXTURE_TEST_SUITE( s, F )
25
26 typedef boost::mpl::list<char,int const,float,const double> test_types;
27 // this test case template produce a separate test case for each type listed in test_types
28 // each produced test case uses struct F as a fixture
29 BOOST_AUTO_TEST_CASE_TEMPLATE( my_test, T, test_types )
30 {
31 T t = static_cast<T>(i);
32
33 // usually it's a bad idea to use BOOST_CHECK_EQUAL for checking equality values of
34 // floating point types. This check may or may not produce an error report
35 BOOST_TEST( (t*t+t)/10 == 9 );
36 }
37
38 BOOST_AUTO_TEST_SUITE_END()
39
40 //____________________________________________________________________________//
41
42 // EOF