First cut of new filtering mechanism

This commit is contained in:
Phil Nash 2012-08-23 20:08:50 +01:00
parent b354da9ab9
commit 56d5c42912
14 changed files with 1535 additions and 1365 deletions

View file

@ -52,25 +52,33 @@ namespace Catch {
return m_nonHiddenFunctions;
}
// !TBD deprecated
virtual std::vector<TestCaseInfo> getMatchingTestCases( const std::string& rawTestSpec ) const {
TestSpec testSpec( rawTestSpec );
std::vector<TestCaseInfo> matchingTests;
getMatchingTestCases( rawTestSpec, matchingTests );
return matchingTests;
}
// !TBD deprecated
virtual void getMatchingTestCases( const std::string& rawTestSpec, std::vector<TestCaseInfo>& matchingTestsOut ) const {
TestSpec testSpec( rawTestSpec );
TestCaseFilter filter( rawTestSpec );
std::vector<TestCaseInfo>::const_iterator it = m_functionsInOrder.begin();
std::vector<TestCaseInfo>::const_iterator itEnd = m_functionsInOrder.end();
for(; it != itEnd; ++it ) {
if( testSpec.matches( it->getName() ) ) {
if( filter.shouldInclude( *it ) ) {
matchingTestsOut.push_back( *it );
}
}
}
virtual void getMatchingTestCases( const TestCaseFilters& filters, std::vector<TestCaseInfo>& matchingTestsOut ) const {
std::vector<TestCaseInfo>::const_iterator it = m_functionsInOrder.begin();
std::vector<TestCaseInfo>::const_iterator itEnd = m_functionsInOrder.end();
// !TBD: replace with algorithm
for(; it != itEnd; ++it )
if( filters.shouldInclude( *it ) )
matchingTestsOut.push_back( *it );
}
private: