Example #1
0
    Totals runTests( Ptr<Config> const& config ) {

        Ptr<IConfig const> iconfig = config.get();

        Ptr<IStreamingReporter> reporter = makeReporter( config );
        reporter = addListeners( iconfig, reporter );

        RunContext context( iconfig, reporter );

        Totals totals;

        context.testGroupStarting( config->name(), 1, 1 );

        TestSpec testSpec = config->testSpec();
        if( !testSpec.hasFilters() )
            testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "~[.]" ).testSpec(); // All not hidden tests

        std::vector<TestCase> const& allTestCases = getAllTestCasesSorted( *iconfig );
        for( std::vector<TestCase>::const_iterator it = allTestCases.begin(), itEnd = allTestCases.end();
                it != itEnd;
                ++it ) {
            if( !context.aborting() && matchTest( *it, testSpec, *iconfig ) )
                totals += context.runTest( *it );
            else
                reporter->skipTest( *it );
        }

        context.testGroupEnded( iconfig->name(), totals, 1, 1 );
        return totals;
    }
 std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
     std::vector<TestCase> filtered;
     filtered.reserve( testCases.size() );
     for( auto const& testCase : testCases )
         if( matchTest( testCase, testSpec, config ) )
             filtered.push_back( testCase );
     return filtered;
 }
 std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
     std::vector<TestCase> filtered;
     filtered.reserve( testCases.size() );
     for( std::vector<TestCase>::const_iterator it = testCases.begin(), itEnd = testCases.end();
             it != itEnd;
             ++it )
         if( matchTest( *it, testSpec, config ) )
             filtered.push_back( *it );
     return filtered;
 }