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:
Martin Hořeňovský
2020-04-21 11:00:08 +02:00
parent 2a93a65bc2
commit 53434a2f32
11 changed files with 106 additions and 8 deletions

View File

@@ -1943,6 +1943,27 @@ Matchers.tests.cpp:<line number>: PASSED:
with expansion:
"This wouldn't pass" not matches undescribed predicate
-------------------------------------------------------------------------------
Assertion macros support bit operators and bool conversions
-------------------------------------------------------------------------------
Compilation.tests.cpp:<line number>
...............................................................................
Compilation.tests.cpp:<line number>: PASSED:
REQUIRE( lhs | rhs )
with expansion:
Val: 1 | Val: 2
Compilation.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( lhs & rhs )
with expansion:
!(Val: 1 & Val: 2)
Compilation.tests.cpp:<line number>: PASSED:
REQUIRE( HasBitOperators{ 1 } & HasBitOperators{ 1 } )
with expansion:
Val: 1 & Val: 1
-------------------------------------------------------------------------------
Assertions then sections
-------------------------------------------------------------------------------
@@ -14773,6 +14794,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 334 | 244 passed | 86 failed | 4 failed as expected
assertions: 1909 | 1740 passed | 148 failed | 21 failed as expected
test cases: 335 | 245 passed | 86 failed | 4 failed as expected
assertions: 1912 | 1743 passed | 148 failed | 21 failed as expected