• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ textui::TestRunner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cppunit::textui::TestRunner的典型用法代码示例。如果您正苦于以下问题:C++ TestRunner类的具体用法?C++ TestRunner怎么用?C++ TestRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TestRunner类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: outputFile

int 
main( int argc, char* argv[] )
{
  ProjetUnivers::Kernel::Parameters::load("physic.config") ;
  ProjetUnivers::Kernel::Log::init() ;
  
  // 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]);

  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
  
  runner.addTest( registry.makeTest() );

  // Define the file that will store the XML output.
  std::ofstream outputFile("tests_physic.xml");

  CppUnit::MultiOutputter* outputter = new CppUnit::MultiOutputter() ;
  outputter->add(new CppUnit::CompilerOutputter(&runner.result(),std::cerr)) ;
  outputter->add(new ProjetUnivers::Kernel::XmlOutputter(&runner,outputFile)) ;
  runner.setOutputter(outputter);

  // Run the test.
  bool wasSucessful = runner.run( "" );

  ProjetUnivers::Kernel::Log::close() ;


  // Return error code 1 if the one of test failed.
  return wasSucessful ? 0 : 1;
}
开发者ID:BackupTheBerlios,项目名称:projet-univers-svn,代码行数:33,代码来源:test_physic.cpp


示例2: main

int main() {
    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
    runner.addTest(registry.makeTest());
    runner.run();
    return 0;
}
开发者ID:kornelik,项目名称:anpr,代码行数:7,代码来源:main.cpp


示例3: main

int main(int argc, char *argv[])
{
    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestSuite *suite = new CppUnit::TestSuite();

    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test1", &Trapping_Rain_WaterTest::test1));
    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test2", &Trapping_Rain_WaterTest::test2));
    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test3", &Trapping_Rain_WaterTest::test3));
    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test4", &Trapping_Rain_WaterTest::test4));
    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test5", &Trapping_Rain_WaterTest::test5));
    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test6", &Trapping_Rain_WaterTest::test6));
    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test7", &Trapping_Rain_WaterTest::test7));
    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test8", &Trapping_Rain_WaterTest::test8));
    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test9", &Trapping_Rain_WaterTest::test9));
    suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
                "test10", &Trapping_Rain_WaterTest::test10));
    runner.addTest(suite);
    runner.run("", true);

    return 0;
}
开发者ID:lrtfm,项目名称:leetcode_solution,代码行数:30,代码来源:Trapping_Rain_Water_TEST.cpp


示例4: 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


示例5:

int 
main( int argc, char* argv[] )
{
  ProjetUnivers::Kernel::Parameters::load("sound.config") ;
  ProjetUnivers::Kernel::Log::init() ;
  
  // 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]);

  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
  
  runner.addTest( registry.makeTest() );

  if ( selfTest )
  { // Change the default outputter to a compiler error format outputter
    // The test runner owns the new outputter.
    runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter( 
                                                        &runner.result(),
                                                        std::cerr ) );
  }

  // Run the test.
  bool wasSucessful = runner.run( "" );

  ProjetUnivers::Kernel::Log::close() ;


  // Return error code 1 if the one of test failed.
  return wasSucessful ? 0 : 1;
}
开发者ID:BackupTheBerlios,项目名称:projet-univers-svn,代码行数:33,代码来源:test_sound.cpp


示例6: main

int main(int, char *[])
{
  CppUnit::TextUi::TestRunner runner;
  runner.addTest(DllModule_tests::suite());
  
	return !runner.run();
}
开发者ID:idle-code,项目名称:MRU,代码行数:7,代码来源:DllModule_tests.cpp


示例7: main

