Changeset View
Changeset View
Standalone View
Standalone View
src/test/activation_tests.cpp
Show All 17 Lines | static void SetMTP(std::array<CBlockIndex, 12> &blocks, int64_t mtp) { | ||||
for (size_t i = 0; i < len; ++i) { | for (size_t i = 0; i < len; ++i) { | ||||
blocks[i].nTime = mtp + (i - (len / 2)); | blocks[i].nTime = mtp + (i - (len / 2)); | ||||
} | } | ||||
assert(blocks.back().GetMedianTimePast() == mtp); | assert(blocks.back().GetMedianTimePast() == mtp); | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(isgreatwallenabled) { | |||||
DummyConfig config; | |||||
CBlockIndex prev; | |||||
const auto activation = | |||||
config.GetChainParams().GetConsensus().greatWallActivationTime; | |||||
BOOST_CHECK(!IsGreatWallEnabled(config, nullptr)); | |||||
std::array<CBlockIndex, 12> blocks; | |||||
for (size_t i = 1; i < blocks.size(); ++i) { | |||||
blocks[i].pprev = &blocks[i - 1]; | |||||
} | |||||
SetMTP(blocks, activation - 1); | |||||
BOOST_CHECK(!IsGreatWallEnabled(config, &blocks.back())); | |||||
SetMTP(blocks, activation); | |||||
BOOST_CHECK(IsGreatWallEnabled(config, &blocks.back())); | |||||
SetMTP(blocks, activation + 1); | |||||
BOOST_CHECK(IsGreatWallEnabled(config, &blocks.back())); | |||||
} | |||||
BOOST_AUTO_TEST_CASE(isgravitonenabled) { | BOOST_AUTO_TEST_CASE(isgravitonenabled) { | ||||
DummyConfig config; | DummyConfig config; | ||||
CBlockIndex prev; | CBlockIndex prev; | ||||
const auto activation = | const auto activation = | ||||
config.GetChainParams().GetConsensus().gravitonActivationTime; | config.GetChainParams().GetConsensus().gravitonActivationTime; | ||||
BOOST_CHECK(!IsGravitonEnabled(config, nullptr)); | BOOST_CHECK(!IsGravitonEnabled(config, nullptr)); | ||||
Show All 17 Lines |