I've been using CppUnit happily for a while now but I have been a bit frustrated by one particular lack for which I haven't been able to come with a workaround.
What I would like to be able to do is to set up a vector or array containing sets of numerical values, and then pass each set of values to a test method.
At present, I do this using a for loop inside a TestMethod. This has the disadvantage that CPPUNIT_FAIL will cause remaining tests not to be executed. So although it picks up failures fine, it gives no indication of the spread of the errors throughout the array.
What I thought might be the correct solution was to extend the TestCaller class. I thought about having TestCallerIndexed, and adding a TestCaller::runTest(int index) method that would somehow pass an integer value to the TestMethod assigned to the TestFixture. But then I thought that this probably wouldn't work - because the TestMethod prototype would have changed, so it wouldn't be possible to assign it to the TestFixture.
Has anyone else had similar problems, and worked out a nice solution that they would care to share?
I'll cross-post this on the CppUnit-devel list.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.