21 #include <cppunit/CompilerOutputter.h> 22 #include <cppunit/TestResult.h> 23 #include <cppunit/TestResultCollector.h> 24 #include <cppunit/TestRunner.h> 26 #include <cppunit/TextTestProgressListener.h> 28 #include <cppunit/BriefTestProgressListener.h> 30 #include <cppunit/XmlOutputter.h> 31 #include <cppunit/extensions/TestFactoryRegistry.h> 37 main(
int argc,
char* argv[] )
41 std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string(
"");
44 CPPUNIT_NS::TestResult controller;
47 CPPUNIT_NS::TestResultCollector result;
48 controller.addListener( &result );
52 CPPUNIT_NS::TextTestProgressListener progress;
54 CPPUNIT_NS::BriefTestProgressListener progress;
56 controller.addListener( &progress );
59 CPPUNIT_NS::TestRunner runner;
60 runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
63 CPPUNIT_NS::stdCOut() <<
"Running " << testPath;
64 runner.run( controller, testPath );
66 CPPUNIT_NS::stdCOut() <<
"\n";
69 CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
79 catch ( std::invalid_argument &e )
81 CPPUNIT_NS::stdCOut() <<
"\n" 82 <<
"ERROR: " << e.what()
87 return result.wasSuccessful() ? 0 : 1;
int main(int argc, char *argv[])