MCPcopy Create free account
hub / github.com/FidoProject/Fido / matches

Method matches

tests/catch.h:3139–3159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3137 }
3138 virtual ~WildcardPattern();
3139 virtual bool matches( std::string const& str ) const {
3140 switch( m_wildcard ) {
3141 case NoWildcard:
3142 return m_pattern == adjustCase( str );
3143 case WildcardAtStart:
3144 return endsWith( adjustCase( str ), m_pattern );
3145 case WildcardAtEnd:
3146 return startsWith( adjustCase( str ), m_pattern );
3147 case WildcardAtBothEnds:
3148 return contains( adjustCase( str ), m_pattern );
3149 }
3150
3151#ifdef __clang__
3152#pragma clang diagnostic push
3153#pragma clang diagnostic ignored "-Wunreachable-code"
3154#endif
3155 throw std::logic_error( "Unknown enum" );
3156#ifdef __clang__
3157#pragma clang diagnostic pop
3158#endif
3159 }
3160 private:
3161 std::string adjustCase( std::string const& str ) const {
3162 return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str;

Callers

nothing calls this directly

Calls 3

endsWithFunction · 0.85
startsWithFunction · 0.85
containsFunction · 0.85

Tested by

no test coverage detected