本文整理汇总了C++中cppunit_ns::TestResult类的典型用法代码示例。如果您正苦于以下问题:C++ TestResult类的具体用法?C++ TestResult怎么用?C++ TestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char* argv[])
{
// informs test-listener about test-results
CPPUNIT_NS::TestResult testResult;
// register listener for collecting the test-results
CPPUNIT_NS::TestResultCollector collectedResults;
testResult.addListener( &collectedResults);
// register listener for per-test progress output
CPPUNIT_NS::BriefTestProgressListener progress;
testResult.addListener( &progress);
// insert test-suite at test-runner by registry
CPPUNIT_NS::TestRunner testRunner;
testRunner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
testRunner.run(testResult);
// important stuff happens next
std::ofstream xmlFileOut("reports/testResults.xml");
CPPUNIT_NS::XmlOutputter xmlOut( &collectedResults, xmlFileOut);
xmlOut.write();
// return 0 if tests were successful
return collectedResults.wasSuccessful() ? 0 : 1;
}
开发者ID:Andy-Amoy,项目名称:mr4c,代码行数:27,代码来源:Suite.cpp
示例2: main
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;
}
开发者ID:fxdupont,项目名称:SoftHSMv2,代码行数:28,代码来源:p11test.cpp
示例3: main
int main()
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener(&result);
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener(&progress);
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
runner.run(controller);
// output
CPPUNIT_NS::CompilerOutputter outputter(&result, std::cerr);
outputter.write();
// return status code
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:LibreOffice,项目名称:libetonyek,代码行数:25,代码来源:test.cpp
示例4: main
int main(int argc, char *argv[])
{
Logging::Logger::setGlobalLogger(new Logging::GenericLogger("testLogger"));
// initialize the AlarmSystemInterfaceFactory
ACSAlarmSystemInterfaceFactory::init(NULL);
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// Print test in a compiler compatible format.
std::cout.flush();
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
outputter.write();
// close the AlarmSystemInterfaceFactory
ACSAlarmSystemInterfaceFactory::done();
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:ACS-Community,项目名称:ACS,代码行数:33,代码来源:testXML.cpp
示例5: main
int main(int argc, char* argv[])
{
// Retrieve test path from command line first argument. Default to "" which resolve
// to the top level suite.
std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string("");
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that collects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener(&result);
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener(&progress);
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
runner.run(controller);
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
outputter.write();
// Uncomment this for XML output
std::ofstream file("cppunit-report.xml");
CPPUNIT_NS::XmlOutputter xml(&result, file);
xml.write();
file.close();
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:Fortress-Combat,项目名称:GriffinShowManager-core,代码行数:35,代码来源:main.cpp
示例6: run_multi_cdn_strategy_test_case
int run_multi_cdn_strategy_test_case()
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// Print test in a compiler compatible format.
std::ofstream ofs("c:\\MultiCdnTestResult.txt");
CPPUNIT_NS::CompilerOutputter outputter( &result, ofs );
outputter.write();
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:niuwei,项目名称:CdnTest,代码行数:25,代码来源:MultiCdnStrategyTestCase.cpp
示例7: main
int main(int ac,char **av)
{
enable_logging = 1;
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
CppUnit::TextUi::TestRunner runner;
// Add the top runner.to the test runner
runner.addTest( CCalendarProcs_TS1::suite() );
// runner.addTest(new CppUnit::TestCaller<ValidCTodoConstructorTestCase>(
// "test_validCTodoConstructor",
// &ValidCTodoConstructorTestCase::test_validCTodoConstructor));
runner.run( controller );
// Print test in a compiler compatible format.
std::ofstream file("dbprocs.xml");
CPPUNIT_NS::XmlOutputter xml( &result, file );
xml.setStyleSheet( "report.xsl" );
xml.write();
file.close();
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:tempura-san,项目名称:calendar-backend,代码行数:33,代码来源:dbprocs.cpp
示例8: main
int main( int ac, char **av )
{
// イベント・マネージャとテスト・コントローラを生成する
CPPUNIT_NS::TestResult controller;
// テスト結果収集リスナをコントローラにアタッチする
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// 「.」で進行状況を出力するリスナをアタッチする
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// テスト・ランナーにテスト群を与え、テストする
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// テスト結果を標準出力に吐き出す
CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
outputter.write();
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:nyanp,项目名称:STF,代码行数:25,代码来源:main.cpp
示例9: main
int main(void)
{
// informs test-listener about testresults
CPPUNIT_NS::TestResult testresult;
// register listener for collecting the test-results
CPPUNIT_NS::TestResultCollector collectedresults;
testresult.addListener(&collectedresults);
// register listener for per-test progress output
CPPUNIT_NS::BriefTestProgressListener progress;
testresult.addListener(&progress);
// insert test-suite at test-runner by registry
CPPUNIT_NS::TestRunner testrunner;
testrunner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
testrunner.run(testresult);
// output results in compiler-format
CPPUNIT_NS::CompilerOutputter compileroutputter(&collectedresults, std::cerr);
compileroutputter.write();
// return 0 if tests were successful
return collectedresults.wasSuccessful() ? 0 : 1;
}
开发者ID:RochauD,项目名称:Clusterer,代码行数:25,代码来源:TestMainConfigurationManager.cpp
示例10: main
int main(int argc, char* argv[])
{
// informs test-listener about testresults
CPPUNIT_NS::TestResult testresult;
// register listener for collecting the test-results
CPPUNIT_NS::TestResultCollector collectedresults;
testresult.addListener (&collectedresults);
// register listener for per-test progress output
CPPUNIT_NS::BriefTestProgressListener progress;
testresult.addListener (&progress);
// insert test-suite at test-runner by registry
CPPUNIT_NS::TestRunner testrunner;
testrunner.addTest (CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest ());
testrunner.run(testresult);
// output results in compiler-format
CPPUNIT_NS::CompilerOutputter compileroutputter(&collectedresults, std::cerr);
compileroutputter.write ();
// Output XML for Jenkins CPPunit plugin
ofstream xmlFileOut("cppTestBasicMathResults.xml");
XmlOutputter xmlOut(&collectedresults, xmlFileOut);
xmlOut.write();
// return 0 if tests were successful
return collectedresults.wasSuccessful() ? 0 : 1;
}
开发者ID:VenturaSolutionsInc,项目名称:framework-bulkioInterfaces,代码行数:30,代码来源:Test_2.cpp
示例11: main
int main( int argc, char **argv )
{
argc = 0;
std::cout << "Running " << argv[argc] << std::endl;
// イベントマネージャを作成する
CPPUNIT_NS::TestResult controller;
// テスト結果を収集するオブジェクトを作成する
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// テスト実行時に進行状況を表示するオブジェクトを作成する
//CPPUNIT_NS::BriefTestProgressListener progress;
//controller.addListener( &progress );
// テストランナーにテストを設定する
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry( ).makeTest( ) );
runner.run( controller );
// テスト結果を出力する
CPPUNIT_NS::TextOutputter outputter( &result, std::cout );
outputter.write( );
// テストに成功した場合に 0 を返し,失敗したら 1 を返す
return( result.wasSuccessful( ) ? 0 : 1 );
}
开发者ID:ChenglongWang,项目名称:MIST,代码行数:28,代码来源:main.cpp
示例12: outputter
int
main( int argc, char* argv[] )
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
//CPPUNIT_NS::BriefTestProgressListener progress;
//controller.addListener( &progress );
//controller.push
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
outputter.write();
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:ohwerd,项目名称:research-assignment-swen90006,代码行数:27,代码来源:main.cpp
示例13: outputter
int
main( int, char ** )
{
// create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// add a listner that collects test results
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// add a listener that prints dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
//CPPUNIT_NS::TextTestProgressListener textprog;
//controller.addListener( &textprog );
// add the top suite to the test runner.
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// output results in a compiler compatible format
CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
//CPPUNIT_NS::TextOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
//CPPUNIT_NS::XmlOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
outputter.write();
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:AaronCLH,项目名称:IEEE-SB-SETUP,代码行数:30,代码来源:test_convex_hull.cpp
示例14: main
int main(int argc, char** argv)
{
try
{
CPPUNIT_NS::TestResult controller;
CPPUNIT_NS::TestResultCollector result;
controller.addListener(&result);
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener(&progress);
CPPUNIT_NS::TestRunner runner;
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
runner.run(controller);
CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
outputter.write();
return result.wasSuccessful() ? 0 : -1;
}
catch(const std::exception& exc)
{
std::cout << exc.what() << std::endl;
}
catch(...)
{
std::cout << "Unknown exception." << std::endl;
}
return -1;
}
开发者ID:AlexejStukov,项目名称:freeopcua,代码行数:26,代码来源:main.cpp
示例15: main
int main(int argc, char* argv[])
{
std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string("");
CPPUNIT_NS::TestResult controller;
CPPUNIT_NS::TestResultCollector result;
controller.addListener(&result);
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener(&progress);
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
try
{
CPPUNIT_NS::stdCOut() << "Running " << testPath;
runner.run(controller, testPath);
CPPUNIT_NS::stdCOut() << "\n";
CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
outputter.write();
}
catch( std::invalid_argument& e)
{
CPPUNIT_NS::stdCOut() << "\n" << "ERROR: " << e.what() << "\n";
}
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:neugenn,项目名称:SMPPSim,代码行数:32,代码来源:main.cpp
示例16: main
int main(int argc, char* argv[])
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry("All Tests").makeTest() );
runner.run( controller );
// Print test in a text format.
CPPUNIT_NS::TextOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
outputter.write();
// This for XML output
std::ofstream file( "TestResult.xml" );
CPPUNIT_NS::XmlOutputter xml( &result, file );
xml.setStyleSheet( "report.xsl" );
xml.write();
file.close();
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:VicoandMe,项目名称:HW,代码行数:31,代码来源:main.cpp
示例17: main
int main(int ac,char **av)
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
CppUnit::TextUi::TestRunner runner;
// Add the top runner.to the test runner
runner.addTest( CTimezone_TS1::suite() );
runner.run( controller );
// Print test in a compiler compatible format.
std::ofstream file("ctimezone.xml");
CPPUNIT_NS::XmlOutputter xml( &result, file );
xml.setStyleSheet( "report.xsl" );
xml.write();
file.close();
return result.wasSuccessful() ? 0 : 1;
}
开发者ID:tempura-san,项目名称:calendar-backend,代码行数:29,代码来源:ctimezone.cpp
示例18: runCppunitTestSuite
int runCppunitTestSuite(TestResultOutputType outputType)
{
icl_core::os::lxrtStartup();
icl_core::logging::initialize();
// Informiert Test-Listener ueber Testresultate
CPPUNIT_NS::TestResult testresult;
// Listener zum Sammeln der Testergebnisse registrieren
CPPUNIT_NS::TestResultCollector collectedresults;
testresult.addListener(&collectedresults);
// Test-Suite ueber die Registry im Test-Runner einfuegen
CPPUNIT_NS::TestRunner testrunner;
testrunner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
// Resultate ausgeben
switch (outputType)
{
case eTROT_Text:
{
icl_core::TestListener progress;
testresult.addListener(&progress);
testrunner.run(testresult);
CPPUNIT_NS::TextOutputter textoutputter(&collectedresults, std::cerr);
textoutputter.write();
break;
}
case eTROT_Compiler:
{
icl_core::TestListener progress;
testresult.addListener(&progress);
testrunner.run(testresult);
CPPUNIT_NS::CompilerOutputter compileroutputter(&collectedresults, std::cerr);
compileroutputter.write();
break;
}
case eTROT_Xml:
{
testrunner.run(testresult);
CPPUNIT_NS::XmlOutputter xmloutputter(&collectedresults, std::cerr, "UTF-8");
xmloutputter.write();
break;
}
}
icl_core::logging::shutdown();
icl_core::os::lxrtShutdown();
// Rueckmeldung, ob Tests erfolgreich waren
return collectedresults.wasSuccessful() ? 0 : 1;
}
开发者ID:fzi-forschungszentrum-informatik,项目名称:fzi_icl_core,代码行数:57,代码来源:test_suite.cpp
示例19: main
int main( int argc, char **argv )
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
/* CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result ); */
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
time_t tmbegin;
time(&tmbegin);
runner.run( controller );
time_t tmend;
time(&tmend);
cout << "used time: " << tmend-tmbegin << endl;
//CPPUNIT_NS::OStream *xmlStream = new CPPUNIT_NS::OFileStream( "report.xml" );
//// Print test in a compiler compatible format.
//CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
//outputter.write();
CPPUNIT_NS::CompilerOutputter outputter( &result,std::cout );
outputter.write();
//CPPUNIT_NS::XmlOutputter xmlOutputter( &result, *xmlStream );
//xmlOutputter.setStyleSheet( "report.xsl" );
//xmlOutputter.write();
getchar();
return 0/*result.wasSuccessful() ? 0 : 1*/;
}
开发者ID:poac,项目名称:libs,代码行数:55,代码来源:test.cpp
示例20: outputter
int
main( int argc, char* argv[] )
{
// Retreive test path from command line first argument. Default to "" which resolve
// to the top level suite.
std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string("");
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
#ifdef WIN32
CPPUNIT_NS::TextTestProgressListener progress;
#else
CPPUNIT_NS::BriefTestProgressListener progress;
#endif
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
try
{
std::string test_path = testPath.empty() ? " all unit tests" : testPath;
std::cerr << "Running " << test_path << std::endl;
runner.run( controller, testPath );
std::cerr << std::endl;
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
outputter.write();
// Uncomment this for XML output
// std::ofstream file( "tests.xml" );
// CPPUNIT_NS::XmlOutputter xml( &result, file );
// xml.setStyleSheet( "report.xsl" );
// xml.write();
// file.close();
}
catch ( std::invalid_argument &e ) // Test path not resolved
{
std::cerr << std::endl
<< "ERROR: " << e.what()
<< std::endl;
return 0;
}
return result.wasSuccessful() ? 0: 1;
}
开发者ID:MOXfiles,项目名称:dirac-research,代码行数:54,代码来源:utmain.cpp
注:本文中的cppunit_ns::TestResult类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论