int main(int argc, char* argv[])
{
    InitModuleObjects();
    // These are the internal unit tests covered by other modules and libraries
    Array objects;
    objects.append(*(new LoadedObject ("jhtree")));
    objects.append(*(new LoadedObject ("roxiemem")));
    objects.append(*(new LoadedObject ("thorhelper")));

    queryStderrLogMsgHandler()->setMessageFields(MSGFIELD_time);
    CppUnit::TextUi::TestRunner runner;
    if (argc==1)
    {
        CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
        runner.addTest( registry.makeTest() );
    }
    else 
    {
        for (int name = 1; name < argc; name++)
        {
            CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry(argv[name]);
            runner.addTest( registry.makeTest() );
        }
    }
    bool wasSucessful = runner.run( "", false );
    ExitModuleObjects();
    releaseAtoms();
    return wasSucessful;
}
开发者ID:AsherBond,项目名称:HPCC-Platform,代码行数:29,代码来源:unittests.cpp


示例8: main

int main( int argc, char ** argv ) {
	CppUnit::TextUi::TestRunner runner;
	CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
	runner.addTest( registry.makeTest() );

	ofstream out;
	if ( argc == 2 ) {
		out.open( argv[ 1 ] );
	}
	
	runner.setOutputter( 
		new CppUnit::XmlOutputter( 
			&runner.result(), 
			( out.is_open() ? out : std::cerr )
		) 
	);
		
	// Run the tests.
  	bool wasSucessful = runner.run();

	if ( out.is_open() ) {
		out.close();
	}
	
  	// Return error code 1 if the one of test failed.
  	return wasSucessful ? 0 : 1;
}
开发者ID:gjhiggins,项目名称:ginger,代码行数:27,代码来源:testlibmetainfo.cpp


示例9: main

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 
   // uncomment the following line if you need a compiler outputter.
   runner.setOutputter(new CppUnit::CompilerOutputter( &runner.result(),
                                                            std::cout ) );

   // Change the default outputter to a xml error format outputter 
   // uncomment the following line if you need a xml outputter.
   //runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(),
   //                                                    std::cerr ) );

   /// Run the tests.
   //  bool wasSuccessful = runner.run();
   // If you want to avoid the CppUnit typical output change the line above 
   // by the following one: 
   bool wasSuccessful = runner.run("",false,true,false);

   // Return error code 1 if the one of test failed.
   // Uncomment the next line if you want to integrate CppUnit with Oval
   if(!wasSuccessful) std::cerr <<"Error: CppUnit Failures"<<std::endl;
   std::cout <<"[OVAL] Cppunit-result ="<<!wasSuccessful<<std::endl;

   return wasSuccessful ? 0 : 1;
 }
开发者ID:309972460,项目名称:software,代码行数:33,代码来源:CppUnit_testdriver.cpp


示例10: OnInit

bool wxExTestApp::OnInit()
{
  SetAppName("wxex-test-gui-report");

  if (!wxExApp::OnInit())
  {
    return false;
  }

  wxExFrameWithHistory *frame = new 
    wxExFrameWithHistory(NULL, wxID_ANY, wxTheApp->GetAppDisplayName());
    
  frame->Show(true);

  wxLog::SetActiveTarget(new wxLogStderr());
    
  CppUnit::TextUi::TestRunner runner;

  wxExTestSuite* suite = new wxExTestSuite;

  runner.addTest(suite);
  runner.run();

  // Return false, so test ends here.
  return false;
}
开发者ID:Emmavw,项目名称:wxExtension,代码行数:26,代码来源:main.cpp


示例11: main

int main()
{
	CppUnit::TextUi::TestRunner runner;
	runner.addTest( ObjectPoolTest::suite() );
	runner.run();
	return 0;
}
开发者ID:EmuxEvans,项目名称:Woody-Ye-s-Code-Share,代码行数:7,代码来源:ObjectPoolTest.cpp


示例12: 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


示例13: main

