当前位置: 首页>>代码示例>>C++>>正文


C++ Suite类代码示例

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


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

示例1: run

  inline bool run(Environment& environment, Suite& tests, Setup const&... setup)
  {
    // retrieve compact status
    auto is_compact = args("compact",false);
    auto is_fail_only = args("fail-only",false);
    environment.compact(is_compact);
    environment.fail_only(is_fail_only);

    // randomize test on non-null random seed option
    if(auto seed = args("random",0u))
    {
      ::stf::detail::shuffle( tests.begin(), tests.end(), std::mt19937{seed} );
    }

    for(auto& t : tests )
    {
      scenario_header(environment,t);
      auto count = environment.tests();

      t(environment);

      process_invalid(environment, count);

      environment.stream() << std::endl;
    }

    return ::stf::report(environment,setup...);
  }
开发者ID:NumScale,项目名称:stf,代码行数:28,代码来源:driver.hpp

示例2: AddTest

void AddTest(Suite& ts)
{
    ts.add(std::auto_ptr<Suite>(new CTestDataBox));
    ts.add(std::auto_ptr<Suite>(new CTestThreadSync));
    ts.add(std::auto_ptr<Suite>(new CTestSerialize));
    ts.add(std::auto_ptr<Suite>(new CTestPeutils));
}
开发者ID:LieLowMan,项目名称:zpublic,代码行数:7,代码来源:test_pellets.cpp

示例3: torun

        int Suite::run( vector<string> suites ){
            for ( unsigned int i = 0; i < suites.size(); i++ ) {
                if ( _suites->find( suites[i] ) == _suites->end() ) {
                    cout << "invalid test [" << suites[i] << "], use --list to see valid names" << endl;
                    return -1;
                }
            }

            list<string> torun(suites.begin(), suites.end());

            if ( torun.size() == 0 )
                for ( map<string,Suite*>::iterator i=_suites->begin() ; i!=_suites->end(); i++ )
                    torun.push_back( i->first );

            list<Result*> results;

            for ( list<string>::iterator i=torun.begin(); i!=torun.end(); i++ ){
                string name = *i;
                Suite * s = (*_suites)[name];
                assert( s );

                log() << "going to run suite: " << name << endl;
                results.push_back( s->run() );
            }

            Logstream::get().flush();

            cout << "**************************************************" << endl;
            cout << "**************************************************" << endl;
            cout << "**************************************************" << endl;

            int rc = 0;

            int tests = 0;
            int fails = 0;
            int asserts = 0;

            for ( list<Result*>::iterator i=results.begin(); i!=results.end(); i++ ){
                Result * r = *i;
                cout << r->toString();
                if ( abs( r->rc() ) > abs( rc ) )
                    rc = r->rc();
                
                tests += r->_tests;
                fails += r->_fails;
                asserts += r->_asserts;
            }

            Result totals ("TOTALS");
            totals._tests = tests;
            totals._fails = fails;
            totals._asserts = asserts;
            
            cout << totals.toString(); // includes endl

            return rc;
        }
开发者ID:mikejs,项目名称:mongo,代码行数:57,代码来源:framework.cpp

示例4: UniTest

void UniTest()
{
    Suite ts;
    AddTest(ts);
    std::auto_ptr<Output> output(new XmlOutput);
    ts.run(*output, true);
    Test::XmlOutput* const xml_output = dynamic_cast<XmlOutput*>(output.get());
    if (xml_output)
    {
        std::ofstream fout("./test_pellets.xml");
        xml_output->generate(fout, true, "zpublic");
    }
}
开发者ID:LieLowMan,项目名称:zpublic,代码行数:13,代码来源:test_pellets.cpp

示例5: displaySuite

//skriver ut data om suitene.
void Hotell::displaySuite(){

	Suite *tempSuite;

	for (int x = 1; x <= rom[2]->no_of_elements(); x++){

		tempSuite = (Suite*)rom[2]->remove_no(x);
		rom[2]->add(tempSuite);
		tempSuite->display();
	}

	_getch();
}
开发者ID:Beedle,项目名称:Prosjekt,代码行数:14,代码来源:Hotell.cpp

示例6: fil

//skriver data til fil.
void Hotell::tilfil(){

	//filnavnet er egen variabel.
	ofstream fil (filnavn+".DTA");

	//Statisk data
	fil << navn << endl;
	fil << postnummer << " " << addresse << endl;
	fil << telefon << " " << fax << " " << mail << endl;
	fil << frokost << " " << seng << " " << antFascilliteter << endl;

	//beskrivelse av fascillitetene.
	for(int x = 1; x <= antFascilliteter; x++){
		fil << fascilliteter[x] << endl;
	}


	for(int y = 0; y < 3; y++){

		//data om alle rom skriver seg selv.		
		Singel *tempSingel;
		Dobbel *tempDobbel;
		Suite  *tempSuite;
		
		fil << rom[y]->no_of_elements() << endl;
		for (int x = 1; x <= rom[y]->no_of_elements(); x++){

			if(y == 0){
				tempSingel = (Singel*)rom[y]->remove_no(x);
				rom[y]->add(tempSingel);
				tempSingel->toFile(fil);
			}

			else if (y == 1){
				tempDobbel = (Dobbel*)rom[y]->remove_no(x);
				rom[y]->add(tempDobbel);
				tempDobbel->toFile(fil);
			}

			else if (y == 2){
				tempSuite = (Suite*)rom[y]->remove_no(x);
				rom[y]->add(tempSuite);
				tempSuite->toFile(fil);
			}

			fil << endl;
		}

	}

}
开发者ID:Beedle,项目名称:Prosjekt,代码行数:52,代码来源:Hotell.cpp

示例7: Print

void Runner::Run()
{
    Print("Starting Test Runner: %s\n", iDesc);
    SetAssertThrows(true);
    gPass = 0;
    gFail = 0;

    Suite* suite = iFirst;
    TUint i=1;
    for(; suite != 0; i++) {
        Print("Suite %d: %s\n", i,suite->Description());
        try {
            suite->Test();
        } catch(OpenHome::Exception& e) {
            Print("\nFAILURE: Suite: %d caused an unhandled exception: %s.  Exception thrown at:  File: %s.  Line: %d\n",i,e.Message(),e.File(),e.Line());
            Print("Last successful test: %s:%d\n", gLastSuccessfulFile, gLastSuccessfulLine);
            gFail++;
        } catch(...) {
            Print("\nFAILURE: Suite: %d caused an unhandled, unknown exception\n", i);
            Print("Last successful test: %s:%d\n", gLastSuccessfulFile, gLastSuccessfulLine);
            gFail++;
        }
        Print("\n");

        Suite* finishedSuite = suite;
        suite = suite->iNext;
        delete finishedSuite;
    }
    Print("Finished Test Runner: %s\n", iDesc);
    Print("%d of %d tests passed.\n",gPass, gPass+gFail);
    Print("%d of %d tests failed.\n",gFail, gPass+gFail);
    if (gFail != 0) {
        const char* a = getenv("ABORT_ON_FAILURE");
        if ( a == NULL || atoi(a) == 1 ) {
            // If env var is unset, or is set to "1", then exit.
            exit(1);
        }
    }
}
开发者ID:MatthewMiddleweek,项目名称:ohNet,代码行数:39,代码来源:TestFramework.cpp

示例8: AddTest

void AddTest(Suite& ts)
{
//     ts.add(std::auto_ptr<Suite>(new CTestDataBox));
//     ts.add(std::auto_ptr<Suite>(new CTestThreadSync));
//     ts.add(std::auto_ptr<Suite>(new CTestSerialize));
//     ts.add(std::auto_ptr<Suite>(new CTestPeutils));
//     ts.add(std::auto_ptr<Suite>(new CTestThreadPool));
//     ts.add(std::auto_ptr<Suite>(new CTestDesignPattern));
//     ts.add(std::auto_ptr<Suite>(new CTestEvent));
//     ts.add(std::auto_ptr<Suite>(new CTestTimer));
//     ts.add(std::auto_ptr<Suite>(new CTestLuaBind));
    ts.add(std::auto_ptr<Suite>(new CTestWinUtils));
}
开发者ID:kpublic,项目名称:zpublic,代码行数:13,代码来源:test_pellets.cpp

示例9: run

        int Suite::run( int argc , char ** argv ){
            list<string> torun;

            for ( int i=1; i<argc; i++ ){
            
                string s = argv[i];
                
                if ( s == "-list" ){
                    for ( map<string,Suite*>::iterator i=_suites->begin() ; i!=_suites->end(); i++ )
                        cout << i->first << endl;
                    return 0;
                }

                if ( s == "-debug" ){
                    logLevel = 1;
                    continue;
                }
                
                torun.push_back( s );
                if ( _suites->find( s ) == _suites->end() ){
                    cout << "invalid test [" << s << "]  use -list to see valid names" << endl;
                    return -1;
                }
            }
            
            if ( torun.size() == 0 )
                for ( map<string,Suite*>::iterator i=_suites->begin() ; i!=_suites->end(); i++ )
                    torun.push_back( i->first );
            
            list<Result*> results;
            
            for ( list<string>::iterator i=torun.begin(); i!=torun.end(); i++ ){
                string name = *i;
                Suite * s = (*_suites)[name];
                assert( s );
                
                log() << "going to run suite: " << name << endl;
                results.push_back( s->run() );
            }
            
            cout << "**************************************************" << endl;
            cout << "**************************************************" << endl;
            cout << "**************************************************" << endl;
            
            int rc = 0;
            
            int tests = 0;
            int fails = 0;
            int asserts = 0;

            for ( list<Result*>::iterator i=results.begin(); i!=results.end(); i++ ){
                Result * r = *i;
                cout << r->toString();
                if ( abs( r->rc() ) > abs( rc ) )
                    rc = r->rc();

                tests += r->_tests;
                fails += r->_fails;
                asserts += r->_asserts;
            }
            
            cout << "TOTALS  tests:" << tests << " fails: " << fails << " asserts calls: " << asserts << endl;

            return rc;
        }
