Changeset View
Changeset View
Standalone View
Standalone View
src/test/setup_common.h
Show All 9 Lines | |||||
#include <fs.h> | #include <fs.h> | ||||
#include <key.h> | #include <key.h> | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <pubkey.h> | #include <pubkey.h> | ||||
#include <random.h> | #include <random.h> | ||||
#include <scheduler.h> | #include <scheduler.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <type_traits> | |||||
/** | /** | ||||
* Version of Boost::test prior to 1.64 have issues when dealing with nullptr_t. | * Version of Boost::test prior to 1.64 have issues when dealing with nullptr_t. | ||||
* In order to work around this, we ensure that the null pointers are typed in a | * In order to work around this, we ensure that the null pointers are typed in a | ||||
* way that Boost will like better. | * way that Boost will like better. | ||||
* | * | ||||
* TODO: Use nullptr directly once the minimum version of boost is 1.64 or more. | * TODO: Use nullptr directly once the minimum version of boost is 1.64 or more. | ||||
*/ | */ | ||||
#define NULLPTR(T) static_cast<T *>(nullptr) | #define NULLPTR(T) static_cast<T *>(nullptr) | ||||
// Enable BOOST_CHECK_EQUAL for enum class types | |||||
template <typename T> | |||||
std::ostream &operator<<( | |||||
typename std::enable_if<std::is_enum<T>::value, std::ostream>::type &stream, | |||||
const T &e) { | |||||
return stream << static_cast<typename std::underlying_type<T>::type>(e); | |||||
} | |||||
/** | /** | ||||
* This global and the helpers that use it are not thread-safe. | * This global and the helpers that use it are not thread-safe. | ||||
* | * | ||||
* If thread-safety is needed, the global could be made thread_local (given | * If thread-safety is needed, the global could be made thread_local (given | ||||
* that thread_local is supported on all architectures we support) or a | * that thread_local is supported on all architectures we support) or a | ||||
* per-thread instance could be used in the multi-threaded test. | * per-thread instance could be used in the multi-threaded test. | ||||
*/ | */ | ||||
extern FastRandomContext g_insecure_rand_ctx; | extern FastRandomContext g_insecure_rand_ctx; | ||||
▲ Show 20 Lines • Show All 129 Lines • Show Last 20 Lines |