mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 05:15:39 +02:00
Support bitand and bitor in REQUIRE/CHECK
This means that bit-flag-like types with conversion to bool can be asserted on, like so `REQUIRE(var & Flags::AddNewline)`.
This commit is contained in:
@@ -200,6 +200,14 @@ namespace Catch {
|
||||
auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||
return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs };
|
||||
}
|
||||
template <typename RhsT>
|
||||
auto operator | (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||
return { static_cast<bool>(m_lhs | rhs), m_lhs, "|", rhs };
|
||||
}
|
||||
template <typename RhsT>
|
||||
auto operator & (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||
return { static_cast<bool>(m_lhs & rhs), m_lhs, "&", rhs };
|
||||
}
|
||||
|
||||
template<typename RhsT>
|
||||
auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||
|
Reference in New Issue
Block a user