int main( int argc, char ** argv )
{
    // figure out where our sources are and where we can write
    srcdir = getenv( "srcdir" );
    if( srcdir.isEmpty() ) srcdir = ".";
    builddir = getenv( "top_builddir" );
    if( builddir.isEmpty() ) builddir = ".";

    if( lt_templates_initialize() == -1 ) {
        fprintf( stderr, "Unable to initialize Lintouch Templates Library\n" );
        return -1;
    }
    atexit( lt_templates_terminate );

    QApplication a( argc, argv, false );

    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry &registry = 
        CppUnit::TestFactoryRegistry::getRegistry();
    runner.addTest( registry.makeTest() );

    bool wasThereError = runner.run( "", false );

    // shell expects 0 if successfull
    return !wasThereError;
}
开发者ID:acassis,项目名称:lintouch,代码行数:26,代码来源:check_ltl-input.cpp


示例14: main

int main( int argc, char **argv)
{
  // Create the event manager and test controller
  CppUnit::TestResult controller;

  // Add a listener that colllects test result
  CppUnit::TestResultCollector result;
  controller.addListener( &result );

  // Add a listener that print dots as test run.
  CppUnit::BriefTestProgressListener progress;
  controller.addListener( &progress );

  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
  runner.addTest( registry.makeTest() );
  runner.run( controller, "" );

  // Resultate im Compiler-Format ausgeben
  CppUnit::CompilerOutputter compileroutputter( &result, std::cerr );
  compileroutputter.write();

  // Rueckmeldung, ob Tests erfolgreich waren
  return ( result.wasSuccessful() ? 0 : -1 );
}
开发者ID:Elgu,项目名称:rpgml,代码行数:25,代码来源:utest_main.cpp


示例15: main

int main( int argc, char **argv)
{
  CppUnit::TextUi::TestRunner runner;
  runner.addTest( MumukiTest::suite() );
  runner.run();
  return 0;
}
开发者ID:mumuki,项目名称:mumuki-cppunit-server,代码行数:7,代码来源:sample_failed.cpp


示例16: main

int main(int argc, char *argv[])
{
    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestSuite *suite = new CppUnit::TestSuite();

    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test1", &Search_in_Rotated_Sorted_ArrayTest::test1));
    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test2", &Search_in_Rotated_Sorted_ArrayTest::test2));
    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test3", &Search_in_Rotated_Sorted_ArrayTest::test3));
    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test4", &Search_in_Rotated_Sorted_ArrayTest::test4));
    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test5", &Search_in_Rotated_Sorted_ArrayTest::test5));
    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test6", &Search_in_Rotated_Sorted_ArrayTest::test6));
    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test7", &Search_in_Rotated_Sorted_ArrayTest::test7));
    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test8", &Search_in_Rotated_Sorted_ArrayTest::test8));
    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test9", &Search_in_Rotated_Sorted_ArrayTest::test9));
    suite->addTest(new CppUnit::TestCaller<Search_in_Rotated_Sorted_ArrayTest>(
                "test10", &Search_in_Rotated_Sorted_ArrayTest::test10));
    runner.addTest(suite);
    runner.run("", true);

    return 0;
}
开发者ID:lrtfm,项目名称:leetcode_solution,代码行数:30,代码来源:Search_in_Rotated_Sorted_Array_TEST.cpp


示例17: main

int main (int argc, char* argv[]) {
  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
  runner.addTest( registry.makeTest() );
  bool failed = runner.run("", false);
  return !failed;
}
开发者ID:Mega28,项目名称:Feedback,代码行数:7,代码来源:runTest.cpp


示例18: 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


示例19: main

int main( int argc, char **argv) {
  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
  runner.addTest( registry.makeTest() );
  bool wasSuccessful = runner.run( );
  return wasSuccessful ? 0 : 1;
}
开发者ID:gizmomogwai,项目名称:cxxproject,代码行数:7,代码来源:main.cpp


示例20:

int
main(int argc, char *argv[])
{
    CppUnit::TextUi::TestRunner runner;
    runner.addTest(ParseTest::suite());
    runner.run();
}
开发者ID:slogan621,项目名称:jsonapi,代码行数:7,代码来源:jsonapitest.cpp



注:本文中的cppunit::textui::TestRunner类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cppunit_ns::TestResult类代码示例发布时间:2022-05-31
下一篇:
C++ cppunit::WinTestRunner类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap