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 06 10 #include <boost/test/unit_test.hpp> 11 12 //____________________________________________________________________________// 13 14 struct F { FF15 F() : i( 0 ) { BOOST_TEST_MESSAGE( "setup fixture" ); } ~FF16 ~F() { BOOST_TEST_MESSAGE( "teardown fixture" ); } 17 18 int i; 19 }; 20 21 //____________________________________________________________________________// 22 23 // struct F is going to be used as a fixture for all test cases in this test suite BOOST_FIXTURE_TEST_SUITE(s,F)24BOOST_FIXTURE_TEST_SUITE( s, F ) 25 26 BOOST_AUTO_TEST_CASE( my_test1 ) 27 { 28 BOOST_CHECK( i == 1 ); 29 } 30 31 //____________________________________________________________________________// 32 BOOST_AUTO_TEST_CASE(my_test2)33BOOST_AUTO_TEST_CASE( my_test2 ) 34 { 35 BOOST_CHECK_EQUAL( i, 2 ); 36 37 BOOST_CHECK_EQUAL( i, 0 ); 38 } 39 40 //____________________________________________________________________________// 41 42 BOOST_AUTO_TEST_SUITE_END() 43 44 // EOF 45