The TestRunner :: run () method, which you most likely call in main (), actually has optional parameters: run (std :: string testName = "", bool doWait = false, bool doPrintResult = true, bool doPrintProgress = true ), testName must be the specific name of the test. You can request a specific test by name if you wish. You can also call runTest (Test *) for a specific test or runTestByName (testName).
But it looks like you want to become more sophisticated. Assuming you have registered all of your tests with the macros CPPUNIT_TEST_SUITE_REGISTRATION (), the static TestFactoryRegistry :: makeTest () method will return TestSuite for all registered tests.
The TestSuite object gives a vector through the getTests () method. You can scroll them by matching their names with a regular expression (either by index number or, if you want), and instead of calling TestRunner :: addTest (registry.makeTest ()) on the whole package, as most people do, you simply add which you are requesting.
You will need to write something to go through the tests and do the mapping, but other than that it should be dead simple. Perhaps a dozen lines of code, as well as parsing command line arguments. Use boost: regex and boost :: regex_match to make it easier for you if you have boost installed.
source share