| 96 | } // namespace |
| 97 | |
| 98 | BOOST_AUTO_TEST_CASE(util_check) |
| 99 | { |
| 100 | // Check that Assert can forward |
| 101 | const std::unique_ptr<int> p_two = Assert(std::make_unique<int>(2)); |
| 102 | // Check that Assert works on lvalues and rvalues |
| 103 | const int two = *Assert(p_two); |
| 104 | Assert(two == 2); |
| 105 | Assert(true); |
| 106 | // Check that Assume can be used as unary expression |
| 107 | const bool result{Assume(two == 2)}; |
| 108 | Assert(result); |
| 109 | |
| 110 | // Check that Assert doesn't require copy/move |
| 111 | NoCopyOrMove x{9}; |
| 112 | Assert(x).i += 3; |
| 113 | Assert(x).test(); |
| 114 | |
| 115 | // Check nested Asserts |
| 116 | BOOST_CHECK_EQUAL(Assert((Assert(x).test() ? 3 : 0)), 3); |
| 117 | |
| 118 | // Check -Wdangling-gsl does not trigger when copying the int. (It would |
| 119 | // trigger on "const int&") |
| 120 | const int nine{*Assert(std::optional<int>{9})}; |
| 121 | BOOST_CHECK_EQUAL(9, nine); |
| 122 | } |
| 123 | |
| 124 | BOOST_AUTO_TEST_CASE(util_criticalsection) |
| 125 | { |
nothing calls this directly
no test coverage detected