mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 05:45:39 +02:00
Add CaseInsensitiveEqualTo comparison type
This commit is contained in:
@@ -22,5 +22,14 @@ namespace Catch {
|
||||
[]( char l, char r ) { return toLower( l ) < toLower( r ); } );
|
||||
}
|
||||
|
||||
bool
|
||||
CaseInsensitiveEqualTo::operator()( StringRef lhs,
|
||||
StringRef rhs ) const {
|
||||
return std::equal(
|
||||
lhs.begin(), lhs.end(),
|
||||
rhs.begin(), rhs.end(),
|
||||
[]( char l, char r ) { return toLower( l ) == toLower( r ); } );
|
||||
}
|
||||
|
||||
} // namespace Detail
|
||||
} // namespace Catch
|
||||
|
@@ -20,6 +20,12 @@ namespace Catch {
|
||||
StringRef rhs ) const;
|
||||
};
|
||||
|
||||
//! Provides case-insensitive `op==` semantics when called
|
||||
struct CaseInsensitiveEqualTo {
|
||||
bool operator()( StringRef lhs,
|
||||
StringRef rhs ) const;
|
||||
};
|
||||
|
||||
} // namespace Detail
|
||||
} // namespace Catch
|
||||
|
||||
|
Reference in New Issue
Block a user