Skip to content

Commit

Permalink
Fix unit test failure due to skip_flags changes caused by #492 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
theoreticalbts committed Feb 16, 2016
1 parent 4a6de2f commit 32f07de
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
8 changes: 4 additions & 4 deletions tests/common/database_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,20 +320,20 @@ void database_fixture::generate_blocks( uint32_t block_count )
generate_block();
}

void database_fixture::generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks)
void database_fixture::generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks, uint32_t skip)
{
if( miss_intermediate_blocks )
{
generate_block();
generate_block(skip);
auto slots_to_miss = db.get_slot_at_time(timestamp);
if( slots_to_miss <= 1 )
return;
--slots_to_miss;
generate_block(~0, init_account_priv_key, slots_to_miss);
generate_block(skip, init_account_priv_key, slots_to_miss);
return;
}
while( db.head_block_time() < timestamp )
generate_block();
generate_block(skip);
}

account_create_operation database_fixture::make_account(
Expand Down
2 changes: 1 addition & 1 deletion tests/common/database_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ struct database_fixture {
* @brief Generates blocks until the head block time matches or exceeds timestamp
* @param timestamp target time to generate blocks until
*/
void generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks = true);
void generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks = true, uint32_t skip = ~0);

account_create_operation make_account(
const std::string& name = "nathan",
Expand Down
17 changes: 13 additions & 4 deletions tests/tests/fee_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,23 @@ BOOST_AUTO_TEST_CASE( fee_refund_test )
int64_t order_create_fee = 537;
int64_t order_cancel_fee = 129;

generate_block();
uint32_t skip = database::skip_witness_signature
| database::skip_transaction_signatures
| database::skip_transaction_dupe_check
| database::skip_block_size_check
| database::skip_tapos_check
| database::skip_authority_check
| database::skip_merkle_check
;

generate_block( skip );

for( int i=0; i<2; i++ )
{
if( i == 1 )
{
generate_blocks( HARDFORK_445_TIME );
generate_block();
generate_blocks( HARDFORK_445_TIME, true, skip );
generate_block( skip );
}

// enable_fees() and change_fees() modifies DB directly, and results will be overwritten by block generation
Expand Down Expand Up @@ -719,7 +728,7 @@ BOOST_AUTO_TEST_CASE( fee_refund_test )
// but we'll save that for future cleanup

// undo above tx's and reset
generate_block();
generate_block( skip );
db.pop_block();
}
}
Expand Down

0 comments on commit 32f07de

Please sign in to comment.