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; }
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::TextUi::TestRunner 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 test. bool wasSucessful = runner.run(); // Return error code 1 if the one of test failed. return wasSucessful ? 0 : 1; }
int main(int argc, char *argv[]) { #if ENABLE_CORBA Astro::OrbSingleton orb(argc, argv); #endif /* ENABLE_CORBA */ int c; while (EOF != (c = getopt(argc, argv, "d"))) switch (c) { case 'd': debuglevel = LOG_DEBUG; break; } CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest(registry.makeTest()); bool wasSuccessful = runner.run("", false); return (wasSuccessful) ? 0 : 1; }
int main(){ CPPUNIT_TEST_SUITE_REGISTRATION(BookTest); //if to devide tests in unit //CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(); CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry (); runner.addTest(registry.makeTest()); /* //replace this CppUnit::TextUi::TestRunner runner; runner.addTest(BookTest::suite()); */ if(runner.run()){ return 0; }else{ return 1; } }
/* void runTests() { QxCppUnit::TestRunner runner; runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); runner.run( ); } */ int main( int argc, char **argv ) { CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextUi::TestRunner runner; runner.addTest( suite ); runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); bool wasSucessful = runner.run(); return wasSucessful ? 0 : 1; // Create the QtTestRunner: // QApplication app(argc, argv); // runTests(); // return app.exec(); }
// If TestSuite is not changes, the following code don't need to change. int main() { CppUnit::TestResult r; CppUnit::TestResultCollector listener; CppUnit::TestResultCollector result; r.addListener(&listener); r.addListener(&result); CppUnit::TextUi::TestRunner runner; //Get test suit. CppUnit::Test *test = CppUnit::TestFactoryRegistry::getRegistry("alltest").makeTest(); // Add this test suit to test runner. runner.addTest( test ); //output log to run.log file. std::ofstream ofile; ofile.open("run.log"); CppUnit::TextOutputter outputter(&listener, ofile);; //This would occur code dumped.reason unkonwn. //runner.setOutputter(&outputter); //output result to result.xml. std::ofstream file( "result.xml" ); CppUnit::XmlOutputter xml( &result, file ); //run the test runner. runner.run(r); //write to file. outputter.write(); xml.write(); //close ofstream. ofile.close(); file.close(); //output test results to console. CppUnit::TextOutputter o(&listener, std::cout); o.write(); return listener.wasSuccessful() ? 0 : -1; }
int main(int argc, char *argv[]) { CppUnit::TextUi::TestRunner runner; runner.addTest(BoilerplateTest::suite()); runner.addTest(BolStateTest::suite()); runner.addTest(CharSourceTest::suite()); runner.addTest(CKeywordTest::suite()); runner.addTest(CMetricsCalculatorTest::suite()); runner.addTest(CyclomaticTest::suite()); runner.addTest(DescriptiveTest::suite()); runner.addTest(HalsteadTest::suite()); runner.addTest(NestingLevelTest::suite()); runner.addTest(QualityMetricsTest::suite()); runner.run(); return 0; }
int main(int /*argc*/, char** /*argv*/) { CppUnit::TestResult controller; CppUnit::TestResultCollector result; CppUnit::TextUi::TestRunner runner; controller.addListener(&result); CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest(registry.makeTest()); runner.run(controller); std::ofstream xmlFileOut("test-results.xml"); CppUnit::XmlOutputter xmlOut(&result, xmlFileOut); xmlOut.write(); CryptoFactory::reset(); return result.wasSuccessful() ? 0 : 1; }
FRAME_ROOMSERVER_NAMESPACE_BEGIN int StartUnitTest() { //CTestCaseUtil testUtil; //testUtil.RunTestCase1(); CppUnit::TextUi::TestRunner runner; //CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); // Adds the test to the list of test to run //runner.addTest( suite ); //std::fstream fileRead("vibrancyserver.ini");//open file //std::string strLine; //while (getline(fileRead,strLine))//read line in file until end //{ // CppUnit::TestFactoryRegistry ®= CppUnit::TestFactoryRegistry::getRegistry(strLine.c_str()); // runner.addTest(reg.makeTest()); //} //fileRead.close(); std::ifstream ifs("roomserver.ini"); std::string strLine; while (ifs >> strLine) { CppUnit::TestFactoryRegistry ®= CppUnit::TestFactoryRegistry::getRegistry(strLine.c_str()); runner.addTest(reg.makeTest()); } //CppUnit::TestFactoryRegistry ®= CppUnit::TestFactoryRegistry::getRegistry("vibrancyserver"); //runner.addTest(reg.makeTest()); // Change the default outputter to a compiler error format outputter std::ofstream file("roomserver_testresult.log"); //runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),std::cerr ) ); runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),file ) ); // Run the tests. bool wasSucessful = runner.run(); return 0; }
int main(int argc, char* argv[]) { try { spdlog::level::level_enum level = spdlog::level::info; std::vector<spdlog::sink_ptr> sinks; sinks.push_back(std::make_shared<spdlog::sinks::stdout_sink_st>()); spdlog::set_level(level); // if new logger required, must add to here! const char *loglist[] = { "main", "ClientConnection", "ServerListener", "LinearMemoryPool", "BlockedMemoryPool", "UserSession", "" }; for (int i = 0; strcmp("", loglist[i]) != 0; i++) { auto combined_logger = std::make_shared<spdlog::logger>(loglist[i], begin(sinks), end(sinks)); combined_logger->set_level(level); spdlog::register_logger(combined_logger); } } catch (const spdlog::spdlog_ex& ex) { cerr << "Log failed: " << ex.what() << endl; } // 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::TextUi::TestRunner 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(int argc, char *argv[]) { CppUnit::TextUi::TestRunner runner; CppUnit::TestSuite *suite = new CppUnit::TestSuite(); suite->addTest(new CppUnit::TestCaller<Reverse_IntegerTest>( "test1", &Reverse_IntegerTest::test1)); suite->addTest(new CppUnit::TestCaller<Reverse_IntegerTest>( "test2", &Reverse_IntegerTest::test2)); suite->addTest(new CppUnit::TestCaller<Reverse_IntegerTest>( "test3", &Reverse_IntegerTest::test3)); suite->addTest(new CppUnit::TestCaller<Reverse_IntegerTest>( "test4", &Reverse_IntegerTest::test4)); suite->addTest(new CppUnit::TestCaller<Reverse_IntegerTest>( "test5", &Reverse_IntegerTest::test5)); runner.addTest(suite); runner.run("", true); return 0; }
int main(int argc, char** argv) { CppUnit::TextUi::TestRunner runner; // Control tests. CppUnit::TestFactoryRegistry& registry(CppUnit::TestFactoryRegistry::getRegistry()); runner.addTest(registry.makeTest()); bool wasSucessful; try { wasSucessful = runner.run("",false); } catch(string& rFailure) { cerr << "Caught a string exception from test suites.: \n"; cerr << rFailure << endl; wasSucessful = false; } return !wasSucessful; }
int main(int argc, char* argv[]) { // Get the top level suite from the registry CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); // Add test CppUnit::TextUi::TestRunner runner; runner.addTest( suite ); // Change default outputter to a compiler error format outputter runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); // Run tests bool wasSucessful = runner.run(); // while(1); // Error code 1 if any tests failed return wasSucessful ? 0 : 1; }
int main(int argc, char **argv) { QApplication app(argc, argv, false); // compilers always write file names into manifest in Utf8 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("Utf8")); QTextCodec::setCodecForLocale(QTextCodec::codecForName("Utf8")); init(argv); Resources res(Constants::getResourcesFilePath()); CppUnit::TextUi::TestRunner runner; runner.addTest( GeneratedScriptTest::suite() ); runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); runner.run(); }
int main() { #ifdef ANTIOCH_HAVE_CPPUNIT CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); // If the tests all succeed, report success if (runner.run()) return 0; // If any test fails report failure return 1; #else // If we don't have CPPUnit, report we skipped // 77 return code tells Automake we skipped this. return 77; #endif // ANTIOCH_HAVE_CPPUNIT }
int main(int argc, char *argv[]) { int i; for (i=1; i<argc; i++) { char *tok = strtok(argv[i], " "); if (tok) { char *str; str = strstr(tok, "="); if (str) putenv(tok); } } CppUnit::TextUi::TestRunner runner; bool all = true; for (i=1; i<argc; i++) { if ('-' == argv[i][0]) { } else { if (!strstr(argv[i], "=")) { CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry (argv[i]); runner.addTest (registry.makeTest ()); all = false; } } } if (all) runner.addTest (CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cerr)); bool wasSuccessful = runner.run(); return wasSuccessful ? 0: 1; }
int _tmain(int argc, _TCHAR* argv[]) { CppUnit::TextUi::TestRunner runner; #ifdef _DEBUG std::ofstream outputFile("..\\output\\debug\\UnitTest_Results.xml"); #else std::ofstream outputFile("..\\output\\release\\UnitTest_Results.xml"); #endif CppUnit::Outputter *myoutputter; myoutputter = new CppUnit::XmlOutputter(&runner.result(), outputFile, "UTF-8"); runner.setOutputter(myoutputter); CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry("UCUnitTest"); runner.addTest( registry.makeTest() ); runner.run(); return 0; }
int main(int argc, char *argv[]) { // constexpr size_t directory_size = 1<<10; // constexpr std::uint32_t mod_value = 1<<31; // multicore_hash::abstract_hash<hash_value_t> *hash = new multicore_hash::mod_hash<hash_value_t, mod_value>(); // multicore_hash::abstract_hash_table *hash_table = new multicore_hash::array_hash_table<directory_size>(hash); // ycsb::workload *workload = new ycsb::workload(); // ycsb::worker w(*hash_table, *workload, ycsb::workload_a); CppUnit::TextUi::TestRunner runner; runner.addTest( multicore_hash::extendible_hash_table_test::suite() ); runner.addTest( multicore_hash::array_hash_table_test::suite() ); runner.run(); // delete hash; // delete hash_table; // delete workload; }
int main(int argc, char* argv[]) { // Get the top level suite from the registry //CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TestSuite *unitSuite = new CppUnit::TestSuite( "All unit test" ); unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("VarTableTest").makeTest()); unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("ProcTableTest").makeTest()); unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("ModifiesTest").makeTest()); unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("UsesTest").makeTest()); CppUnit::TestFactoryRegistry::getRegistry().addTestToSuite(unitSuite); CppUnit::TextUi::TestRunner runner; runner.addTest(unitSuite); bool wasSucessful = runner.run(); //cin.get(); getchar(); return wasSucessful ? 0 : 1; }
/**main function for CX unit tests. * Perform system-wide init/deinit, * run all registered tests. */ int main(int argc, char **argv) { QApplication app(argc, argv); CppUnit::TextUi::TestRunner runner; CppUnit::BriefTestProgressListener listener; runner.eventManager().addListener( &listener ); #ifdef RUN_ALL_TESTS CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); #else // runner.addTest( new CppUnit::TestCaller<cxTestSpeed>( // "init", // &cxTestSpeed::testKaisaSpeed ) ); //runner.addTest(TestVisualization::suite()); #endif bool failed = runner.run(); return !failed; }
int main(int argc, char* argv[]) { // Get the top level suite from the registry CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextUi::TestRunner runner; //parse the SIMPLE soource code into the parser //Parse(); //Call of DesignExtractor //Extract(); runner.addTest(suite); bool wasSucessful = runner.run(); //getchar(); return wasSucessful ? 0 : 1; }
int main(int argc, char **argv) { CppUnit::TextUi::TestRunner tester; tester.addTest(ReverseRectIteratorTest::suite()); //tester.addTest(NodePoolTest::suite()); tester.addTest(InfluenceMapTest::suite()); tester.addTest(CircularBufferTest::suite()); tester.addTest(FixedPointTest::suite()); // tester.addTest(ChecksumTest::suite()); tester.addTest(MinHeapTest::suite()); tester.addTest(LineAlgorithmTest::suite()); bool res = tester.run(); #ifdef WIN32 char line[256]; std::cout << "[Enter] to exit."; std::cin.getline(line,256); #endif return (res)? 0: 1; // for ctest }
/**main function for CX unit tests. * Perform system-wide init/deinit, * run all registered tests. */ int main(int argc, char **argv) { QApplication app(argc, argv); CppUnit::TextUi::TestRunner runner; CppUnit::BriefTestProgressListener listener; runner.eventManager().addListener( &listener ); #ifdef RUN_ALL_TESTS CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); #else runner.addTest( new CppUnit::TestCaller<cxTestExamples>( "identity transform", &cxTestExamples::testIdentityTransform ) ); runner.addTest(cxTestExamples::suite()); #endif bool failed = runner.run(); return !failed; }
INITIALIZE_EASYLOGGINGPP int main(int argc, const char * argv[]) { START_EASYLOGGINGPP(argc, argv); el::Configurations defaultConf; defaultConf.setToDefault(); // Values are always std::string defaultConf.setGlobally(el::ConfigurationType::Format, "%datetime %level %fbase:%line %msg"); // default logger uses default configurations el::Loggers::reconfigureLogger("default", defaultConf); el::Configurations performanceConf; performanceConf.setToDefault(); performanceConf.set(el::Level::Info, el::ConfigurationType::Format, "%msg"); performanceConf.set(el::Level::Info,el::ConfigurationType::Filename,"../performance.log"); /// TODO make output file include version number of this upcoming release //performanceConf.set(el::Level::Info,el::ConfigurationType::MillisecondsWidth,"6"); el::Loggers::reconfigureLogger("performance", performanceConf); el::Loggers::addFlag(el::LoggingFlag::FixedTimeFormat); // ensures performance numbers are always quoted as seconds, never formatted LOG(INFO) << "In tests main"; /// TODO delete performance.csv before running tests //CppUnit::TestResult controller; //CppUnit::TestResultCollector collector; //controller.addListener(&collector); //CppUnit::BriefTestProgressListener progress; //controller.addListener(&progress); CppUnit::TextUi::TestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); bool wasSuccessful = runner.run( "", false ); return wasSuccessful; }
int main(int argc, char* argv[]) { // Configure logging output brics_3d::Logger::setMinLoglevel(brics_3d::Logger::WARNING); /*see also: http://cppunit.sourceforge.net/doc/lastest/money_example.html#sec_running_test */ // 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::TextUi::TestRunner runner; runner.addTest(suite); // Check the set parameters. bool useXmlOutput = false; if (argc == 2) { std::string parameter = argv[1]; if (parameter.compare("--report-xml") == 0) { useXmlOutput = true; } } // Decide which output format to take. std::ofstream outputStream; if (useXmlOutput) { // Change the default outputter to a XML outputter outputStream.open("unit_test_results.xml"); runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), outputStream, std::string("ISO-8859-1"))); } else { // 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(int argc, char* argv[]) { /* // Get the top level suite from the registry CppUnit::TestSuite *unitSuite = new CppUnit::TestSuite( "All unit test" ); unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("VarTableTest").makeTest()); unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("ParserTest").makeTest()); unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("QueryPreprocessorTest").makeTest()); unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("ProcTableTest").makeTest()); CppUnit::TestFactoryRegistry::getRegistry().addTestToSuite(unitSuite); CppUnit::TextUi::TestRunner runner; */ CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); CppUnit::TextUi::TestRunner runner; runner.addTest(suite); bool wasSucessful = runner.run(); //getchar(); return wasSucessful ? 0 : 1; }
int main() { CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry(); CppUnit::TestResult controller; CppUnit::TestResultCollector result; controller.addListener(&result); runner.addTest(registry.makeTest()); std::ofstream xmlout("results.xml"); CppUnit::XmlOutputter out(&result, xmlout); CppUnit::TextOutputter console(&result, std::cout); runner.run(controller, ""); out.write(); console.write(); return result.wasSuccessful()? 0: 1; }
int main( int argc, char* argv[] ) { ProjetUnivers::Kernel::Parameters::load("display.config") ; ProjetUnivers::Kernel::Log::init() ; ProjetUnivers::Physic::start() ; // if command line contains "-selftest" then this is the post build check // => the output must be in the compiler error format. bool selfTest = (argc > 1) && (std::string("-selftest") == argv[1]); std::string test_name ; if (argc > 1) test_name = argv[1] ; CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); // Define the file that will store the XML output. std::ofstream outputFile("tests_display.xml"); CppUnit::MultiOutputter* outputter = new CppUnit::MultiOutputter() ; outputter->add(new CppUnit::CompilerOutputter(&runner.result(),std::cerr,"test/%f:%l: ")) ; outputter->add(new ProjetUnivers::Kernel::XmlOutputter(&runner,outputFile,"Display")) ; runner.setOutputter(outputter); // Run the test. bool wasSucessful = runner.run(test_name); ProjetUnivers::Display::terminate() ; ProjetUnivers::Kernel::Log::close() ; // Return error code 1 if the one of test failed. return wasSucessful ? 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(); CppUnit::TextUi::TestRunner runner; //parse the SIMPLE soource code into the parser //Parse(); string t; Parser* parser; PKBController* controller; parser = new Parser("../Debug/Sample-Source.txt"); controller = parser->controller; //string query = "assign a; Select a pattern a(\"oSCar\", \"1 + beta + tmp\" )"; string query = "assign a; Select a pattern a(\"oSCar\", \"_\" )"; QueryParser* qp = new QueryParser(query); QueryEvaluator* qe = new QueryEvaluator(controller); qp->getQueryTree()->printTree(); cout << qp->getQueryTree()->getRootNode()->getChild(2)->getKey() << endl;; cin >> t; //Call of DesignExtractor //Extract(); runner.addTest(suite); bool wasSucessful = runner.run(); //getchar(); return wasSucessful ? 0 : 1; }
int main(int argc, char* argv[]) { if (argc > 2 || (argc > 1 && !strcmp(argv[1], "--help"))) { printf("Usage: RunTestBin [--help|test_to_run]\n"); exit(0); } #ifdef SHOW_MEMORY_BREAK void* initialbreak = sbrk(0); #endif // 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::TextUi::TestRunner 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(argc > 1 ? argv[1] : ""); #ifdef SHOW_MEMORY_BREAK void* finalbreak = sbrk(0); uint32_t deltabreak = ((uint32_t)finalbreak) - ((uint32_t)initialbreak); printf("Change in memory break = %u kB\n", deltabreak / 1024); #ifdef USE_MEMORY_DEBUGGER printf("Memory allocated at exit: %u\n", total_allocated); #endif #endif // Return error code 1 if the one of test failed. return wasSucessful ? 0 : 1; }