int main(int argc, char**const argv) { #ifndef _WIN32 setenv("SOFTHSM2_CONF", "./softhsm2.conf", 1); #else setenv("SOFTHSM2_CONF", ".\\softhsm2.conf", 1); #endif CPPUNIT_NS::TestFactoryRegistry ®istry( CPPUNIT_NS::TestFactoryRegistry::getRegistry() ); CPPUNIT_NS::TextTestRunner runner; runner.addTest(registry.makeTest()); if ( argc<2 ) { return runner.run() ? 0 : 1; } if ( std::string("direct").find(*(argv+1))==std::string::npos ) { return runner.run(*(argv+1)) ? 0 : 1; } runner.addTest(registry.makeTest()); CPPUNIT_NS::TestResult controller; CPPUNIT_NS::TestResultCollector result; controller.addListener( &result ); MyListener progress; controller.addListener( &progress ); runner.run(controller); return result.wasSuccessful() ? 0 : 1; }
int main(int argc, char** argv) { (void)argc; (void)argv; # ifdef USING_XML_OUTPUT CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); CPPUNIT_NS::TextTestRunner runner; std::ofstream stream("tests.xml"); CPPUNIT_NS::XmlOutputter* xml = new CPPUNIT_NS::XmlOutputter(&runner.result(),stream); xml->setStyleSheet("report.xsl"); runner.setOutputter(xml); runner.addTest( suite ); //return runner.run() ? 0 : 1; bool result = runner.run(); //as they may fail lets not brake a build yet just report the error //return 0; return !result; # else CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); runner.run( "", false ); //as they may fail lets not brake a build yet just report the error //return 0; return !runner.run( "", false ); # endif }
int main ( int argc, char *argv[] ) { CPPUNIT_NS::TextTestRunner runner; CPPUNIT_NS::CompilerOutputter outputter(&runner.result(), std::cerr); runner.setOutputter(&outputter); runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest()); runner.run("", true); return 0; }
int main(int argc, char* argv[]) { std::ofstream xmlout("DasherTest.xml"); CPPUNIT_NS::TextTestRunner runner; CPPUNIT_NS::XmlOutputter *outputter = new CPPUNIT_NS::XmlOutputter(&runner.result(), xmlout); runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); runner.run( "", false ); outputter->write(); utils::printMood(runner.result().wasSuccessful()); return runner.result().wasSuccessful() ? 0 : 1; }
int main(int argc, char* argv[]) { // Get the top level suite from the registry CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); // Adds the test to the list of test to run CPPUNIT_NS::TextTestRunner runner; runner.addTest( suite ); // Change the default outputter to a compiler error format outputter runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(), std::cout ) ); // Run the test. bool wasSucessful = runner.run(); // Return error code 1 if the one of test failed. return wasSucessful ? 0 : 1; }
/** The main function of the UnitTest (text version) * * \param argc The number of command-line arguments * \param argv The command-line arguments array * */ int main(int argc, char* argv[]) { Logger::getSingleton().setLogType(RainbruRPG::Exception::LOG_FILE); Logger::getSingleton().setFilename("RainbruRPG-tests.log"); LOGI("Starting text version of unit tests"); CPPUNIT_NS::TextTestRunner runner; CPPUNIT_NS::TestSuite suite("RPG"); initRPGSuite(&suite); runner.addTest(&suite); runner.run("", false, true, true); return 0; }