|
Boost Users : |
From: Paul Giaccone (paulg_at_[hidden])
Date: 2005-11-01 08:09:35
Is the use of BOOST_CHECK_EQUAL not permitted in
init_unit_test_suite(int argc, char* argv[])?
The following code throws an exception and reports the error "Boost.Test
internal framework error: unknown reason"
boost::unit_test::test_suite* init_unit_test_suite(int argc, char*
argv[])
{
BOOST_CHECK_EQUAL(foo(argc, argv), 0);
boost::unit_test::test_suite* test = BOOST_TEST_SUITE("My test");
test -> add(BOOST_TEST_CASE(&test1));
test -> add(BOOST_TEST_CASE(&test2));
return test;
}
when the following works without any problems:
boost::unit_test::test_suite* init_unit_test_suite(int argc, char*
argv[])
{
int result = foo(argc, argv);
assert(result == 0);
boost::unit_test::test_suite* test = BOOST_TEST_SUITE("My test");
test -> add(BOOST_TEST_CASE(&test1));
test -> add(BOOST_TEST_CASE(&test2));
return test;
}
I have no problem with using the latter code, but I am surprised that I
get an exception in the former code and that it is caught by "..." and
not by the library. If BOOST_CHECK_EQUAL (and BOOST_CHECK,
BOOST_CHECK_CLOSE, etc) is not allowed in init_unit_test_suite(), is
this fact documented? Should it generate an exception that can be
caught by the library and reported with a useful message?
Thanks,
Paul
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