]>
git.proxmox.com Git - ceph.git/blob - 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)
6 // See http://www.boost.org/libs/test for the library home page.
9 #define BOOST_TEST_MODULE Unit_test_example_07
10 #include <boost/test/unit_test.hpp>
11 #include <boost/mpl/list.hpp>
13 //____________________________________________________________________________//
16 F() : i( 9 ) { BOOST_TEST_MESSAGE( "setup fixture" ); }
17 ~F() { BOOST_TEST_MESSAGE( "teardown fixture" ); }
22 //____________________________________________________________________________//
24 BOOST_FIXTURE_TEST_SUITE( s
, F
)
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
)
31 T t
= static_cast<T
>(i
);
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 );
38 BOOST_AUTO_TEST_SUITE_END()
40 //____________________________________________________________________________//