When executing unit testing, values for some objects (eg vests) are set to abnormally high values
Basic example:
BOOST_AUTO_TEST_CASE( delegate_rc_operation_apply )
{
try
{
BOOST_TEST_MESSAGE( "Testing: delegate_rc_operation_apply" );
ACTORS( (alice)(bob)(dave) )
vest( HIVE_INIT_MINER_NAME, "alice", ASSET( "10.000 TESTS" ) );
int64_t alice_vests = alice.vesting_shares.amount.value;
const account_object& bob_account = db->get< account_object, by_name >( "bob" );
idump((bob_account.vesting_shares.amount.value));
}
}
outputs:
1890625ms direct_rc_delegation.cpp:58 test_method ] bob_account.vesting_shares.amount.value: 98716683119
I'm not sure if I'm doing something wrong but I have seen this behavior across multiple objects mostly in relation to numbers.
So far my solution is to manually set those values:
db_plugin->debug_update( [=]( database& db )
{
db.modify( db.get_account( "alice" ), [&]( account_object& a )
{
a.vesting_shares = asset( 90, VESTS_SYMBOL );
});
db.modify( db.get_account( "bob" ), [&]( account_object& a )
{
a.vesting_shares = asset( 0, VESTS_SYMBOL );
});
db.modify( db.get_account( "dave" ), [&]( account_object& a )
{
a.vesting_shares = asset( 0, VESTS_SYMBOL );
});
db.modify( db.get< rc_account_object, by_name >( "alice" ), [&]( rc_account_object& rca )
{
rca.max_rc_creation_adjustment.amount.value = 10;
rca.rc_manabar.current_mana = 100;
rca.rc_manabar.last_update_time = db.head_block_time().sec_since_epoch();
rca.last_max_rc = 100;
});
db.modify( db.get< rc_account_object, by_name >( "bob" ), [&]( rc_account_object& rca )
{
rca.max_rc_creation_adjustment.amount.value = 10;
rca.rc_manabar.current_mana = 10;
rca.rc_manabar.last_update_time = db.head_block_time().sec_since_epoch();
rca.max_rc_creation_adjustment.amount.value = 10;
rca.last_max_rc = 10;
});
db.modify( db.get< rc_account_object, by_name >( "dave" ), [&]( rc_account_object& rca )
{
rca.max_rc_creation_adjustment.amount.value = 10;
rca.rc_manabar.current_mana = 10;
rca.rc_manabar.last_update_time = db.head_block_time().sec_since_epoch();
rca.max_rc_creation_adjustment.amount.value = 10;
rca.last_max_rc = 10;
});
});