Files
bitcoin/src/wallet/test/wallet_transaction_tests.cpp
Hodlinator dbbb780af0 test: move and simplify BOOST_CHECK ostream helpers
Move the operator<< overloads used by BOOST_CHECK_* out of the
unit test machinery test/setup_common, into test/util/common.h.

And replace the individual per-type ToString() overloads with
a single concept-constrained template that covers any type
exposing a ToString() method. This is important to not add
uint256.h and transaction_identifier.h dependencies to the
shared test/util/common.h file.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
2026-02-26 11:28:55 -03:00

28 lines
885 B
C++

// Copyright (c) 2021-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <wallet/transaction.h>
#include <test/util/common.h>
#include <wallet/test/wallet_test_fixture.h>
#include <boost/test/unit_test.hpp>
namespace wallet {
BOOST_FIXTURE_TEST_SUITE(wallet_transaction_tests, WalletTestingSetup)
BOOST_AUTO_TEST_CASE(roundtrip)
{
for (uint8_t hash = 0; hash < 5; ++hash) {
for (int index = -2; index < 3; ++index) {
TxState state = TxStateInterpretSerialized(TxStateUnrecognized{uint256{hash}, index});
BOOST_CHECK_EQUAL(TxStateSerializedBlockHash(state), uint256{hash});
BOOST_CHECK_EQUAL(TxStateSerializedIndex(state), index);
}
}
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace wallet