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>
25 main(
int argc,
char* argv[] )
29 std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string(
"");
32 CPPUNIT_NS::TestResult controller;
35 CPPUNIT_NS::TestResultCollector result;
36 controller.addListener( &result );
40 CPPUNIT_NS::TextTestProgressListener progress;
42 CPPUNIT_NS::BriefTestProgressListener progress;
44 controller.addListener( &progress );
47 CPPUNIT_NS::TestRunner runner;
48 runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
51 CPPUNIT_NS::stdCOut() <<
"Running " << testPath;
52 runner.run( controller, testPath );
54 CPPUNIT_NS::stdCOut() <<
"\n";
57 CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
67 catch ( std::invalid_argument &e )
69 CPPUNIT_NS::stdCOut() <<
"\n"
70 <<
"ERROR: " << e.what()
75 return result.wasSuccessful() ? 0 : 1;
int main(int argc, char *argv[])