From 99cbd9d0d2e47cc4a619909593f122fad2193f92 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sat, 11 Dec 2021 23:01:20 +0300 Subject: [PATCH] test: replace feature_block_reward_reallocation.py with two corresponding unit tests (#4603) * test: Add BRR and DAT unit tests * test: Drop feature_block_reward_reallocation.py * change copyright * remove trivially removable includes * use constexpr, remove empty statement * Don't use BOOST_ASSERT, fix bug? Not sure if this was a bug, as it does an assignment. If this isn't a bug please add a comment / explanation ``` BOOST_ASSERT(::ChainActive().Tip()->nVersion = 536870912); ``` * deduplicate all the things (also test all activation periods) * use try_emplace, and remove some tempararies * update threshold to be inline with dynamic * explicitly include map, vector, remove now unneeded base58.h * remove unused param, and replace raw loop with range loop * re: Don't use BOOST_ASSERT, fix bug? * Make TestChainSetup in dynamic_activation_thresholds_tests more general * Specify min level activation tests correctly Co-authored-by: Pasta --- src/Makefile.test.include | 2 + src/test/block_reward_reallocation_tests.cpp | 329 ++++++++++++++++++ .../dynamic_activation_thresholds_tests.cpp | 135 +++++++ .../feature_block_reward_reallocation.py | 200 ----------- test/functional/test_runner.py | 1 - 5 files changed, 466 insertions(+), 201 deletions(-) create mode 100644 src/test/block_reward_reallocation_tests.cpp create mode 100644 src/test/dynamic_activation_thresholds_tests.cpp delete mode 100755 test/functional/feature_block_reward_reallocation.py diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 9d0a5a52ab..0e0db4a147 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -120,6 +120,7 @@ BITCOIN_TESTS =\ test/bech32_tests.cpp \ test/bip32_tests.cpp \ test/bip39_tests.cpp \ + test/block_reward_reallocation_tests.cpp \ test/blockchain_tests.cpp \ test/blockencodings_tests.cpp \ test/blockfilter_tests.cpp \ @@ -139,6 +140,7 @@ BITCOIN_TESTS =\ test/denialofservice_tests.cpp \ test/dip0020opcodes_tests.cpp \ test/descriptor_tests.cpp \ + test/dynamic_activation_thresholds_tests.cpp \ test/evo_deterministicmns_tests.cpp \ test/evo_simplifiedmns_tests.cpp \ test/flatfile_tests.cpp \ diff --git a/src/test/block_reward_reallocation_tests.cpp b/src/test/block_reward_reallocation_tests.cpp new file mode 100644 index 0000000000..0147722aaa --- /dev/null +++ b/src/test/block_reward_reallocation_tests.cpp @@ -0,0 +1,329 @@ +// Copyright (c) 2021 The Dash Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include +#include +#include +#include +#include +#include +#include