Merge test_random.h into test_bitcoin.h
This commit is contained in:
parent
90620d66c9
commit
124d13a58c
13 changed files with 20 additions and 41 deletions
|
@ -74,7 +74,6 @@ BITCOIN_TESTS =\
|
||||||
test/test_bitcoin.cpp \
|
test/test_bitcoin.cpp \
|
||||||
test/test_bitcoin.h \
|
test/test_bitcoin.h \
|
||||||
test/test_bitcoin_main.cpp \
|
test/test_bitcoin_main.cpp \
|
||||||
test/test_random.h \
|
|
||||||
test/testutil.cpp \
|
test/testutil.cpp \
|
||||||
test/testutil.h \
|
test/testutil.h \
|
||||||
test/timedata_tests.cpp \
|
test/timedata_tests.cpp \
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "undo.h"
|
#include "undo.h"
|
||||||
#include "utilstrencodings.h"
|
#include "utilstrencodings.h"
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
#include "test/test_random.h"
|
|
||||||
#include "validation.h"
|
#include "validation.h"
|
||||||
#include "consensus/validation.h"
|
#include "consensus/validation.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
#include "utilstrencodings.h"
|
#include "utilstrencodings.h"
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
#include "test/test_random.h"
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "consensus/merkle.h"
|
#include "consensus/merkle.h"
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
#include "test/test_random.h"
|
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include "arith_uint256.h"
|
#include "arith_uint256.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
#include "test/test_random.h"
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "streams.h"
|
#include "streams.h"
|
||||||
|
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
#include "test/test_random.h"
|
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "serialize.h"
|
#include "serialize.h"
|
||||||
#include "streams.h"
|
#include "streams.h"
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
#include "test/test_random.h"
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "utilstrencodings.h"
|
#include "utilstrencodings.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "chain.h"
|
#include "chain.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
#include "test/test_random.h"
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,30 @@
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
#include "pubkey.h"
|
#include "pubkey.h"
|
||||||
|
#include "random.h"
|
||||||
#include "txdb.h"
|
#include "txdb.h"
|
||||||
#include "txmempool.h"
|
#include "txmempool.h"
|
||||||
|
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
|
extern uint256 insecure_rand_seed;
|
||||||
|
extern FastRandomContext insecure_rand_ctx;
|
||||||
|
|
||||||
|
static inline void seed_insecure_rand(bool fDeterministic = false)
|
||||||
|
{
|
||||||
|
if (fDeterministic) {
|
||||||
|
insecure_rand_seed = uint256();
|
||||||
|
} else {
|
||||||
|
insecure_rand_seed = GetRandHash();
|
||||||
|
}
|
||||||
|
insecure_rand_ctx = FastRandomContext(insecure_rand_seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t insecure_rand(void)
|
||||||
|
{
|
||||||
|
return insecure_rand_ctx.rand32();
|
||||||
|
}
|
||||||
|
|
||||||
/** Basic testing setup.
|
/** Basic testing setup.
|
||||||
* This just configures logging and chain parameters.
|
* This just configures logging and chain parameters.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
||||||
// Copyright (c) 2009-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.
|
|
||||||
|
|
||||||
#ifndef BITCOIN_TEST_RANDOM_H
|
|
||||||
#define BITCOIN_TEST_RANDOM_H
|
|
||||||
|
|
||||||
#include "random.h"
|
|
||||||
|
|
||||||
extern uint256 insecure_rand_seed;
|
|
||||||
extern FastRandomContext insecure_rand_ctx;
|
|
||||||
|
|
||||||
static inline void seed_insecure_rand(bool fDeterministic = false)
|
|
||||||
{
|
|
||||||
if (fDeterministic) {
|
|
||||||
insecure_rand_seed = uint256();
|
|
||||||
} else {
|
|
||||||
insecure_rand_seed = GetRandHash();
|
|
||||||
}
|
|
||||||
insecure_rand_ctx = FastRandomContext(insecure_rand_seed);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t insecure_rand(void)
|
|
||||||
{
|
|
||||||
return insecure_rand_ctx.rand32();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include "utilstrencodings.h"
|
#include "utilstrencodings.h"
|
||||||
#include "utilmoneystr.h"
|
#include "utilmoneystr.h"
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
#include "test/test_random.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "chain.h"
|
#include "chain.h"
|
||||||
#include "versionbits.h"
|
#include "versionbits.h"
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
#include "test/test_random.h"
|
|
||||||
#include "chainparams.h"
|
#include "chainparams.h"
|
||||||
#include "validation.h"
|
#include "validation.h"
|
||||||
#include "consensus/params.h"
|
#include "consensus/params.h"
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include "test/test_random.h"
|
|
||||||
#include "utilstrencodings.h"
|
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
|
#include "utilstrencodings.h"
|
||||||
#include "wallet/crypter.h"
|
#include "wallet/crypter.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
Loading…
Reference in a new issue