10 #include <cppunit/CompilerOutputter.h>
11 #include <cppunit/TestResult.h>
12 #include <cppunit/TestResultCollector.h>
13 #include <cppunit/TestRunner.h>
15 #include <cppunit/TextTestProgressListener.h>
17 #include <cppunit/BriefTestProgressListener.h>
19 #include <cppunit/XmlOutputter.h>
20 #include <cppunit/extensions/TestFactoryRegistry.h>
26 main(
int argc,
char* argv[] )
30 std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string(
"");
33 CPPUNIT_NS::TestResult controller;
36 CPPUNIT_NS::TestResultCollector result;
37 controller.addListener( &result );
41 CPPUNIT_NS::TextTestProgressListener progress;
43 CPPUNIT_NS::BriefTestProgressListener progress;
45 controller.addListener( &progress );
48 CPPUNIT_NS::TestRunner runner;
49 runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
52 CPPUNIT_NS::stdCOut() <<
"Running " << testPath;
53 runner.run( controller, testPath );
55 CPPUNIT_NS::stdCOut() <<
"\n";
58 CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
68 catch ( std::invalid_argument &e )
70 CPPUNIT_NS::stdCOut() <<
"\n"
71 <<
"ERROR: " << e.what()
76 return result.wasSuccessful() ? 0 : 1;
int main(int argc, char *argv[])