18 #include <cppunit/BriefTestProgressListener.h> 19 #include <cppunit/CompilerOutputter.h> 20 #include <cppunit/TestResult.h> 21 #include <cppunit/TestResultCollector.h> 22 #include <cppunit/TestRunner.h> 23 #include <cppunit/XmlOutputter.h> 24 #include <cppunit/extensions/TestFactoryRegistry.h> 30 int main(
int argc,
char* argv[])
34 string testPath = (argc > 1) ?
string(argv[1]) : string(
"");
37 CPPUNIT_NS::TestResult controller;
40 CPPUNIT_NS::TestResultCollector result;
41 controller.addListener(&result);
44 CPPUNIT_NS::BriefTestProgressListener progress;
45 controller.addListener(&progress);
48 CPPUNIT_NS::TestRunner runner;
49 runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
53 CPPUNIT_NS::stdCOut() <<
"Running " << (testPath.empty() ?
"all tests" : testPath) << endl;
54 runner.run(controller, testPath);
55 CPPUNIT_NS::stdCOut() << endl;
58 CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
62 ofstream file(
"ninka-Tests-Results.xml");
63 CPPUNIT_NS::XmlOutputter xml(&result, file);
66 }
catch (invalid_argument& e)
68 CPPUNIT_NS::stdCOut() << endl <<
"ERROR: " << e.what() << endl;
72 return result.wasSuccessful() ? 0 : 1;
int main(int argc, char *argv[])