18 TestSpec::Pattern::~Pattern() =
default;
19 TestSpec::NamePattern::~NamePattern() =
default;
20 TestSpec::TagPattern::~TagPattern() =
default;
21 TestSpec::ExcludedPattern::~ExcludedPattern() =
default;
23 TestSpec::NamePattern::NamePattern( std::string
const&
name )
24 : m_wildcardPattern(
toLower(
name ), CaseSensitive::No )
26 bool TestSpec::NamePattern::matches( TestCaseInfo
const& testCase )
const {
27 return m_wildcardPattern.matches(
toLower( testCase.name ) );
30 TestSpec::TagPattern::TagPattern( std::string
const& tag ) : m_tag(
toLower( tag ) ) {}
31 bool TestSpec::TagPattern::matches( TestCaseInfo
const& testCase )
const {
32 return std::find(begin(testCase.lcaseTags),
33 end(testCase.lcaseTags),
34 m_tag) != end(testCase.lcaseTags);
37 TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr
const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {}
38 bool TestSpec::ExcludedPattern::matches( TestCaseInfo
const& testCase )
const {
return !m_underlyingPattern->matches( testCase ); }
40 bool TestSpec::Filter::matches( TestCaseInfo
const& testCase )
const {
42 for(
auto const& pattern : m_patterns ) {
43 if( !pattern->matches( testCase ) )
49 bool TestSpec::hasFilters()
const {
50 return !m_filters.empty();
54 for(
auto const& filter : m_filters )
55 if( filter.matches( testCase ) )
std::string toLower(std::string const &s)