Skip to content

Commit

Permalink
test: add static test for util::Result memory usage
Browse files Browse the repository at this point in the history
Suggested by Martin Leitner-Ankerl <martin.ankerl@gmail.com>
bitcoin#25722 (comment)

Co-authored-by: Martin Leitner-Ankerl <martin.ankerl@gmail.com>
  • Loading branch information
ryanofsky and martinus committed Oct 18, 2023
1 parent e2b184e commit f158686
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/test/result_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ void ExpectFail(const util::Result<T, F>& result, bilingual_str str, Args&&... a
BOOST_CHECK_EQUAL(result.GetFailure(), F{std::forward<Args>(args)...});
}

BOOST_AUTO_TEST_CASE(check_sizes)
{
static_assert(sizeof(util::Result<int>) == sizeof(void*)*2);
static_assert(sizeof(util::Result<void>) == sizeof(void*));
}

BOOST_AUTO_TEST_CASE(check_returned)
{
ExpectResult(VoidSuccessFn(), true, {});
Expand Down

0 comments on commit f158686

Please sign in to comment.