Assert()
without the assert()
.
Assert()
without the assert()
.
75@@ -76,6 +76,9 @@ BOOST_AUTO_TEST_CASE(util_check)
76 const int two = *Assert(p_two);
77 Assert(two == 2);
78 Assert(true);
79+ // Check that Assume can be used as unary expression
80+ const bool result{Assume(two == 2)};
81+ Assert(result);
Assert(Assume(two == 2))
, but that only works in C++20.
The added lines are intended to test Assume
, therefore we could s/Assert(result);
/BOOST_CHECK(true);
/ to suppress “Test case util_tests/util_check did not check any assertions” in
0$ ./src/test/test_bitcoin -t util_tests/util_check -l test_suite
1Running 1 test case...
2Entering test module "Bitcoin Core Test Suite"
3test/util_tests.cpp(48): Entering test suite "util_tests"
4test/util_tests.cpp(75): Entering test case "util_check"
5Test case util_tests/util_check did not check any assertions
6test/util_tests.cpp(75): Leaving test case "util_check"; testing time: 9563us
7test/util_tests.cpp(48): Leaving test suite "util_tests"; testing time: 9634us
8Leaving test module "Bitcoin Core Test Suite"; testing time: 9695us
9
10*** No errors detected
If Assert(result);
is really required (but I cannot see reasons), maybe add BOOST_CHECK(true);
as it is done here: https://github.com/bitcoin/bitcoin/blob/7efc628539573af4b4a76d93b853cc46e9e52eae/src/test/util_tests.cpp#L102 ?
BOOST_CHECK(result);
should also work
fa