mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
test: Add RegTestingSetup to setup_common
This commit is contained in:
parent
fa54b3e248
commit
fa0a731d00
5 changed files with 12 additions and 14 deletions
|
@ -112,7 +112,7 @@ void benchmark::BenchRunner::RunAll(Printer& printer, uint64_t num_evals, double
|
||||||
printer.header();
|
printer.header();
|
||||||
|
|
||||||
for (const auto& p : benchmarks()) {
|
for (const auto& p : benchmarks()) {
|
||||||
TestingSetup test{CBaseChainParams::REGTEST};
|
RegTestingSetup test{};
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
assert(::ChainActive().Height() == 0);
|
assert(::ChainActive().Height() == 0);
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <blockencodings.h>
|
#include <blockencodings.h>
|
||||||
#include <consensus/merkle.h>
|
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
|
#include <consensus/merkle.h>
|
||||||
#include <pow.h>
|
#include <pow.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
|
|
||||||
|
@ -14,11 +14,7 @@
|
||||||
|
|
||||||
std::vector<std::pair<uint256, CTransactionRef>> extra_txn;
|
std::vector<std::pair<uint256, CTransactionRef>> extra_txn;
|
||||||
|
|
||||||
struct RegtestingSetup : public TestingSetup {
|
BOOST_FIXTURE_TEST_SUITE(blockencodings_tests, RegTestingSetup)
|
||||||
RegtestingSetup() : TestingSetup(CBaseChainParams::REGTEST) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(blockencodings_tests, RegtestingSetup)
|
|
||||||
|
|
||||||
static CBlock BuildBlockTestCase() {
|
static CBlock BuildBlockTestCase() {
|
||||||
CBlock block;
|
CBlock block;
|
||||||
|
|
|
@ -124,7 +124,7 @@ TestingSetup::~TestingSetup()
|
||||||
pblocktree.reset();
|
pblocktree.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
TestChain100Setup::TestChain100Setup() : TestingSetup(CBaseChainParams::REGTEST)
|
TestChain100Setup::TestChain100Setup()
|
||||||
{
|
{
|
||||||
// CreateAndProcessBlock() does not support building SegWit blocks, so don't activate in these tests.
|
// CreateAndProcessBlock() does not support building SegWit blocks, so don't activate in these tests.
|
||||||
// TODO: fix the code to support SegWit blocks.
|
// TODO: fix the code to support SegWit blocks.
|
||||||
|
|
|
@ -76,6 +76,12 @@ struct TestingSetup : public BasicTestingSetup {
|
||||||
~TestingSetup();
|
~TestingSetup();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Identical to TestingSetup, but chain set to regtest */
|
||||||
|
struct RegTestingSetup : public TestingSetup {
|
||||||
|
RegTestingSetup()
|
||||||
|
: TestingSetup{CBaseChainParams::REGTEST} {}
|
||||||
|
};
|
||||||
|
|
||||||
class CBlock;
|
class CBlock;
|
||||||
struct CMutableTransaction;
|
struct CMutableTransaction;
|
||||||
class CScript;
|
class CScript;
|
||||||
|
@ -84,7 +90,7 @@ class CScript;
|
||||||
// Testing fixture that pre-creates a
|
// Testing fixture that pre-creates a
|
||||||
// 100-block REGTEST-mode block chain
|
// 100-block REGTEST-mode block chain
|
||||||
//
|
//
|
||||||
struct TestChain100Setup : public TestingSetup {
|
struct TestChain100Setup : public RegTestingSetup {
|
||||||
TestChain100Setup();
|
TestChain100Setup();
|
||||||
|
|
||||||
// Create a new block with just given transactions, coinbase paying to
|
// Create a new block with just given transactions, coinbase paying to
|
||||||
|
|
|
@ -18,13 +18,9 @@
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
struct RegtestingSetup : public TestingSetup {
|
|
||||||
RegtestingSetup() : TestingSetup(CBaseChainParams::REGTEST) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
static const std::vector<unsigned char> V_OP_TRUE{OP_TRUE};
|
static const std::vector<unsigned char> V_OP_TRUE{OP_TRUE};
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(validation_block_tests, RegtestingSetup)
|
BOOST_FIXTURE_TEST_SUITE(validation_block_tests, RegTestingSetup)
|
||||||
|
|
||||||
struct TestSubscriber : public CValidationInterface {
|
struct TestSubscriber : public CValidationInterface {
|
||||||
uint256 m_expected_tip;
|
uint256 m_expected_tip;
|
||||||
|
|
Loading…
Add table
Reference in a new issue