Files

83 lines
2.7 KiB
CMake
Raw Permalink Normal View History

2018-12-28 12:10:28 +01:00
# This file is part of the Flowee project
2021-06-20 22:44:44 +02:00
# Copyright (C) 2018 Tom Zander <tom@flowee.org>
2018-12-28 12:10:28 +01:00
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
project (bitcoin-protocol)
include (testlib)
# for some reason someone thought it was useful to compile the json files into the exe
# instead of just reading them at runtime.
# lets emulate that for now.
find_program(HEXDUMP "hexdump")
find_program(SED "sed")
foreach (JSON_FILE
data/script_valid.json
data/script_invalid.json
data/tx_invalid.json
data/tx_valid.json)
# generate 'sighash' array from 'data/sighash.json'
get_filename_component(JSON_NAME ${JSON_FILE} NAME_WE)
if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${JSON_FILE}.h")
continue()
endif ()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${JSON_FILE}.h "namespace json_tests{ static unsigned const char ${JSON_NAME}[] = {")
# generate a C++ compatible hex format of the input file.
execute_process(COMMAND ${HEXDUMP} -v -e "8/1 \"0x%02x, \"" -e "\"\n\"" ${CMAKE_CURRENT_SOURCE_DIR}/${JSON_FILE}
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${JSON_FILE}.hex
)
execute_process(COMMAND ${SED} -e "s/0x ,//g"
INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${JSON_FILE}.hex
OUTPUT_VARIABLE HEXDATA)
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${JSON_FILE}.h "${HEXDATA}};};")
endforeach ()
2026-05-08 22:11:32 +02:00
set (TEST_SOURCES
2020-07-05 13:47:19 +02:00
arith_uint256_tests.cpp
2020-04-01 22:24:26 +02:00
bloom_tests.cpp
2018-12-28 12:10:28 +01:00
checkdatasig_tests.cpp
2020-07-05 16:07:53 +02:00
crypto_tests.cpp
2020-07-05 19:07:02 +02:00
merkle_tests.cpp
multisig_tests.cpp
native_introspection_tests.cpp
2020-04-01 22:51:47 +02:00
pmt_tests.cpp
2018-12-28 12:10:28 +01:00
pow_tests.cpp
uint256_tests.cpp
2026-05-09 08:29:15 +02:00
sighash_utxos_tests.cpp
2018-12-28 12:10:28 +01:00
script_P2SH_tests.cpp
script_tests.cpp
scriptnum_tests.cpp
transaction_tests.cpp
transaction_utils.cpp
2020-04-10 14:14:42 +02:00
TestReverseBytes.cpp
2019-09-02 23:35:43 +02:00
DoubleSpendProofTest.cpp
2018-12-28 12:10:28 +01:00
main.cpp
)
2026-05-08 22:11:32 +02:00
qt6_add_resources(TEST_SOURCES data/jsons.qrc)
add_executable(test_protocol ${TEST_SOURCES})
2018-12-28 12:10:28 +01:00
target_link_libraries(test_protocol
flowee_testlib_server
univalue
2022-02-22 18:27:48 +01:00
hub_server
2019-03-13 14:50:11 +01:00
flowee_utils
2018-12-28 12:10:28 +01:00
${OPENSSL_LIBRARIES}
2025-03-07 15:36:36 +01:00
Boost::filesystem
2018-12-28 12:10:28 +01:00
${BERKELEY_DB_LIBRARIES}
${MINIUPNP_LIBRARY}
)
2022-04-06 11:46:40 +02:00
add_test(NAME FLOWEE_test_protocol COMMAND test_protocol)