There is no Boost AFAIK support, so I do this:
void test_function(parameters...) { <test code> } BOOST_AUTO_TEST_CASE(test01) { test_function(parameters for case #1) } BOOST_AUTO_TEST_CASE(test02) { test_function(parameters for case #2) }
You can do this with templates if you like:
template<int I, bool B> void test_function() { for(int i=0; i<I; i++) if (B) BOOST_REQUIRE(i<10); } BOOST_AUTO_TEST_CASE(test01) { test_function<10, true>(); } BOOST_AUTO_TEST_CASE(test02) { test_function<20, false>(); }
gatopeich
source share