Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/setup_common.h
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | static inline uint64_t InsecureRandRange(uint64_t range) { | ||||
return g_insecure_rand_ctx.randrange(range); | return g_insecure_rand_ctx.randrange(range); | ||||
} | } | ||||
static inline bool InsecureRandBool() { | static inline bool InsecureRandBool() { | ||||
return g_insecure_rand_ctx.randbool(); | return g_insecure_rand_ctx.randbool(); | ||||
} | } | ||||
static constexpr Amount CENT(COIN / 100); | static constexpr Amount CENT(COIN / 100); | ||||
void AddCustomArguments(const std::set<std::string> &arguments); | |||||
/** | |||||
* Instantiate a static CustomArguments instance to add custom arguments in the | |||||
* tests: | |||||
* // In the test .cpp file | |||||
* static CustomArguments argumentsForMyTest({"-foo", "-bar"}); | |||||
* | |||||
* Then get the arguments from the test: | |||||
* // In the test case | |||||
* gArgs.getArg("-foo", 42); | |||||
*/ | |||||
struct CustomArguments { | |||||
explicit CustomArguments(const std::set<std::string> &arguments) { | |||||
AddCustomArguments(arguments); | |||||
} | |||||
}; | |||||
/** | /** | ||||
* Basic testing setup. | * Basic testing setup. | ||||
* This just configures logging, data dir and chain parameters. | * This just configures logging, data dir and chain parameters. | ||||
*/ | */ | ||||
struct BasicTestingSetup { | struct BasicTestingSetup { | ||||
ECCVerifyHandle globalVerifyHandle; | ECCVerifyHandle globalVerifyHandle; | ||||
NodeContext m_node; | NodeContext m_node; | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |