Skip to content

Commit fa0a731

Browse files
author
MarcoFalke
committed
test: Add RegTestingSetup to setup_common
1 parent fa54b3e commit fa0a731

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

src/bench/bench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void benchmark::BenchRunner::RunAll(Printer& printer, uint64_t num_evals, double
112112
printer.header();
113113

114114
for (const auto& p : benchmarks()) {
115-
TestingSetup test{CBaseChainParams::REGTEST};
115+
RegTestingSetup test{};
116116
{
117117
LOCK(cs_main);
118118
assert(::ChainActive().Height() == 0);

src/test/blockencodings_tests.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <blockencodings.h>
6-
#include <consensus/merkle.h>
76
#include <chainparams.h>
7+
#include <consensus/merkle.h>
88
#include <pow.h>
99
#include <streams.h>
1010

@@ -14,11 +14,7 @@
1414

1515
std::vector<std::pair<uint256, CTransactionRef>> extra_txn;
1616

17-
struct RegtestingSetup : public TestingSetup {
18-
RegtestingSetup() : TestingSetup(CBaseChainParams::REGTEST) {}
19-
};
20-
21-
BOOST_FIXTURE_TEST_SUITE(blockencodings_tests, RegtestingSetup)
17+
BOOST_FIXTURE_TEST_SUITE(blockencodings_tests, RegTestingSetup)
2218

2319
static CBlock BuildBlockTestCase() {
2420
CBlock block;

src/test/setup_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ TestingSetup::~TestingSetup()
124124
pblocktree.reset();
125125
}
126126

127-
TestChain100Setup::TestChain100Setup() : TestingSetup(CBaseChainParams::REGTEST)
127+
TestChain100Setup::TestChain100Setup()
128128
{
129129
// CreateAndProcessBlock() does not support building SegWit blocks, so don't activate in these tests.
130130
// TODO: fix the code to support SegWit blocks.

src/test/setup_common.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ struct TestingSetup : public BasicTestingSetup {
7676
~TestingSetup();
7777
};
7878

79+
/** Identical to TestingSetup, but chain set to regtest */
80+
struct RegTestingSetup : public TestingSetup {
81+
RegTestingSetup()
82+
: TestingSetup{CBaseChainParams::REGTEST} {}
83+
};
84+
7985
class CBlock;
8086
struct CMutableTransaction;
8187
class CScript;
@@ -84,7 +90,7 @@ class CScript;
8490
// Testing fixture that pre-creates a
8591
// 100-block REGTEST-mode block chain
8692
//
87-
struct TestChain100Setup : public TestingSetup {
93+
struct TestChain100Setup : public RegTestingSetup {
8894
TestChain100Setup();
8995

9096
// Create a new block with just given transactions, coinbase paying to

src/test/validation_block_tests.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818

1919
#include <thread>
2020

21-
struct RegtestingSetup : public TestingSetup {
22-
RegtestingSetup() : TestingSetup(CBaseChainParams::REGTEST) {}
23-
};
24-
2521
static const std::vector<unsigned char> V_OP_TRUE{OP_TRUE};
2622

27-
BOOST_FIXTURE_TEST_SUITE(validation_block_tests, RegtestingSetup)
23+
BOOST_FIXTURE_TEST_SUITE(validation_block_tests, RegTestingSetup)
2824

2925
struct TestSubscriber : public CValidationInterface {
3026
uint256 m_expected_tip;

0 commit comments

Comments
 (0)