Skip to content

Commit

Permalink
Progress on testing #78
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Vandeberg committed Jun 13, 2016
1 parent 0f412b3 commit c3939c6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions libraries/chain/database.cpp
Expand Up @@ -2081,6 +2081,7 @@ void database::initialize_evaluators()
register_evaluator<transfer_evaluator>();
register_evaluator<transfer_to_vesting_evaluator>();
register_evaluator<withdraw_vesting_evaluator>();
register_evaluator<set_withdraw_vesting_destination_evaluator>();
register_evaluator<account_create_evaluator>();
register_evaluator<account_update_evaluator>();
register_evaluator<witness_update_evaluator>();
Expand Down
Expand Up @@ -36,6 +36,7 @@ namespace steemit { namespace chain {

delete_comment_operation,
custom_json_operation,
set_withdraw_vesting_destination_operation,

/// virtual operations below this point
fill_convert_request_operation,
Expand Down
Expand Up @@ -498,6 +498,7 @@ FC_REFLECT( steemit::chain::account_update_operation,
FC_REFLECT( steemit::chain::transfer_operation, (from)(to)(amount)(memo) )
FC_REFLECT( steemit::chain::transfer_to_vesting_operation, (from)(to)(amount) )
FC_REFLECT( steemit::chain::withdraw_vesting_operation, (account)(vesting_shares) )
FC_REFLECT( steemit::chain::set_withdraw_vesting_destination_operation, (from_account)(to_account)(percent)(auto_vest) )
FC_REFLECT( steemit::chain::witness_update_operation, (owner)(url)(block_signing_key)(props)(fee) )
FC_REFLECT( steemit::chain::account_witness_vote_operation, (account)(witness)(approve) )
FC_REFLECT( steemit::chain::account_witness_proxy_operation, (account)(proxy) )
Expand Down
43 changes: 43 additions & 0 deletions tests/tests/operation_time_tests.cpp
Expand Up @@ -770,6 +770,49 @@ BOOST_AUTO_TEST_CASE( vesting_withdrawals )
FC_LOG_AND_RETHROW()
}

BOOST_AUTO_TEST_CASE( vesting_withdraw_destination )
{
try
{
ACTORS( (alice)(bob)(sam) )

auto original_vesting = alice.vesting_shares;

fund( "alice", 1040000 );
vest( "alice", 1040000 );

auto withdraw_amount = alice.vesting_shares - original_vesting;

withdraw_vesting_operation wv;
wv.account = "alice";
wv.vesting_shares = withdraw_amount;

signed_transaction tx;
tx.set_expiration( db.head_block_time() + STEEMIT_MAX_TIME_UNTIL_EXPIRATION );
tx.operations.push_back( wv );
tx.sign( alice_private_key, db.get_chain_id() );
db.push_transaction( tx, 0 );

tx.operations.clear();
tx.signatures.clear();

set_withdraw_vesting_destination_operation op;
op.from_account = "alice";
op.to_account = "bob";
op.percent = STEEMIT_1_PERCENT * 50;
op.auto_vest = true;
tx.operations.push_back( op );

op.to_account = "sam";
op.percent = STEEMIT_1_PERCENT * 30;
op.auto_vest = false;
tx.operations.push_back( op );
tx.sign( alice_private_key, db.get_chain_id() );
db.push_transaction( tx, 0 );
}
FC_LOG_AND_RETHROW()
}

BOOST_AUTO_TEST_CASE( feed_publish_mean )
{
try
Expand Down

0 comments on commit c3939c6

Please sign in to comment.