Consider this CPPUNIT test class meant to do the same test (doTest
) but with different arguments:
class MyTest : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE( MyTest );
CPPUNIT_TEST( test1 );
CPPUNIT_TEST( test2 );
CPPUNIT_TEST( test3 );
CPPUNIT_TEST_SUITE_END();
public:
MyTest();
void test1() { doTest(1); }
void test2() { doTest(2); }
void test3() { doTest(3); }
void doTest( int param );
};
Is there no way to change that to avoid having to declare test1
, test2
and test3
, with something like:
class MyTest : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE( MyTest );
CPPUNIT_TEST_PARAM( doTest, 1 ); // CPPUNIT_TEST_PARAM does not exits, it's just to illustrate my need
CPPUNIT_TEST_PARAM( doTest, 2 ); // CPPUNIT_TEST_PARAM does not exits, it's just to illustrate my need
CPPUNIT_TEST_PARAM( doTest, 3 ); // CPPUNIT_TEST_PARAM does not exits, it's just to illustrate my need
CPPUNIT_TEST_SUITE_END();
public:
MyTest();
void doTest( int param );
};
Aucun commentaire:
Enregistrer un commentaire