Bitcoin Core  27.99.0
P2P Digital Currency
Classes | Namespaces | Functions | Variables
setup_common.h File Reference
#include <common/args.h>
#include <kernel/context.h>
#include <key.h>
#include <node/caches.h>
#include <node/context.h>
#include <primitives/transaction.h>
#include <pubkey.h>
#include <stdexcept>
#include <util/chaintype.h>
#include <util/check.h>
#include <util/fs.h>
#include <util/signalinterrupt.h>
#include <util/string.h>
#include <util/vector.h>
#include <functional>
#include <type_traits>
#include <vector>
Include dependency graph for setup_common.h:

Go to the source code of this file.

Classes

struct  BasicTestingSetup
 Basic testing setup. More...
 
struct  ChainTestingSetup
 Testing setup that performs all steps up until right before ChainstateManager gets initialized. More...
 
struct  TestingSetup
 Testing setup that configures a complete environment. More...
 
struct  RegTestingSetup
 Identical to TestingSetup, but chain set to regtest. More...
 
struct  TestChain100Setup
 Testing fixture that pre-creates a 100-block REGTEST-mode block chain. More...
 
class  HasReason
 BOOST_CHECK_EXCEPTION predicates to check the specific validation error. More...
 

Namespaces

 std
 

Functions

template<typename T >
std::ostream & std::operator<< (typename std::enable_if< std::is_enum< T >::value, std::ostream >::type &stream, const T &e)
 
template<class T = const BasicTestingSetup>
std::unique_ptr< T > MakeNoLogFileContext (const ChainType chain_type=ChainType::REGTEST, const std::vector< const char * > &extra_args={})
 Make a test setup that has disk access to the debug.log file disabled. More...
 
CBlock getBlock13b8a ()
 
std::ostream & operator<< (std::ostream &os, const uint256 &num)
 

Variables

const std::function< void(const std::string &)> G_TEST_LOG_FUN
 This is connected to the logger. More...
 
const std::function< std::vector< const char * >)> G_TEST_COMMAND_LINE_ARGUMENTS
 Retrieve the command line arguments. More...
 
const std::function< std::string()> G_TEST_GET_FULL_NAME
 Retrieve the unit test name. More...
 
static constexpr CAmount CENT {1000000}
 

Function Documentation

◆ getBlock13b8a()

CBlock getBlock13b8a ( )
Returns
a real block (0000000000013b8ab2cd513b0261a14096412195a72a0c4827d229dcc7e0f7af) with 9 txs.

Definition at line 585 of file setup_common.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MakeNoLogFileContext()

template<class T = const BasicTestingSetup>
std::unique_ptr<T> MakeNoLogFileContext ( const ChainType  chain_type = ChainType::REGTEST,
const std::vector< const char * > &  extra_args = {} 
)

Make a test setup that has disk access to the debug.log file disabled.

Can be used in "hot loops", for example fuzzing or benchmarking.

Definition at line 223 of file setup_common.h.

Here is the caller graph for this function:

◆ operator<<()

std::ostream& operator<< ( std::ostream &  os,
const uint256 num 
)

Definition at line 86 of file setup_common.cpp.

Here is the call graph for this function:

Variable Documentation

◆ CENT

constexpr CAmount CENT {1000000}
staticconstexpr

Definition at line 49 of file setup_common.h.

◆ G_TEST_COMMAND_LINE_ARGUMENTS

const std::function<std::vector<const char*>)> G_TEST_COMMAND_LINE_ARGUMENTS
extern

Retrieve the command line arguments.

Retrieve the command line arguments.

Allows usage like: test_bitcoin --run_test="net_tests/cnode_listen_port" -- -checkaddrman=1 -printtoconsole=1 which would return ["-checkaddrman=1", "-printtoconsole=1"].

Definition at line 25 of file bench.cpp.

◆ G_TEST_GET_FULL_NAME

const std::function<std::string()> G_TEST_GET_FULL_NAME
extern

Retrieve the unit test name.

Retrieve the unit test name.

Definition at line 27 of file bench.cpp.

◆ G_TEST_LOG_FUN

const std::function<void(const std::string&)> G_TEST_LOG_FUN
extern

This is connected to the logger.

Can be used to redirect logs to any other log

This is connected to the logger.

Definition at line 23 of file bench.cpp.