开发者ID:zhuk,项目名称:mongo,代码行数:65,代码来源:framework.cpp

示例10: log

        int Suite::run( const std::vector<std::string>& suites , const std::string& filter , int runsPerTest ) {

            if (_allSuites().empty()) {
                log() << "error: no suites registered.";
                return EXIT_FAILURE;
            }

            for ( unsigned int i = 0; i < suites.size(); i++ ) {
                if ( _allSuites().count( suites[i] ) == 0 ) {
                    log() << "invalid test suite [" << suites[i] << "], use --list to see valid names" << std::endl;
                    return EXIT_FAILURE;
                }
            }

            std::vector<std::string> torun(suites);

            if ( torun.empty() ) {
                for ( SuiteMap::const_iterator i = _allSuites().begin();
                      i !=_allSuites().end(); ++i ) {

                    torun.push_back( i->first );
                }
            }

            std::vector<Result*> results;

            for ( std::vector<std::string>::iterator i=torun.begin(); i!=torun.end(); i++ ) {
                std::string name = *i;
                Suite* s = _allSuites()[name];
                fassert( 16145,  s );

                log() << "going to run suite: " << name << std::endl;
                results.push_back( s->run( filter, runsPerTest ) );
            }

            log() << "**************************************************" << std::endl;

            int rc = 0;

            int tests = 0;
            int fails = 0;
            int asserts = 0;

            for ( std::vector<Result*>::iterator i=results.begin(); i!=results.end(); i++ ) {
                Result* r = *i;
                log() << r->toString();
                if ( abs( r->rc() ) > abs( rc ) )
                    rc = r->rc();

                tests += r->_tests;
                fails += r->_fails;
                asserts += r->_asserts;
            }

            Result totals ("TOTALS");
            totals._tests = tests;
            totals._fails = fails;
            totals._asserts = asserts;

            log() << totals.toString(); // includes endl

            return rc;
        }
开发者ID:89snake89,项目名称:mongo,代码行数:63,代码来源:unittest.cpp

示例11: GetNextKey

bool GetKeysRegistry::GetNextKey(DescriptorTypeID &type)
{
	if(m_iNextKey == m_iNumKeys)
		return false;

	OSErr err = m_DescriptorProcs->GetKey(*m_Descriptor, m_iNextKey, &m_CurKey);
	if(err)
		throw ExceptionSPErr(StringUtil::ssprintf("GetKeysRegistry::GetKey(%i)", m_iNextKey), err);
	err = m_DescriptorProcs->GetType(*m_Descriptor, m_CurKey, &type);
	if(err)
		throw ExceptionSPErr(StringUtil::ssprintf("GetKeysRegistry::GetType(%08x)", m_CurKey), err);

	++m_iNextKey;
	return true;
}
开发者ID:fireattack,项目名称:plugins,代码行数:15,代码来源:Settings.cpp

示例12: GetBoolean

bool GetKeysRegistry::GetBoolean()
{
	Boolean bValue;
	OSErr iErr = m_DescriptorProcs->GetBoolean(*m_Descriptor, m_CurKey, &bValue);
	if(iErr)
		throw ExceptionSPErr(StringUtil::ssprintf("GetKeysRegistry::GetBoolean(%08x)", m_CurKey), iErr);
	return !!bValue;
}
开发者ID:fireattack,项目名称:plugins,代码行数:8,代码来源:Settings.cpp

示例13: GetFloat

float GetKeysRegistry::GetFloat()
{
	double fValue;
	OSErr iErr = m_DescriptorProcs->GetFloat(*m_Descriptor, m_CurKey, &fValue);
	if(iErr)
		throw ExceptionSPErr(StringUtil::ssprintf("GetKeysRegistry::GetFloat(%08x)", m_CurKey), iErr);
	return (float) fValue;
}
开发者ID:fireattack,项目名称:plugins,代码行数:8,代码来源:Settings.cpp

示例14: GetInteger

int GetKeysRegistry::GetInteger()
{
	int32 iValue;
	OSErr iErr = m_DescriptorProcs->GetInteger(*m_Descriptor, m_CurKey, &iValue);
	if(iErr)
		throw ExceptionSPErr(StringUtil::ssprintf("GetKeysRegistry::GetInteger(%08x)", m_CurKey), iErr);
	return iValue;
}
开发者ID:fireattack,项目名称:plugins,代码行数:8,代码来源:Settings.cpp

示例15: GetEnum

DescriptorEnumID GetKeysRegistry::GetEnum()
{
	DescriptorEnumID iValue;
	DescriptorEnumTypeID type;
	OSErr iErr = m_DescriptorProcs->GetEnumerated(*m_Descriptor, m_CurKey, &type, &iValue);
	if(iErr)
		throw ExceptionSPErr(StringUtil::ssprintf("GetKeysRegistry::GetEnumerated(%08x)", m_CurKey), iErr);
	return iValue;
}
开发者ID:fireattack,项目名称:plugins,代码行数:9,代码来源:Settings.cpp


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