21 : m_caseSensitivity( caseSensitivity ),
22 m_str( adjustString( str ) )
31 ?
" (case insensitive)"
37 : m_comparator( comparator ),
38 m_operation( operation ) {
42 std::string description;
46 description +=
": \"";
85 auto flags = std::regex::ECMAScript;
86 if (m_caseSensitivity == CaseSensitive::Choice::No) {
87 flags |= std::regex::icase;
89 auto reg = std::regex(m_regex,
flags);
90 return std::regex_match(matchee, reg);
94 return "matches " +
::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)?
" case sensitively" :
" case insensitively");
std::string stringify(const T &e)
StdString::StartsWithMatcher StartsWith(std::string const &str, CaseSensitive::Choice caseSensitivity)
StdString::EqualsMatcher Equals(std::string const &str, CaseSensitive::Choice caseSensitivity)
StdString::EndsWithMatcher EndsWith(std::string const &str, CaseSensitive::Choice caseSensitivity)
StdString::ContainsMatcher Contains(std::string const &str, CaseSensitive::Choice caseSensitivity)
StdString::RegexMatcher Matches(std::string const ®ex, CaseSensitive::Choice caseSensitivity)
bool startsWith(std::string const &s, std::string const &prefix)
bool contains(std::string const &s, std::string const &infix)
std::string toLower(std::string const &s)
bool endsWith(std::string const &s, std::string const &suffix)
const CharType(& source)[N]
std::string adjustString(std::string const &str) const
std::string caseSensitivitySuffix() const
CasedString(std::string const &str, CaseSensitive::Choice caseSensitivity)
CaseSensitive::Choice m_caseSensitivity
bool match(std::string const &source) const override
ContainsMatcher(CasedString const &comparator)
EndsWithMatcher(CasedString const &comparator)
bool match(std::string const &source) const override
bool match(std::string const &source) const override
EqualsMatcher(CasedString const &comparator)
std::string describe() const override
bool match(std::string const &matchee) const override
RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity)
StartsWithMatcher(CasedString const &comparator)
bool match(std::string const &source) const override
StringMatcherBase(std::string const &operation, CasedString const &comparator)
std::string describe() const override