From 65f3ffe0259ab34772eeb05e27083d62b4c69507 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Mon, 18 Dec 2023 20:01:23 +0000 Subject: [PATCH] test_bitcoin_consensus POC Add a new binary which exists purely to run tests on the external interface of libbitcoin_consensus without linking concerns. Note that this does not eliminate the need for testing the shared libs themselves. For ex, proper exports still need to be verified. This binary is not very interesting, but a similar one for libbitcoin_kernel likely would be. Issues/TODO: - A dummy test fixture is used rather than dragging in our test util lib - Redundant tests run on external/internal apis were removed. Maybe not worth worrying about? - Duplicated BuildCreditingTransaction/BuildSpendingTransaction. Find them a better home? --- src/test/CMakeLists.txt | 17 ++- src/test/consensus_api_tests.cpp | 226 +++++++++++++++++++++++++++++++ src/test/script_tests.cpp | 224 ------------------------------ 3 files changed, 242 insertions(+), 225 deletions(-) create mode 100644 src/test/consensus_api_tests.cpp diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 2fd836e63f1b6..937e7b8d13c94 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -14,6 +14,22 @@ generate_header_from_json(data/tx_invalid.json) generate_header_from_json(data/tx_valid.json) generate_header_from_raw(data/asmap.raw) +add_executable(test_bitcoin_consensus + main.cpp + consensus_api_tests.cpp + ../script/bitcoinconsensus.cpp + ../support/cleanse.cpp +) + +target_link_libraries(test_bitcoin_consensus + PRIVATE + core + bitcoin_consensus_sources + bitcoin_crypto_sources + test_util + secp256k1 +) + add_executable(test_bitcoin main.cpp $ @@ -143,7 +159,6 @@ target_link_libraries(test_bitcoin bitcoin_cli bitcoin_node minisketch - $ Boost::headers ) diff --git a/src/test/consensus_api_tests.cpp b/src/test/consensus_api_tests.cpp new file mode 100644 index 0000000000000..f7741253e76e8 --- /dev/null +++ b/src/test/consensus_api_tests.cpp @@ -0,0 +1,226 @@ +// Copyright (c) 2011-2022 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 +#include