Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-04-21 11:00:08 +0200
committerMartin Hořeňovský2020-05-03 07:45:04 +0200
commit53434a2f320aa8c12f8df302d061e222077f52f9 (patch)
tree4c7ca4f7ea7043136e7246bb096892c4767356a8 /src/catch2/internal
parent2a93a65bc24c21102e46c5e102f0905f97a10ee5 (diff)
downloadcatch3-53434a2f320aa8c12f8df302d061e222077f52f9.tar.gz
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)`.
Diffstat (limited to 'src/catch2/internal')
-rw-r--r--src/catch2/internal/catch_decomposer.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_decomposer.hpp b/src/catch2/internal/catch_decomposer.hpp
index 7d915f15..814824c6 100644
--- a/src/catch2/internal/catch_decomposer.hpp
+++ b/src/catch2/internal/catch_decomposer.hpp
@@ -208,6 +208,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 {