Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

BOOST_TEST_CASE_TEMPLATE

BOOST_TEST_CASE_TEMPLATE(name, types) manually creates a set of test cases from the template test case name for each type in types. The test case returned by BOOST_TEST_CASE_TEMPLATE must be added to a test suite in an initialization function for the tests to be executed. The test case function is defined with the BOOST_TEST_CASE_TEMPLATE_FUNCTION macro.

static test_suite*
init(int argc, char* argv[])
{
    test_suite& suite(framework::master_test_suite());
    suite.add(BOOST_TEST_CASE_TEMPLATE(not_is_signed_for_unsigned_types, unsigned_types));
    suite.add(BOOST_TEST_CASE_TEMPLATE(is_signed_for_signed_types, signed_types));
    return 0;
}

int main(int argc, char* argv[])
{
    return unit_test_main(init, argc, argv);
}

Example Source Code

PrevUpHomeNext