MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/test/util_tests.cpp:98–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96} // namespace
97
98BOOST_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
124BOOST_AUTO_TEST_CASE(util_criticalsection)
125{

Callers

nothing calls this directly

Calls 15

beginFunction · 0.85
endFunction · 0.85
HexClass · 0.85
MakeUCharSpanFunction · 0.85
ParseHexFunction · 0.85
TryParseHexFunction · 0.85
ConstevalHexDigitFunction · 0.85
MakeByteSpanFunction · 0.85
MakeWritableByteSpanFunction · 0.85
JoinFunction · 0.85
ReplaceAllFunction · 0.85
TrimStringFunction · 0.85

Tested by

no test coverage detected