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 Dec 6, 2024
1 parent 643b881 commit 5e14665
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 @@ -180,6 +180,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 5e14665

Please sign in to comment.