本文整理汇总了C++中cppunit::textui::TestRunner::addTest方法的典型用法代码示例。如果您正苦于以下问题:C++ TestRunner::addTest方法的具体用法?C++ TestRunner::addTest怎么用?C++ TestRunner::addTest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cppunit::textui::TestRunner
的用法示例。
在下文中一共展示了TestRunner::addTest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
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;
}
示例2: main
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;
}
示例3: main
/**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;
}
示例4: main
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;
}
示例5: outputFile
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;
}
示例6: main
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;
}
示例7: main
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;
}
示例8: main
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;
}
示例9: main
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;
}
示例10: main
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;
}
示例11: main
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;
}
示例12: main
int main(int argc, char* argv[])
{
#ifdef USE_GENEPI
SemilinSetNdd::genepi_init();
#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();
//SemilinSetNdd::genepi_dealloc();
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}
示例13: main
//#include "singleton_testcase.h"
//#include "../patterns/worker.h"
//using namespace improve;
int main( int argc, char* argv[] )
{
{
// singleton_testcase::instance();
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
runner.run();
/*
exception_collector* collector_ptr=exception_collector::instance();
for (int i=collector_ptr->size(); i>0 ; --i)
{
std::cout<<collector_ptr->top()<<std::endl;
collector_ptr->pop();
}
*/
}
// system("pause");
return 0;
}
示例14: run_cppunit
int run_cppunit(int argc, char **argv)
{
int ret = 1;
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactory ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
MyListener *listener = 0;
for (int i1 = 1; i1 < argc; ++i1)
if (strcmp (argv[1], "--show-name") == 0)
runner.eventManager().addListener(listener = new MyListener());
#ifndef __BORLANDC__ // @todo
for (int i2 = 1; i2 < argc; ++i2)
if (strcmp (argv[i2], "--compiler-output") == 0)
runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter(&runner.result(), MOCKPP_STD_NS::cerr ) );
#endif
ret = runner.run() ? 0 : 1;
delete listener;
return ret;
}
示例15: xmlFileOut
int
main(int argc, char **argv)
{
CppUnit::TestResult controller;
CppUnit::TestResultCollector result;
CppUnit::TextUi::TestRunner runner;
runner.addTest(cuda::Tests::suite());
strcpy(cuda::Tests::filename, argv[2]);
if (argc == 3 && strcmp(argv[1], "-i") == 0)
{
controller.addListener(&result);
runner.run(controller);
std::ofstream xmlFileOut("cuda_results.xml");
CppUnit::XmlOutputter xmlOut(&result, xmlFileOut);
xmlOut.write();
}
else if (argc == 4 && strcmp(argv[3], "-o") == 0)
runner.run();
else
std::cout<<"Usage "<<argv[0]<<" -i <test filename>\n -o";
return 0;
}