From 5e14665e04d96bbc59eec27d95b7beea33f81c74 Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Thu, 20 Jul 2023 13:52:40 -0400 Subject: [PATCH] test: add static test for util::Result memory usage Suggested by Martin Leitner-Ankerl https://github.com/bitcoin/bitcoin/pull/25722#discussion_r1174298529 Co-authored-by: Martin Leitner-Ankerl --- src/test/result_tests.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/result_tests.cpp b/src/test/result_tests.cpp index 430c40046a65d..1c092a13098e4 100644 --- a/src/test/result_tests.cpp +++ b/src/test/result_tests.cpp @@ -180,6 +180,12 @@ void ExpectFail(const util::Result& result, bilingual_str str, Args&&... a BOOST_CHECK_EQUAL(result.GetFailure(), F{std::forward(args)...}); } +BOOST_AUTO_TEST_CASE(check_sizes) +{ + static_assert(sizeof(util::Result) == sizeof(void*)*2); + static_assert(sizeof(util::Result) == sizeof(void*)); +} + BOOST_AUTO_TEST_CASE(check_returned) { ExpectResult(VoidSuccessFn(), true, {});