0

I want to automatically generate a lot of test functions. I am using cpptest tool where the standard way to add test is

TEST_ADD(MyTest::test1)
TEST_ADD(MyTest::test2)
...
TEST_ADD(MyTest::test100)

where I need to manually write test functions from void test1(){...} to void test100(){...}. I want to change this to be like this

for(i=0;i<100;i++)
    TEST_ADD(MyTest::test(i))

but TEST_ADD does not support functions with parameters. I had idea to automatically generate cpp file with all this 100 functions and then compile it in runtime, but this solution sounds to complicated. Is there some good way to organize such testing?

Back to the real problem, I have program with command line arguments like this

algorithmName parm1 parm2 ... parmN

I want to write unit tests to test all (or almost all) combinations of command line arguments, and each combination should be separate test in order to easily identify which combination failed. Is there some standard way to do this?

Dejan
  • 966
  • 1
  • 8
  • 26

0 Answers0