int main(int /*argc*/, char ** /*argv*/) { Util::init(); CppUnit::TestResult controller; CppUnit::TestResultCollector result; controller.addListener(&result); CppUnit::BriefTestProgressListener progress; controller.addListener(&progress); CppUnit::TestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.run(controller); std::ofstream fileStream("cppunit_results.xml"); CppUnit::XmlOutputter xmlOutput(&result, fileStream, "UTF-8"); xmlOutput.write(); CppUnit::TextOutputter textOutput(&result, std::cout); textOutput.write(); return 0; }
int main(int argc, char ** argv) { Util::init(); const std::string testPath = (argc > 1) ? std::string(argv[1]) : ""; CppUnit::TestResult controller; CppUnit::TestResultCollector result; controller.addListener(&result); CppUnit::BriefTestProgressListener progress; controller.addListener(&progress); CppUnit::TestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.run(controller, testPath); std::ofstream fileStream("cppunit_results.xml"); CppUnit::XmlOutputter xmlOutput(&result, fileStream, "UTF-8"); xmlOutput.write(); CppUnit::TextOutputter textOutput(&result, std::cout); textOutput.write(); return result.wasSuccessful() ? 0 : 1; }