Boost 1.34 Unit test suite - BOOST_PARAM_TEST_CASE

Hey all, I have some code that is essentially doing what is suggested on the Parameterized free function based test case page (http://www.boost.org/libs/test/doc/components/utf/components/test_case/param...). This technique worked fine in 1.33.1 but in 1.34 I get the following error when I try to compile my test: Test.cpp: In constructor 'sub_test_suite::sub_test_suite(boost::shared_ptr<Tester>)': Test.cpp:98: error: no matching function for call to 'boost::unit_test::test_suite::test_suite()' /usr/local/include/boost-1_34/boost/test/impl/unit_test_suite.ipp:110: note: candidates are: boost::unit_test::test_suite::test_suite(boost::unit_test::const_string) /usr/local/include/boost-1_34/boost/test/unit_test_suite_impl.hpp:116: note: boost::unit_test::test_suite::test_suite(const boost::unit_test::test_suite&) I understand the reason for the error but I am not sure about what to do. Is there a new technique for using BOOST_PARAM_TEST_CASE to ensure the parameters are not destroyed until the test case is run? Thanks! Chad

"Chad Maron" <cmaron@logicworks.net> wrote in message news:82DA1BC8E3377840AAC2B22ACFAB1EE437FD4CF5@exchange3.corp.logicworks.net...
Hey all,
I have some code that is essentially doing what is suggested on the Parameterized free function based test case page (http://www.boost.org/libs/test/doc/components/utf/components/test_case/param...).
This technique worked fine in 1.33.1 but in 1.34 I get the following error when I try to compile my test:
Test.cpp: In constructor 'sub_test_suite::sub_test_suite(boost::shared_ptr<Tester>)': Test.cpp:98: error: no matching function for call to 'boost::unit_test::test_suite::test_suite()' /usr/local/include/boost-1_34/boost/test/impl/unit_test_suite.ipp:110: note: candidates are: boost::unit_test::test_suite::test_suite(boost::unit_test::const_string) /usr/local/include/boost-1_34/boost/test/unit_test_suite_impl.hpp:116: note: boost::unit_test::test_suite::test_suite(const boost::unit_test::test_suite&)
Above error has nothing to do with BOOST_PARAM_TEST_CASE
I understand the reason for the error but I am not sure about what to do
The reason is that test_suite is not default constractible.
. Is there a new technique for using BOOST_PARAM_TEST_CASE to ensure the parameters are not destroyed until the test case is run?
Please provide a simple examples that fails. Genandiy

I know the error has nothing to do with BOOST_PARAM_TEST_CASE, just like I mentioned in the sentence immediately following the error. I mention BOOST_PARAM_TEST_CASE because that is the where I found code to use to prevent the parameters from being destroyed until the test case is run. I also know the reason for the error, my question is what is the new technique for 1.34. "The user should make sure that parameters list will not be destroyed until the test case is run. That's why it not recommended to create a parameters list as local variable in init_unit_test_suite. A simple way to handle a parameters list lifetime is to place it into a user defined test suite class." - http://www.boost.org/libs/test/doc/components/utf/components/test_case/param... Again, I know this won't work in 1.34... but what will? *IS* there a new simple method for this in 1.34? How much code will I have to modify to get my tests to work with the new version? Here is an example code modeled after the examples from http://www.boost.org/libs/test/doc/components/utf/components/test_case/param... and http://www.boost.org/libs/test/doc/components/utf/components/test_case/param... ----- #include <iostream> #include <map> #include <string> #include <boost/shared_ptr.hpp> #include <boost/test/unit_test.hpp> #include <boost/test/parameterized_test.hpp> #include <boost/test/included/unit_test_framework.hpp> using boost::unit_test::test_suite; void parse_test(std::string str) { BOOST_CHECK(1); } struct sub_test_suite : public boost::unit_test::test_suite { sub_test_suite() { while(std::cin) { getline(std::cin, input_line); if(input_line.size() > 0) { queries.push_back(input_line); } } add( BOOST_PARAM_TEST_CASE( &parse_test, queries.begin(), queries.end() ), 0 ); } std::string input_line; std::vector<std::string> queries; }; test_suite* init_unit_test_suite( int, char* [] ) { test_suite* test= BOOST_TEST_SUITE( "Spirit SQL parser" ); test->add(new sub_test_suite()); return test; } -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: Wednesday, May 16, 2007 2:44 AM To: boost@lists.boost.org Subject: Re: [boost] Boost 1.34 Unit test suite - BOOST_PARAM_TEST_CASE "Chad Maron" <cmaron@logicworks.net> wrote in message news:82DA1BC8E3377840AAC2B22ACFAB1EE437FD4CF5@exchange3.corp.logicworks.net...
Hey all,
I have some code that is essentially doing what is suggested on the Parameterized free function based test case page (http://www.boost.org/libs/test/doc/components/utf/components/test_case/param...).
This technique worked fine in 1.33.1 but in 1.34 I get the following error when I try to compile my test:
Test.cpp: In constructor 'sub_test_suite::sub_test_suite(boost::shared_ptr<Tester>)': Test.cpp:98: error: no matching function for call to 'boost::unit_test::test_suite::test_suite()' /usr/local/include/boost-1_34/boost/test/impl/unit_test_suite.ipp:110: note: candidates are: boost::unit_test::test_suite::test_suite(boost::unit_test::const_string) /usr/local/include/boost-1_34/boost/test/unit_test_suite_impl.hpp:116: note: boost::unit_test::test_suite::test_suite(const boost::unit_test::test_suite&)
Above error has nothing to do with BOOST_PARAM_TEST_CASE
I understand the reason for the error but I am not sure about what to do
The reason is that test_suite is not default constractible.
. Is there a new technique for using BOOST_PARAM_TEST_CASE to ensure the parameters are not destroyed until the test case is run?
Please provide a simple examples that fails. Genandiy _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

"Chad Maron" <cmaron@logicworks.net> wrote in message news:82DA1BC8E3377840AAC2B22ACFAB1EE437FD4D1F@exchange3.corp.logicworks.net...
I know the error has nothing to do with BOOST_PARAM_TEST_CASE, just like I mentioned in the sentence immediately following the error. I mention BOOST_PARAM_TEST_CASE because that is the where I found code to use to prevent the parameters from being destroyed until the test case is run. I also know the reason for the error, my question is what is the new technique for 1.34.
"The user should make sure that parameters list will not be destroyed until the test case is run. That's why it not recommended to create a parameters list as local variable in init_unit_test_suite. A simple way to handle a parameters list lifetime is to place it into a user defined test suite class." - http://www.boost.org/libs/test/doc/components/utf/components/test_case/param...
I am sorry, but docs are not correct any more. In 1.34.0 it's safe to place parameters on init function scope. The parameter's copy is stored along with each separate test case. So you don't need a custom test suite for that purpose. If you do insist on your own test suite, provide the name in a parent test_suite constructor. Gennadiy
participants (2)
-
Chad Maron
-
Gennadiy Rozental