Boost C++ Libraries: Ticket #6749: PARAM_TEST_CASE works poorly with abstract objects https://svn.boost.org/trac10/ticket/6749 <p> Using abstract classes as arguments to tests works poorly and requires a workaround: </p> <pre class="wiki">#include &lt;boost/test/included/unit_test.hpp&gt; #include &lt;boost/test/parameterized_test.hpp&gt; #include &lt;boost/test/unit_test_suite.hpp&gt; #include &lt;boost/ptr_container/ptr_vector.hpp&gt; using namespace boost::unit_test; class F { public: virtual void foo()=0; virtual ~F(); }; struct D : public F { void foo() {} }; void test(const F&amp;) {} void test2(const F*) {} test_suite* init_unit_test_suite() { boost::ptr_vector&lt;F&gt; params; params.push_back(new D); // borks // boost::unit_test::framework::master_test_suite(). // add( BOOST_PARAM_TEST_CASE( &amp;test, params.begin(), params.end())); F* f = new D; F* arr[] = {f}; framework::master_test_suite(). add( BOOST_PARAM_TEST_CASE( &amp;test2, arr, arr + 1)); return 0; } </pre><p> It would be nice this weren't required as it adds the additional burden of maintaining memory on the test author and the tests cases shouldn't be required to work on pointers. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6749 Trac 1.4.3 Gennadiy Rozental Mon, 05 Nov 2012 03:20:47 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6749#comment:1 https://svn.boost.org/trac10/ticket/6749#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Please try new data driven test case feature, which is going to be used from now on to replace parameterized test cases. It is more generic, but require newer compilers. I am notgonna invest time at this point improving old deprecated interface. </p> Ticket