Home | Libraries | People | FAQ | More |
BOOST_PARAM_TEST_CASE(
fn
,
begin
, end
)
creates a series of test cases that invoking the callable object fn
on the items in the collection defined by begin
and end
. The test case returned by BOOST_PARAM_TEST_CASE
must be added to a test suite in an initialization function for the tests
to be executed. The iterators begin
and end
must be valid at the time the test case executes and not just at the time
the test case is created.
using namespace boost::unit_test; static void does_not_insert_text(std::string const& text) { std::ostringstream dest; hello_world(dest); BOOST_REQUIRE_NE(text, dest.str()); } static std::vector<std::string> text; static test_suite* init(int argc, char* argv[]) { text.push_back("scooby"); text.push_back("shaggy"); text.push_back("foo"); text.push_back("arg"); framework::master_test_suite() .add(BOOST_PARAM_TEST_CASE(does_not_insert_text, text.begin(), text.end())); return 0; } int main(int argc, char* argv[]) { return unit_test_main(init, argc, argv); }