How to execute CPPUNIT_TEST repeatedly for multiple times in cppunittest?

169 views Asked by At

I am adding some sample code related to cppunittest. In which I want to execute myTest2 CPPUNIT_TEST for multiple times or repeatedly.OR If there are two or more classes which contains some CPPUNIT_TEST , I want to execute one of the registered test "Ex. Test1" for multiple times. How to do that?

class Test1: public CppUnit::TestFixture
{
    CPPUNIT_TEST_SUITE(Test1);
    CPPUNIT_TEST(myTest11);
    CPPUNIT_TEST(myTest12);
    CPPUNIT_TEST_SUITE_END();

public :
    void myTest11(void)
    {
        cout << "%s"<< __func__ << endl;
        CPPUNIT_ASSERT(add(10, 5));
    }
    void myTest12(void)
    {
        cout << "%s"<< __func__ << endl;
        CPPUNIT_ASSERT(sub(10, 5));
    }
};
CPPUNIT_TEST_SUITE_REGISTRATION(Test1);
0

There are 0 answers