On Wed, 2007-05-23 at 00:17 -0400, Gennadiy Rozental wrote:
unit_test_example_04.cpp:
#define BOOST_TEST_MODULE Unit_test_example_04 #include
//____________________________________________________________________________//
// automatically registered test cases could be organized in test suites BOOST_AUTO_TEST_SUITE( my_suite1 );
BOOST_AUTO_TEST_CASE( my_test1 ) { BOOST_CHECK( 2 == 1 ); }
//____________________________________________________________________________//
// this test case belongs to suite1 test suite BOOST_AUTO_TEST_CASE( my_test2 ) { int i = 0;
BOOST_CHECK_EQUAL( i, 2 );
BOOST_CHECK_EQUAL( i, 0 ); }
BOOST_AUTO_TEST_SUITE_END();
//____________________________________________________________________________//
// this test case belongs to master test suite BOOST_AUTO_TEST_CASE( my_test3 ) { int i = 0;
BOOST_CHECK_EQUAL( i, 0 ); }
//____________________________________________________________________________//
BOOST_AUTO_TEST_SUITE( my_suite2 );
// this test case belongs to suite2 test suite BOOST_AUTO_TEST_CASE( my_test4 ) { int i = 0;
BOOST_CHECK_EQUAL( i, 1 ); }
BOOST_AUTO_TEST_SUITE_END();
//____________________________________________________________________________//
// EOF
If you need you can have hierarchy of any depth.
Gennadiy
I could not see the following files in the web documentation since their link is broken. Who should I tell? http://www.boost.org/libs/test/example/unit_test_example1.cpp http://www.boost.org/libs/test/example/unit_test_example2.cpp http://www.boost.org/libs/test/example/unit_test_example3.cpp http://www.boost.org/libs/test/example/unit_test_example4.cpp http://www.boost.org/libs/test/example/unit_test_example5.cpp Thanks for the help. Stephen