Boost logo

Boost Users :

From: Stephen Torri (storri_at_[hidden])
Date: 2007-05-22 23:04:11


I would link to have one file that has multiple test suites. Right now I
have one test suite for all the various tests. I tried to find an
example of what I want to do on the boost.org site. There was nothing
close to what I wanted. If such a page exists its not easy to find. The
close I came to was to create a test_suite for each group and add the
test. That is as far as I have gotten. I did find an exampe that use
BOOST_AUTO_TEST_CASE but there was only one test suite in it. Here is
what I have so far. Is there plans to have a more comprehensive
documentation on how to use the boost test library? Can users provide
more examples?

Stephen

BOOST_AUTO_TEST_CASE(test_result_reports)
{
// test_suite*
// init_unit_test_suite ( int, char** )
// {
    test_suite* test1 = BOOST_TEST_SUITE ("Memory Map constructors");

    // Allow Memory_Map to allocate our memory at any location
    test1->add ( BOOST_TEST_CASE ( &test_default_constructor ) );

    test_suite* test2 = BOOST_TEST_SUITE ("Memory Map seek (pass)");
    test2->add ( BOOST_TEST_CASE ( &test_seek_PASS_LOW_SEEK ) );
    test2->add ( BOOST_TEST_CASE ( &test_seek_PASS_HIGH_SEEK ) );

    test_suite* test3 = BOOST_TEST_SUITE ("Memory Map seek (fail)");
    test3->add ( BOOST_TEST_CASE ( &test_seek_FAIL_HIGH_SEEK ) );
    test3->add ( BOOST_TEST_CASE ( &test_read_FAIL_EMPTY_READ ) );

    test_suite* test4 = BOOST_TEST_SUITE ("Memory Map copy");
    test4->add ( BOOST_TEST_CASE ( &test_copy ) );

    test_suite* test5 = BOOST_TEST_SUITE ("Memory Map read tests");
    test5->add ( BOOST_TEST_CASE ( &test_uint8_read ) );
    test5->add ( BOOST_TEST_CASE ( &test_uint16_read ) );
    test5->add ( BOOST_TEST_CASE ( &test_uint32_read ) );
    test5->add ( BOOST_TEST_CASE ( &test_uint64_read ) );

    test_suite* test6 = BOOST_TEST_SUITE ("Memory Map address tests");
    test6->add ( BOOST_TEST_CASE ( &test_seek_ADDRESS_PASS_LOW ) );
    test6->add ( BOOST_TEST_CASE ( &test_seek_ADDRESS_PASS_HIGH ) );
    test6->add ( BOOST_TEST_CASE ( &test_seek_ADDRESS_FAIL_LOW ) );
    test6->add ( BOOST_TEST_CASE ( &test_seek_ADDRESS_FAIL_HIGH ) );

    test_suite* test7 = BOOST_TEST_SUITE ("Memory Map empty name");
    test7->add ( BOOST_TEST_CASE ( &test_empty_name ) );

    test_suite* test8 = BOOST_TEST_SUITE ("Memory Map subset");
    test8->add ( BOOST_TEST_CASE ( &test_subset ) );

    //return test;
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net