aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/test/wallet_transaction_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/test/wallet_transaction_tests.cpp')
-rw-r--r--src/wallet/test/wallet_transaction_tests.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/wallet/test/wallet_transaction_tests.cpp b/src/wallet/test/wallet_transaction_tests.cpp
new file mode 100644
index 0000000000..5ef2904f66
--- /dev/null
+++ b/src/wallet/test/wallet_transaction_tests.cpp
@@ -0,0 +1,24 @@
+// Copyright (c) 2021 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 <wallet/test/wallet_test_fixture.h>
+
+#include <boost/test/unit_test.hpp>
+
+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()