mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-22 23:42:24 +00:00
unit_tests: fix block reward test using post hard fork settings
This would fail, as the post hard fork settings would yield different data, and the test expects pre hard fork data.
This commit is contained in:
parent
595893fcba
commit
eee44e62bc
1 changed files with 15 additions and 15 deletions
|
@ -40,7 +40,7 @@ namespace
|
|||
class block_reward_and_already_generated_coins : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
static const size_t current_block_size = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE / 2;
|
||||
static const size_t current_block_size = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 / 2;
|
||||
|
||||
bool m_block_not_too_big;
|
||||
uint64_t m_block_reward;
|
||||
|
@ -81,7 +81,7 @@ namespace
|
|||
{
|
||||
m_block_not_too_big = get_block_reward(0, 0, already_generated_coins, m_standard_block_reward, 1);
|
||||
ASSERT_TRUE(m_block_not_too_big);
|
||||
ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE, m_standard_block_reward);
|
||||
ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1, m_standard_block_reward);
|
||||
}
|
||||
|
||||
void do_test(size_t median_block_size, size_t current_block_size)
|
||||
|
@ -98,28 +98,28 @@ namespace
|
|||
|
||||
TEST_F(block_reward_and_current_block_size, handles_block_size_less_relevance_level)
|
||||
{
|
||||
do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE - 1);
|
||||
do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 - 1);
|
||||
ASSERT_TRUE(m_block_not_too_big);
|
||||
ASSERT_EQ(m_block_reward, m_standard_block_reward);
|
||||
}
|
||||
|
||||
TEST_F(block_reward_and_current_block_size, handles_block_size_eq_relevance_level)
|
||||
{
|
||||
do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE);
|
||||
do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1);
|
||||
ASSERT_TRUE(m_block_not_too_big);
|
||||
ASSERT_EQ(m_block_reward, m_standard_block_reward);
|
||||
}
|
||||
|
||||
TEST_F(block_reward_and_current_block_size, handles_block_size_gt_relevance_level)
|
||||
{
|
||||
do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE + 1);
|
||||
do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 + 1);
|
||||
ASSERT_TRUE(m_block_not_too_big);
|
||||
ASSERT_LT(m_block_reward, m_standard_block_reward);
|
||||
}
|
||||
|
||||
TEST_F(block_reward_and_current_block_size, handles_block_size_less_2_relevance_level)
|
||||
{
|
||||
do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE - 1);
|
||||
do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 - 1);
|
||||
ASSERT_TRUE(m_block_not_too_big);
|
||||
ASSERT_LT(m_block_reward, m_standard_block_reward);
|
||||
ASSERT_LT(0, m_block_reward);
|
||||
|
@ -127,14 +127,14 @@ namespace
|
|||
|
||||
TEST_F(block_reward_and_current_block_size, handles_block_size_eq_2_relevance_level)
|
||||
{
|
||||
do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE);
|
||||
do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1);
|
||||
ASSERT_TRUE(m_block_not_too_big);
|
||||
ASSERT_EQ(0, m_block_reward);
|
||||
}
|
||||
|
||||
TEST_F(block_reward_and_current_block_size, handles_block_size_gt_2_relevance_level)
|
||||
{
|
||||
do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE + 1);
|
||||
do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 + 1);
|
||||
ASSERT_FALSE(m_block_not_too_big);
|
||||
}
|
||||
|
||||
|
@ -160,17 +160,17 @@ namespace
|
|||
protected:
|
||||
virtual void SetUp()
|
||||
{
|
||||
m_last_block_sizes.push_back(3 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE);
|
||||
m_last_block_sizes.push_back(5 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE);
|
||||
m_last_block_sizes.push_back(7 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE);
|
||||
m_last_block_sizes.push_back(11 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE);
|
||||
m_last_block_sizes.push_back(13 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE);
|
||||
m_last_block_sizes.push_back(3 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1);
|
||||
m_last_block_sizes.push_back(5 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1);
|
||||
m_last_block_sizes.push_back(7 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1);
|
||||
m_last_block_sizes.push_back(11 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1);
|
||||
m_last_block_sizes.push_back(13 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1);
|
||||
|
||||
m_last_block_sizes_median = 7 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE;
|
||||
m_last_block_sizes_median = 7 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1;
|
||||
|
||||
m_block_not_too_big = get_block_reward(epee::misc_utils::median(m_last_block_sizes), 0, already_generated_coins, m_standard_block_reward, 1);
|
||||
ASSERT_TRUE(m_block_not_too_big);
|
||||
ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE, m_standard_block_reward);
|
||||
ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1, m_standard_block_reward);
|
||||
}
|
||||
|
||||
void do_test(size_t current_block_size)
|
||||
|
|
Loading…
Reference in a new issue