int main(int argc, char **argv) { CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); CppUnit::CompilerOutputter *outputter = new CppUnit::CompilerOutputter(&runner.result(), std::cout); outputter->setLocationFormat("%p(%l) : "); //outputter->setWrapColumn(19); outputter->setNoWrap(); runner.setOutputter(outputter); bool wasSuccessful = runner.run("", false, // doWait true, // doPrintResult true // doPrintProgress ); return !wasSuccessful; }
//CPPUNIT_TEST_SUITE_REGISTRATION(mystringTest); int main() { CppUnit::Test *test = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextTestRunner runner; runner.addTest(test); //new for formatting const std::string format("%p:%l"); std::ofstream ofile; ofile.open("run.log"); CppUnit::CompilerOutputter* outputter = new CppUnit::CompilerOutputter(&runner.result(),ofile); outputter->setLocationFormat(format); runner.setOutputter(outputter); runner.run(); ofile.close(); return 0; }