mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Make test_bitcoin.cpp compatible with Qt Test framework
Move Boost.Test main function and global overrides to a new test_bitcoin_main.cpp file.
This commit is contained in:
parent
8910b4717e
commit
91e303595b
@ -126,6 +126,7 @@ BITCOIN_TESTS =\
|
||||
test/streams_tests.cpp \
|
||||
test/test_bitcoin.cpp \
|
||||
test/test_bitcoin.h \
|
||||
test/test_bitcoin_main.cpp \
|
||||
test/test_random.h \
|
||||
test/testutil.cpp \
|
||||
test/testutil.h \
|
||||
|
@ -2,8 +2,6 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#define BOOST_TEST_MODULE Bitcoin Test Suite
|
||||
|
||||
#include "test_bitcoin.h"
|
||||
|
||||
#include "chainparams.h"
|
||||
@ -27,10 +25,8 @@
|
||||
#include <memory>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
std::unique_ptr<CConnman> g_connman;
|
||||
FastRandomContext insecure_rand_ctx(true);
|
||||
|
||||
extern bool fPrintToConsole;
|
||||
@ -69,11 +65,14 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
|
||||
pblocktree = new CBlockTreeDB(1 << 20, true);
|
||||
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
|
||||
pcoinsTip = new CCoinsViewCache(pcoinsdbview);
|
||||
BOOST_REQUIRE(InitBlockIndex(chainparams));
|
||||
if (!InitBlockIndex(chainparams)) {
|
||||
throw std::runtime_error("InitBlockIndex failed.");
|
||||
}
|
||||
{
|
||||
CValidationState state;
|
||||
bool ok = ActivateBestChain(state, chainparams);
|
||||
BOOST_REQUIRE(ok);
|
||||
if (!ActivateBestChain(state, chainparams)) {
|
||||
throw std::runtime_error("ActivateBestChain failed.");
|
||||
}
|
||||
}
|
||||
nScriptCheckThreads = 3;
|
||||
for (int i=0; i < nScriptCheckThreads-1; i++)
|
||||
@ -150,18 +149,3 @@ CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransaction &txn) {
|
||||
return CTxMemPoolEntry(MakeTransactionRef(txn), nFee, nTime, nHeight,
|
||||
spendsCoinbase, sigOpCost, lp);
|
||||
}
|
||||
|
||||
void Shutdown(void* parg)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void StartShutdown()
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
bool ShutdownRequested()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
26
src/test/test_bitcoin_main.cpp
Normal file
26
src/test/test_bitcoin_main.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2011-2016 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#define BOOST_TEST_MODULE Bitcoin Test Suite
|
||||
|
||||
#include "net.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
std::unique_ptr<CConnman> g_connman;
|
||||
|
||||
void Shutdown(void* parg)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void StartShutdown()
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
bool ShutdownRequested()
|
||||
{
|
||||
return false;
|
||||
}
|
Loading…
Reference in New Issue
Block a user