5#include <boost/test/unit_test.hpp>
19 return std::abs(a - b) < epsilon;
26 block_index->
nTime = 1269211443;
27 block_index->
nBits = nbits;
34 "Difficulty was " +
ToString(difficulty)
35 +
" but was expected to be " +
ToString(expected_difficulty));
double GetDifficulty(const CBlockIndex *blockindex)
Get the difficulty of the net wrt to the given block index.
static bool DoubleEquals(double a, double b, double epsilon)
static CBlockIndex * CreateBlockIndexWithNbits(uint32_t nbits)
static void TestDifficulty(uint32_t nbits, double expected_difficulty)
BOOST_AUTO_TEST_CASE(get_difficulty_for_very_low_target)
static void RejectDifficultyMismatch(double difficulty, double expected_difficulty)
The block chain is a tree shaped structure starting with the genesis block at the root,...
int nHeight
height of the entry in the chain. The genesis block has height 0
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_FIXTURE_TEST_SUITE(a, b)
std::string ToString(const T &t)
Locale-independent version of std::to_string.