int main () { CppUnit::TextTestRunner runner; runner.addTest(CStringTest::suite()); runner.run(); return 0; }
int main(int argc, char *argv[]) { CppUnit::TextTestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); return !runner.run(); }
int main(int argc, char *argv[]) { Logging::Logger::setGlobalLogger(new Logging::GenericLogger("PropertyTestLogger")); CppUnit::TextTestRunner runner; runner.addTest( PropertyTestCase::suite() ); runner.run("",false,true,false); }
//CPPUNIT_TEST_SUITE_REGISTRATION(mystringTest); int main() { CppUnit::Test *test = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextTestRunner runner; runner.addTest(test); runner.run(); return 0; }
int main(int argc, char* argv[]) { ofstream outputFile("./summary.xml"); CppUnit::TextTestRunner runner; CppUnit::XmlOutputter* outputter = new CppUnit::XmlOutputter(&runner.result(), outputFile, std::string("UTF-8")); runner.setOutputter(outputter); CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest(registry.makeTest()); bool result = runner.run("", false); return result ? 0 : 1; }
int main() { CppUnit::TextTestRunner runner; CppUnit::Test* tp = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); runner.addTest(tp); if (runner.run()) { return 0; } else { return 1; } }
/* // === FUNCTION ====================================================================== // Name: main // Description: test driver // ===================================================================================== */ int main(int argc, char *argv[]) { /* 这部分代码一般是固定的,测试用例的多少是由CPPUNIT_TEST_SUITE_REGISTRATION宏决定的 */ /* 通过执行代码,可以发现base_test的3个测试用例被测试了两遍,这也就是为什么当我们打算使用derived_test模型进行测试的时候,就不应该再注册base_test模型的原因 */ CppUnit::Test *test = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextTestRunner runner; runner.addTest(test); runner.run(); /* log4cpp用法实例 */ log4cpp_demo(); return EXIT_SUCCESS; } // ---------- end of function main ----------
int main(int /*argc*/, char** /*argv*/) { CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextTestRunner runner; runner.addTest( suite ); runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); bool wasSucessful = runner.run(); return wasSucessful ? 0 : 1; }
void OsiTransportTest::run() { // Do processing here CppUnit::TextTestRunner runner; runner.addTest(test1); runner.addTest(test2); runner.addTest(test3); runner.run(); std::ofstream outFile("testResult.xml"); CppUnit::XmlOutputter outputer(&runner.result(), outFile); outputer.write(); emit finished(); }
int main(int argc, char **argv) { MooseInit init(argc, argv); registerApp(MissekatApp); CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextTestRunner runner; runner.addTest(suite); std::ofstream out; // If you run with --xml, output will be sent to an xml file instead of the screen if (argc == 2 && std::string(argv[1]) == std::string("--xml")) { runner.setOutputter ( new CppUnit::XmlOutputter( &runner.result(), out ) ); out.open("test_results.xml"); } else { // Note: upon calling setOutputter, any previous outputter is // destroyed. The TextTestRunner assumes ownership of the outputter, so you // don't have to worry about deleting it. runner.setOutputter ( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); } bool wasSucessful = runner.run(/*testPath=*/"", /*doWait=*/false, /*doPrintResult=*/true, /*doPrintProgress=*/false); return wasSucessful ? 0 : 1; }
int main(int argc, char* argv[]) { // Get the top level suite from the registry CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); // Adds the test to the list of test to run CppUnit::TextTestRunner runner; runner.addTest( suite ); // Change the default outputter to a compiler error format outputter runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); // Run the tests. bool wasSucessful = runner.run(); // Return error code 1 if the one of test failed. return wasSucessful ? 0 : 1; }
int main() { CppUnit::TextTestRunner runner; CppUnit::Test* tp = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); /** * How can i either add the testsuite or whatever to produce better visual results. */ runner.addTest(tp); //runner.run("",false,true,true); if ( runner.run() ) { return 0; } else { return 1; } }
int main() { // Get the top level suite from the test registry CppUnit::Test* suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); // Add the test to the list of tests to run CppUnit::TextTestRunner runner; runner.addTest(suite); // Send the output to cerr when the compiler runs runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cerr)); // Actually run the thing. bool successful = runner.run(); // Return result return (successful ? 0 : 1); }
/** * Runs the unit test suites */ int main(int argc, char** argv) { try { using CppUnit::Test; Test* test = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextTestRunner runner; runner.addTest(test); runner.run(); return 0; } catch (assertexception& e) { std::cerr << e.what() << std::endl; std::abort(); } }
int main(int argc, char *argv[]) { po::options_description opt(std::string("Usage: ") + argv[0] + " [Options] [Test Path] ...\nOptions"); opt.add_options() ("help,h", "Print this help") ("verbose,v", "Verbose mode") ("test-path,t", po::value<std::vector<std::string> >(), "Specify the test path"); po::positional_options_description p; p.add("test-path", -1); po::variables_map vars; try { po::store(po::command_line_parser(argc, argv).options(opt).positional(p).run(), vars); po::notify(vars); if (vars.count("help") != 0) { std::cerr << opt << std::endl; return 1; } if (vars.count("verbose") == 0) { Logger::get_instance().set_level(Logger::LEVEL_FATAL); } } catch (std::exception &e) { std::cerr << "Error: " << e.what() << std::endl; std::cerr << opt << std::endl; return 1; } CppUnit::TextTestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); if (vars.count("test-path") > 0) { CppUnit::TestResult controller; CppUnit::TestResultCollector result; controller.addListener(&result); CppUnit::TextTestProgressListener progress; controller.addListener(&progress); const std::vector<std::string> &v = vars["test-path"].as<std::vector<std::string> >(); BOOST_FOREACH(std::string i, v) { std::cout << i << " "; try { runner.run(controller, i); } catch (std::invalid_argument &e) { std::cerr << "ERROR: " << e.what() << std::endl; return 1; } }
int main( int argc, char *argv[] ) { CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); if ( (argc > 2) || ((argc > 1) && (string(argv[1]) == "--help")) ) { string app( argv[0] ); cout << "Usage: " << app.substr( app.find_last_of('/') + 1 ) << " [test_case]" << endl << "Test cases:" << endl; for ( int i = 0; i < suite->getChildTestCount(); ++i ) cout << " " << suite->getChildTestAt(i)->getName() << endl; return 0; } CppUnit::TextTestRunner runner; runner.addTest( suite ); return runner.run( (argc > 1) ? argv[1] : "" ) ? 0 : 1; }
int main(int argc, char *argv[]) { LoggingProxy::ProcessName("AlarmSourceTestCase"); LoggingProxy *m_logger = new LoggingProxy (0, 0, 31, 0); LoggingProxy::init (m_logger); // initialize the AlarmSystemInterfaceFactory ACSAlarmSystemInterfaceFactory::init(NULL); CppUnit::TextTestRunner runner; runner.addTest( AcsAlarmTestCase::suite() ); runner.run("",false,true,false); // close the AlarmSystemInterfaceFactory ACSAlarmSystemInterfaceFactory::done(); m_logger->flush(); LoggingProxy::done(); delete m_logger; }
//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; }
int main(/*int argc, char ** argv*/) { // UnitTest CppUnit::TextTestRunner runner; runner.setOutputter(CppUnit::CompilerOutputter::defaultOutputter(&runner.result(), std::cerr)); CppUnit::BriefTestProgressListener progress; runner.eventManager().addListener( &progress ); CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); runner.run(); return 0; }
int main(int argc, char *argv[]) { ARX_UNUSED(argc); ARX_UNUSED(argv); CppUnit::TextTestRunner runner; runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cout, "%f:%l ")); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.run(""); CppUnit::TestResultCollector & result = runner.result(); return result.wasSuccessful() ? EXIT_SUCCESS : EXIT_FAILURE; }
int main (int argc, char *argv[]) { // Start MPI if this is a parallel build. #if RUNMPI == true MPI_Init(&argc, &argv); #endif // Print a header message. #if RUNMPI == true if (MPICommons::isMaster()) { CppUnit::stdCOut() << std::endl << "Running KMCLib C++ unit tests on " << MPICommons::size() << " MPI processes." << std::endl; } #else CppUnit::stdCOut() << std::endl << "Running KMCLib C++ unit tests." << std::endl; #endif // Setup the tests. CppUnit::Test *test = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextTestRunner runner; runner.addTest(test); // Add our custom outputter. runner.setOutputter( new CustomOutputter(&runner.result(), std::cout) ); // Add our custom progress listener. CppUnit::TestResult & event_manager = runner.eventManager(); CustomProgressListener progress; event_manager.addListener( &progress ); // Run the tests. runner.run(std::string(""), false, true, false); // Remove the progress listener. event_manager.removeListener( &progress ); // Finalize if MPI. #if RUNMPI == true MPI_Finalize(); #endif // DONE return 0; }
int MWorksCoreTestMain(int argc, char *argv[]) { if (argc < 2) { std::cerr << "Usage: " << argv[0] << " results_file [test_name ...]" << std::endl; return 2; } if (NULL != getenv("MWORKS_PAUSE_FOR_DEBUGGER")) { std::cerr << "Waiting for debugger to attach..."; pause(); std::cerr << " continuing" << std::endl; } CppUnit::TextTestRunner runner; std::ofstream outfile( argv[1] ); CppUnit::XmlOutputter *outputter = new CppUnit::XmlOutputter(&runner.result(), outfile); runner.setOutputter(outputter); MWorksTestProgressListener listener; runner.eventManager().addListener( &listener ); CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry("Unit Test"); runner.addTest( registry.makeTest() ); bool returnval = true; if (argc > 2) { // Run specified tests for (int i = 2; i < argc; i++) { returnval = runner.run( argv[i], false, false, false ) && returnval; } } else { // Run all tests returnval = runner.run( "", false, false, false ); } outputter->write(); outfile.close(); // return !returnval because it is 1 on success return !returnval; }
int main(int argc,char **argv) { //setup the test runner CppUnit::TextTestRunner runner; CppUnit::TextTestProgressListener progress; CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest(registry.makeTest()); runner.eventManager().addListener(&progress); std::ofstream os("unittest.xml"); runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(),os)); bool result = runner.run(); return result ? 0 : 1; }
int main(int argc, char ** argv) { #if defined(_WIN32) && !defined(__CYGWIN__) Agelena::Loggers::DefaultWindowsLogger logger; #else Agelena::Loggers::DefaultPOSIXLogger logger; #endif // UnitTest CppUnit::TextTestRunner runner; runner.setOutputter(CppUnit::CompilerOutputter::defaultOutputter(&runner.result(), std::cerr)); CppUnit::BriefTestProgressListener progress; runner.eventManager().addListener( &progress ); CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); runner.run(); return 0; }
int main(int argc, char ** argv) { #if defined(_WIN32) && !defined(__CYGWIN__) Agelena::Loggers::DefaultWindowsLogger logger; #else Agelena::Loggers::DefaultPOSIXLogger logger; #endif if (argc > 1) cert_path__ = boost::filesystem::path(argv[1], boost::filesystem::native); else std::cerr << "No path to the SSL certificate for the tests was specified - test won't be performed" << std::endl;; // UnitTest CppUnit::TextTestRunner runner; runner.setOutputter(CppUnit::CompilerOutputter::defaultOutputter(&runner.result(), std::cerr)); CppUnit::BriefTestProgressListener progress; runner.eventManager().addListener( &progress ); CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); runner.run(); return 0; }
int main() { CppUnit::TextTestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); bool result = runner.run(); return result ? 0 : 1; }
int main(int argc, char* argv[]) { atexit(cleanup); printf("\nRing Daemon Test Suite, by Savoir-faire Linux 2004-2015\n\n"); setConsoleLog(true); setDebugMode(true); ring::fileutils::FileHandle f(ring::fileutils::create_pidfile()); if (f.fd == -1) { fprintf(stderr, "An dring instance is already running, quitting...\n"); return 1; } int argvIndex = 1; bool xmlOutput = false; if (argc > 1) { if (strcmp("--help", argv[1]) == 0) { argvIndex++; CPPUNIT_NS::Test* suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry("All Tests").makeTest(); int testSuiteCount = suite->getChildTestCount(); printf("Usage: test [OPTIONS] [TEST_SUITE]\n"); printf("\nOptions:\n"); printf(" --xml - Output results in an XML file, instead of standard output.\n"); printf(" --debug - Debug mode\n"); printf(" --help - Print help\n"); printf("\nAvailable test suites:\n"); for (int i = 0; i < testSuiteCount; i++) { printf(" - %s\n", suite->getChildTestAt(i)->getName().c_str()); } return 0; } else if (strcmp("--debug", argv[1]) == 0) { argvIndex++; setDebugMode(true); RING_INFO("Debug mode activated"); } else if (strcmp("--xml", argv[1]) == 0) { argvIndex++; xmlOutput = true; RING_INFO("Using XML output"); } } // Default test suite : all tests std::string testSuiteName = "All Tests"; if (argvIndex < argc) { testSuiteName = argv[argvIndex]; argvIndex++; } printf("\n\n=== SFLphone initialization ===\n\n"); backup(); ring::Manager::instance().init(CONFIG_SAMPLE); // Get the top level suite from the registry printf("\n\n=== Test Suite: %s ===\n\n", testSuiteName.c_str()); CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry(testSuiteName).makeTest(); if (suite->getChildTestCount() == 0) { RING_ERR("Invalid test suite name: %s", testSuiteName.c_str()); restore(); return 1; } // Adds the test to the list of test to run CppUnit::TextTestRunner runner; runner.addTest(suite); /* Specify XML output */ std::ofstream outfile("cppunitresults.xml"); if (xmlOutput) { CppUnit::XmlOutputter* outputter = new CppUnit::XmlOutputter(&runner.result(), outfile); runner.setOutputter(outputter); } else { // Change the default outputter to a compiler error format outputter runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cerr)); } // Run the tests. bool wasSuccessful = runner.run(); printf("=== Test suite ending ===\n"); ring::Manager::instance().finish(); restore(); return wasSuccessful ? 0 : 1; }
int main(int arg, char **argv) { CppUnit::TextTestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); return runner.run("", false); }
int main() { CppUnit::TextTestRunner runner; runner.addTest(EncodeCdataTest::suite()); return (runner.run() ? 0 : 1); }
int main() { CppUnit::TextTestRunner runner; runner.addTest(EncodeHeaderParameterTest::suite()); return (runner.run() ? 0 : 1); };