tests: replace BOOST_REQUIRE_THROW / BOOST_CHECK_THROW with GRAPHENE_*_THROW
This commit is contained in:
parent
16db253535
commit
4229e33525
7 changed files with 72 additions and 72 deletions
|
|
@ -207,7 +207,7 @@ BOOST_FIXTURE_TEST_CASE( update_account_keys, database_fixture )
|
|||
trx.sign( *owner_privkey[i] );
|
||||
if( i < int(create_op.owner.weight_threshold-1) )
|
||||
{
|
||||
BOOST_REQUIRE_THROW(db.push_transaction(trx), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(db.push_transaction(trx), fc::exception);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE( any_two_of_three )
|
|||
transfer_operation op = {asset(), nathan.id, account_id_type(), core.amount(500)};
|
||||
trx.operations.push_back(op);
|
||||
sign(trx, nathan_key1);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
sign(trx, nathan_key2);
|
||||
PUSH_TX( db, trx, database::skip_transaction_dupe_check );
|
||||
BOOST_CHECK_EQUAL(get_balance(nathan, core), old_balance - 500);
|
||||
|
|
@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE( any_two_of_three )
|
|||
trx.signatures.clear();
|
||||
//sign(trx, fc::ecc::private_key::generate());
|
||||
sign(trx,nathan_key3);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
BOOST_CHECK_EQUAL(get_balance(nathan, core), old_balance - 1500);
|
||||
} catch (fc::exception& e) {
|
||||
edump((e.to_detail_string()));
|
||||
|
|
@ -135,16 +135,16 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
BOOST_TEST_MESSAGE( "Attempting to transfer with no signatures, should fail" );
|
||||
transfer_operation op = {asset(), child.id, account_id_type(), core.amount(500)};
|
||||
trx.operations.push_back(op);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
|
||||
BOOST_TEST_MESSAGE( "Attempting to transfer with parent1 signature, should fail" );
|
||||
sign(trx,parent1_key);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
trx.signatures.clear();
|
||||
|
||||
BOOST_TEST_MESSAGE( "Attempting to transfer with parent2 signature, should fail" );
|
||||
sign(trx,parent2_key);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
|
||||
BOOST_TEST_MESSAGE( "Attempting to transfer with parent1 and parent2 signature, should succeed" );
|
||||
sign(trx,parent1_key);
|
||||
|
|
@ -172,14 +172,14 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
op = {asset(),child.id, account_id_type(), core.amount(500)};
|
||||
trx.operations.push_back(op);
|
||||
BOOST_TEST_MESSAGE( "Attempting transfer with no signatures, should fail" );
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
BOOST_TEST_MESSAGE( "Attempting transfer just parent1, should fail" );
|
||||
sign(trx, parent1_key);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
trx.signatures.clear();
|
||||
BOOST_TEST_MESSAGE( "Attempting transfer just parent2, should fail" );
|
||||
sign(trx, parent2_key);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
|
||||
BOOST_TEST_MESSAGE( "Attempting transfer both parents, should succeed" );
|
||||
sign(trx, parent1_key);
|
||||
|
|
@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
trx.operations.push_back(op);
|
||||
sign(trx, parent1_key);
|
||||
sign(trx, parent2_key);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
trx.signatures.clear();
|
||||
trx.sign( parent2_key );
|
||||
trx.sign( grandparent_key );
|
||||
|
|
@ -244,7 +244,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
sign(trx, grandparent_key);
|
||||
sign(trx, delegate_priv_key);
|
||||
//Fails due to recursion depth.
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
BOOST_TEST_MESSAGE( "verify child key can override recursion checks" );
|
||||
trx.signatures.clear();
|
||||
sign(trx, child_key);
|
||||
|
|
@ -268,7 +268,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
|
|||
trx.operations.push_back(op);
|
||||
sign(trx, parent2_key);
|
||||
//Fails due to recursion depth.
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, database::skip_transaction_dupe_check ), fc::exception);
|
||||
} catch (fc::exception& e) {
|
||||
edump((e.to_detail_string()));
|
||||
throw;
|
||||
|
|
@ -331,11 +331,11 @@ BOOST_AUTO_TEST_CASE( proposed_single_account )
|
|||
trx.operations = {proposal_update_operation{account_id_type(), asset(), proposal.id,{nathan.id},flat_set<account_id_type>{},flat_set<account_id_type>{},flat_set<account_id_type>{},flat_set<public_key_type>{},flat_set<public_key_type>{}}};
|
||||
trx.sign( genesis_key );
|
||||
//Genesis may not add nathan's approval.
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
trx.operations = {proposal_update_operation{account_id_type(), asset(), proposal.id,{account_id_type()},flat_set<account_id_type>{},flat_set<account_id_type>{},flat_set<account_id_type>{},flat_set<public_key_type>{},flat_set<public_key_type>{}}};
|
||||
trx.sign( genesis_key );
|
||||
//Genesis has no stake in the transaction.
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
|
||||
trx.signatures.clear();
|
||||
trx.operations = {proposal_update_operation{nathan.id, asset(), proposal.id,{nathan.id},flat_set<account_id_type>{},flat_set<account_id_type>{},flat_set<account_id_type>{},flat_set<public_key_type>{},flat_set<public_key_type>{}}};
|
||||
|
|
@ -372,7 +372,7 @@ BOOST_AUTO_TEST_CASE( genesis_authority )
|
|||
BOOST_TEST_MESSAGE( "transfering 100000 CORE to nathan, signing with genesis key" );
|
||||
trx.operations.push_back(transfer_operation({asset(), account_id_type(), nathan.id, asset(100000)}));
|
||||
sign(trx, genesis_key);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
|
||||
auto sign = [&] { trx.signatures.clear(); trx.sign(nathan_key); };
|
||||
|
||||
|
|
@ -384,12 +384,12 @@ BOOST_AUTO_TEST_CASE( genesis_authority )
|
|||
sign();
|
||||
|
||||
// The review period isn't set yet. Make sure it throws.
|
||||
BOOST_REQUIRE_THROW( PUSH_TX( db, trx ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx ), fc::exception );
|
||||
pop.review_period_seconds = global_params.committee_proposal_review_period / 2;
|
||||
trx.operations.back() = pop;
|
||||
sign();
|
||||
// The review period is too short. Make sure it throws.
|
||||
BOOST_REQUIRE_THROW( PUSH_TX( db, trx ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx ), fc::exception );
|
||||
pop.review_period_seconds = global_params.committee_proposal_review_period;
|
||||
trx.operations.back() = pop;
|
||||
sign();
|
||||
|
|
@ -435,7 +435,7 @@ BOOST_AUTO_TEST_CASE( genesis_authority )
|
|||
trx.operations.back() = uop;
|
||||
trx.sign( genesis_key);
|
||||
// Should throw because the transaction is now in review.
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
|
||||
generate_blocks(prop.expiration_time);
|
||||
BOOST_CHECK_EQUAL(get_balance(nathan, asset_id_type()(db)), 100000);
|
||||
|
|
@ -590,7 +590,7 @@ BOOST_FIXTURE_TEST_CASE( proposal_two_accounts, database_fixture )
|
|||
uop.active_approvals_to_add = {dan.get_id()};
|
||||
trx.operations.push_back(uop);
|
||||
trx.sign(nathan_key);
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
trx.sign(dan_key);
|
||||
PUSH_TX( db, trx );
|
||||
|
||||
|
|
@ -911,7 +911,7 @@ BOOST_FIXTURE_TEST_CASE( max_authority_membership, database_fixture )
|
|||
|
||||
if( num_keys > max_authority_membership )
|
||||
{
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, tx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, tx, ~0 ), fc::exception);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -976,7 +976,7 @@ BOOST_FIXTURE_TEST_CASE( bogus_signature, database_fixture )
|
|||
trx.operations.push_back( xfer_op );
|
||||
BOOST_TEST_MESSAGE( "Invalidating Alices Signature" );
|
||||
// Alice's signature is now invalid
|
||||
BOOST_REQUIRE_THROW( PUSH_TX( db, trx, skip ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, skip ), fc::exception );
|
||||
// Re-sign, now OK (sig is replaced)
|
||||
BOOST_TEST_MESSAGE( "Resign with Alice's Signature" );
|
||||
trx.signatures.clear();
|
||||
|
|
@ -988,7 +988,7 @@ BOOST_FIXTURE_TEST_CASE( bogus_signature, database_fixture )
|
|||
trx.sign( alice_key );
|
||||
trx.sign( charlie_key );
|
||||
// Signed by third-party Charlie (irrelevant key, not in authority)
|
||||
BOOST_REQUIRE_THROW( PUSH_TX( db, trx, skip ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, skip ), fc::exception );
|
||||
}
|
||||
FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
|
@ -1029,7 +1029,7 @@ BOOST_FIXTURE_TEST_CASE( voting_account, database_fixture )
|
|||
trx.operations.push_back(op);
|
||||
trx.sign(vikram_private_key);
|
||||
// Fails because num_committee is larger than the cardinality of committee members being voted for
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
op.new_options->num_committee = 3;
|
||||
trx.operations = {op};
|
||||
trx.signatures.clear();
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE( data_fees )
|
|||
|
||||
BOOST_AUTO_TEST_CASE( exceptions )
|
||||
{
|
||||
BOOST_CHECK_THROW(FC_THROW_EXCEPTION(invalid_claim_amount, "Etc"), invalid_claim_amount);
|
||||
GRAPHENE_CHECK_THROW(FC_THROW_EXCEPTION(invalid_claim_amount, "Etc"), invalid_claim_amount);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ BOOST_AUTO_TEST_CASE( fork_blocks )
|
|||
b.transactions.back().operations.emplace_back(transfer_operation());
|
||||
b.sign(delegate_priv_key);
|
||||
BOOST_CHECK_EQUAL(b.block_num(), 14);
|
||||
BOOST_CHECK_THROW(PUSH_BLOCK( db1, b ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_BLOCK( db1, b ), fc::exception);
|
||||
}
|
||||
BOOST_CHECK_EQUAL(db1.head_block_num(), 13);
|
||||
BOOST_CHECK_EQUAL(db1.head_block_id().str(), db1_tip);
|
||||
|
|
@ -367,7 +367,7 @@ BOOST_AUTO_TEST_CASE( switch_forks_undo_create )
|
|||
b = db2.generate_block(now, db2.get_scheduled_witness(1).first, delegate_priv_key, database::skip_nothing);
|
||||
db1.push_block(b);
|
||||
|
||||
BOOST_CHECK_THROW(nathan_id(db1), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(nathan_id(db1), fc::exception);
|
||||
|
||||
PUSH_TX( db2, trx );
|
||||
|
||||
|
|
@ -417,14 +417,14 @@ BOOST_AUTO_TEST_CASE( duplicate_transactions )
|
|||
trx.sign( delegate_priv_key );
|
||||
PUSH_TX( db1, trx, skip_sigs );
|
||||
|
||||
BOOST_CHECK_THROW(PUSH_TX( db1, trx, skip_sigs ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db1, trx, skip_sigs ), fc::exception);
|
||||
|
||||
now += db1.block_interval();
|
||||
auto b = db1.generate_block( now, db1.get_scheduled_witness( 1 ).first, delegate_priv_key, skip_sigs );
|
||||
PUSH_BLOCK( db2, b, skip_sigs );
|
||||
|
||||
BOOST_CHECK_THROW(PUSH_TX( db1, trx, skip_sigs ), fc::exception);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db2, trx, skip_sigs ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db1, trx, skip_sigs ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db2, trx, skip_sigs ), fc::exception);
|
||||
BOOST_CHECK_EQUAL(db1.get_balance(nathan_id, asset_id_type()).amount.value, 500);
|
||||
BOOST_CHECK_EQUAL(db2.get_balance(nathan_id, asset_id_type()).amount.value, 500);
|
||||
} catch (fc::exception& e) {
|
||||
|
|
@ -476,7 +476,7 @@ BOOST_AUTO_TEST_CASE( tapos )
|
|||
trx.operations.push_back(transfer_operation({asset(), account_id_type(), nathan_id, asset(50)}));
|
||||
trx.sign(delegate_priv_key);
|
||||
//relative_expiration is 1, but ref block is 2 blocks old, so this should fail.
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db1, trx, database::skip_transaction_signatures | database::skip_authority_check ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db1, trx, database::skip_transaction_signatures | database::skip_authority_check ), fc::exception);
|
||||
trx.set_expiration(db1.head_block_id(), 2);
|
||||
trx.signatures.clear();
|
||||
trx.sign(delegate_priv_key);
|
||||
|
|
@ -601,17 +601,17 @@ BOOST_FIXTURE_TEST_CASE( double_sign_check, database_fixture )
|
|||
trx.validate();
|
||||
|
||||
BOOST_TEST_MESSAGE( "Verify that not-signing causes an exception" );
|
||||
BOOST_REQUIRE_THROW( db.push_transaction(trx, 0), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( db.push_transaction(trx, 0), fc::exception );
|
||||
|
||||
BOOST_TEST_MESSAGE( "Verify that double-signing causes an exception" );
|
||||
trx.sign(bob_private_key);
|
||||
trx.sign(bob_private_key);
|
||||
BOOST_REQUIRE_THROW( db.push_transaction(trx, 0), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( db.push_transaction(trx, 0), fc::exception );
|
||||
|
||||
BOOST_TEST_MESSAGE( "Verify that signing with an extra, unused key fails" );
|
||||
trx.signatures.pop_back();
|
||||
trx.sign(generate_private_key("bogus"));
|
||||
BOOST_REQUIRE_THROW( db.push_transaction(trx, 0), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( db.push_transaction(trx, 0), fc::exception );
|
||||
|
||||
BOOST_TEST_MESSAGE( "Verify that signing once with the proper key passes" );
|
||||
trx.signatures.pop_back();
|
||||
|
|
@ -776,7 +776,7 @@ BOOST_FIXTURE_TEST_CASE( unimp_force_settlement, database_fixture )
|
|||
trx.operations.push_back(sop);
|
||||
trx.sign(key_id_type(),private_key);
|
||||
//Trx has expired by now. Make sure it throws.
|
||||
BOOST_CHECK_THROW(settle_id = PUSH_TX( db, trx ).operation_results.front().get<object_id_type>(), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(settle_id = PUSH_TX( db, trx ).operation_results.front().get<object_id_type>(), fc::exception);
|
||||
trx.set_expiration(db.head_block_time() + fc::minutes(1));
|
||||
trx.sign(key_id_type(),private_key);
|
||||
settle_id = PUSH_TX( db, trx ).operation_results.front().get<object_id_type>();
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE( call_order_update_test )
|
|||
BOOST_REQUIRE_EQUAL( get_balance( dan, core ), 10000000 - 10000 + 5000 );
|
||||
|
||||
BOOST_TEST_MESSAGE( "verifying that attempting to cover the full amount without claiming the collateral fails" );
|
||||
BOOST_REQUIRE_THROW( cover( dan, bitusd.amount(2500), core.amount(0) ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( cover( dan, bitusd.amount(2500), core.amount(0) ), fc::exception );
|
||||
|
||||
cover( dan, bitusd.amount(2500), core.amount(5000));
|
||||
|
||||
|
|
@ -127,14 +127,14 @@ BOOST_AUTO_TEST_CASE( call_order_update_test )
|
|||
BOOST_REQUIRE_EQUAL( get_balance( dan, core ), 10000000 - 20000 );
|
||||
|
||||
BOOST_TEST_MESSAGE( "increasing debt without increasing collateral again" );
|
||||
BOOST_REQUIRE_THROW( borrow( dan, bitusd.amount(80000), asset(0)), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( borrow( dan, bitusd.amount(80000), asset(0)), fc::exception );
|
||||
BOOST_TEST_MESSAGE( "attempting to claim all collateral without paying off debt" );
|
||||
BOOST_REQUIRE_THROW( cover( dan, bitusd.amount(0), asset(20000)), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( cover( dan, bitusd.amount(0), asset(20000)), fc::exception );
|
||||
BOOST_TEST_MESSAGE( "attempting reduce collateral without paying off any debt" );
|
||||
cover( dan, bitusd.amount(0), asset(1000));
|
||||
|
||||
BOOST_TEST_MESSAGE( "attempting change call price to be below minimum for debt/collateral ratio" );
|
||||
BOOST_REQUIRE_THROW( cover( dan, bitusd.amount(0), asset(0)), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( cover( dan, bitusd.amount(0), asset(0)), fc::exception );
|
||||
|
||||
} catch (fc::exception& e) {
|
||||
edump((e.to_detail_string()));
|
||||
|
|
@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE( black_swan )
|
|||
force_settle(borrower, bitusd.amount(100));
|
||||
|
||||
BOOST_TEST_MESSAGE( "Verify that we cannot borrow after black swan" );
|
||||
BOOST_REQUIRE_THROW( borrow(borrower, bitusd.amount(1000), asset(2000)), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( borrow(borrower, bitusd.amount(1000), asset(2000)), fc::exception );
|
||||
} catch( const fc::exception& e) {
|
||||
edump((e.to_detail_string()));
|
||||
throw;
|
||||
|
|
@ -275,22 +275,22 @@ BOOST_AUTO_TEST_CASE( prediction_market )
|
|||
transfer(genesis_account, nathan_id, asset(init_balance));
|
||||
|
||||
BOOST_TEST_MESSAGE( "Require throw for mismatch collateral amounts" );
|
||||
BOOST_REQUIRE_THROW( borrow( dan, pmark.amount(1000), asset(2000) ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( borrow( dan, pmark.amount(1000), asset(2000) ), fc::exception );
|
||||
|
||||
BOOST_TEST_MESSAGE( "Open position with equal collateral" );
|
||||
borrow( dan, pmark.amount(1000), asset(1000) );
|
||||
|
||||
BOOST_TEST_MESSAGE( "Cover position with unequal asset should fail." );
|
||||
BOOST_REQUIRE_THROW( cover( dan, pmark.amount(500), asset(1000) ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( cover( dan, pmark.amount(500), asset(1000) ), fc::exception );
|
||||
|
||||
BOOST_TEST_MESSAGE( "Cover half of position with equal ammounts" );
|
||||
cover( dan, pmark.amount(500), asset(500) );
|
||||
|
||||
BOOST_TEST_MESSAGE( "Verify that forced settlment fails before global settlement" );
|
||||
BOOST_REQUIRE_THROW( force_settle( dan, pmark.amount(100) ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( force_settle( dan, pmark.amount(100) ), fc::exception );
|
||||
|
||||
BOOST_TEST_MESSAGE( "Shouldn't be allowed to force settle at more than 1 collateral per debt" );
|
||||
BOOST_REQUIRE_THROW( force_global_settle( pmark, pmark.amount(100) / core.amount(105) ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( force_global_settle( pmark, pmark.amount(100) / core.amount(105) ), fc::exception );
|
||||
|
||||
force_global_settle( pmark, pmark.amount(100) / core.amount(95) );
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ BOOST_AUTO_TEST_CASE( create_account_test )
|
|||
op.owner.add_authority(account_id_type(9999999999), 10);
|
||||
trx.operations.back() = op;
|
||||
op.owner = auth_bak;
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
op.owner = auth_bak;
|
||||
|
||||
trx.operations.back() = op;
|
||||
|
|
@ -487,7 +487,7 @@ BOOST_AUTO_TEST_CASE( create_mia )
|
|||
BOOST_CHECK(bitusd.symbol == "BITUSD");
|
||||
BOOST_CHECK(bitusd.bitasset_data(db).options.short_backing_asset == asset_id_type());
|
||||
BOOST_CHECK(bitusd.dynamic_asset_data_id(db).current_supply == 0);
|
||||
BOOST_REQUIRE_THROW( create_bitasset("BITUSD"), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW( create_bitasset("BITUSD"), fc::exception);
|
||||
} catch ( const fc::exception& e ) {
|
||||
elog( "${e}", ("e", e.to_detail_string() ) );
|
||||
throw;
|
||||
|
|
@ -574,7 +574,7 @@ BOOST_AUTO_TEST_CASE( create_uia )
|
|||
BOOST_CHECK(test_asset.options.max_supply == 100000000);
|
||||
BOOST_CHECK(!test_asset.bitasset_data_id.valid());
|
||||
BOOST_CHECK(test_asset.options.market_fee_percent == GRAPHENE_MAX_MARKET_FEE_PERCENT/100);
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
|
||||
const asset_dynamic_data_object& test_asset_dynamic_data = test_asset.dynamic_asset_data_id(db);
|
||||
BOOST_CHECK(test_asset_dynamic_data.current_supply == 0);
|
||||
|
|
@ -649,7 +649,7 @@ BOOST_AUTO_TEST_CASE( update_uia )
|
|||
trx.operations.back() = op;
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
op.issuer = account_id_type();
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
op.new_issuer.reset();
|
||||
} catch(fc::exception& e) {
|
||||
edump((e.to_detail_string()));
|
||||
|
|
@ -1078,7 +1078,7 @@ BOOST_AUTO_TEST_CASE( limit_order_fill_or_kill )
|
|||
|
||||
trx.operations.clear();
|
||||
trx.operations.push_back(op);
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
op.fill_or_kill = false;
|
||||
trx.operations.back() = op;
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
|
|
@ -1088,7 +1088,7 @@ BOOST_AUTO_TEST_CASE( limit_order_fill_or_kill )
|
|||
BOOST_AUTO_TEST_CASE( fill_order )
|
||||
{ try {
|
||||
fill_order_operation o;
|
||||
BOOST_CHECK_THROW(o.validate(), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(o.validate(), fc::exception);
|
||||
o.calculate_fee(db.current_fee_schedule());
|
||||
} FC_LOG_AND_RETHROW() }
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_test )
|
|||
op.amount_to_withdraw = asset(1);
|
||||
trx.operations.push_back(op);
|
||||
//Throws because we haven't entered the first withdrawal period yet.
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
//Get to the actual withdrawal period
|
||||
generate_blocks(permit(db).period_start_time);
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_test )
|
|||
trx.operations.push_back(op);
|
||||
trx.sign(dan_private_key);
|
||||
//Throws because nathan doesn't have the money
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
op.amount_to_withdraw = asset(1);
|
||||
trx.clear();
|
||||
trx.operations = {op};
|
||||
|
|
@ -200,7 +200,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_test )
|
|||
trx.operations.push_back(op);
|
||||
trx.sign(dan_private_key);
|
||||
//Throws because the permission has expired
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
}
|
||||
} FC_LOG_AND_RETHROW() }
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ BOOST_AUTO_TEST_CASE( mia_feeds )
|
|||
|
||||
op.publisher = nathan_id;
|
||||
trx.operations.back() = op;
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
}
|
||||
} FC_LOG_AND_RETHROW() }
|
||||
|
||||
|
|
@ -893,7 +893,7 @@ BOOST_AUTO_TEST_CASE( unimp_force_settlement_unavailable )
|
|||
sop.amount = asset(50, bit_usd);
|
||||
trx.operations = {sop};
|
||||
//Force settlement is disabled; check that it fails
|
||||
BOOST_CHECK_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
{
|
||||
//Enable force settlement
|
||||
asset_update_operation op;
|
||||
|
|
@ -967,7 +967,7 @@ BOOST_AUTO_TEST_CASE( assert_op_test )
|
|||
op.predicates.back() = fc::raw::pack(predicate(pred::account_name_eq_lit{ nathan_id, "dan" }));
|
||||
trx.operations.back() = op;
|
||||
trx.sign(nathan_private_key);
|
||||
BOOST_CHECK_THROW( PUSH_TX( db, trx ), fc::exception );
|
||||
GRAPHENE_CHECK_THROW( PUSH_TX( db, trx ), fc::exception );
|
||||
} FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
||||
|
|
@ -1014,7 +1014,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
trx.operations = {op};
|
||||
trx.sign(n_key);
|
||||
// Fail because I'm claiming from an address which hasn't signed
|
||||
BOOST_CHECK_THROW(db.push_transaction(trx), fc::exception);
|
||||
GRAPHENE_CHECK_THROW(db.push_transaction(trx), fc::exception);
|
||||
trx.clear();
|
||||
op.balance_to_claim = balance_id_type();
|
||||
op.balance_owner_key = n_key.get_public_key();
|
||||
|
|
@ -1048,7 +1048,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
trx.sign(n_key);
|
||||
trx.sign(v1_key);
|
||||
// Attempting to claim 1 from a balance with 0 available
|
||||
BOOST_CHECK_THROW(db.push_transaction(trx), invalid_claim_amount);
|
||||
GRAPHENE_CHECK_THROW(db.push_transaction(trx), invalid_claim_amount);
|
||||
|
||||
op.balance_to_claim = vesting_balance_2.id;
|
||||
op.total_claimed.amount = 151;
|
||||
|
|
@ -1058,7 +1058,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
trx.sign(n_key);
|
||||
trx.sign(v2_key);
|
||||
// Attempting to claim 151 from a balance with 150 available
|
||||
BOOST_CHECK_THROW(db.push_transaction(trx), invalid_claim_amount);
|
||||
GRAPHENE_CHECK_THROW(db.push_transaction(trx), invalid_claim_amount);
|
||||
|
||||
op.balance_to_claim = vesting_balance_2.id;
|
||||
op.total_claimed.amount = 100;
|
||||
|
|
@ -1077,7 +1077,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
trx.sign(n_key);
|
||||
trx.sign(v2_key);
|
||||
// Attempting to claim twice within a day
|
||||
BOOST_CHECK_THROW(db.push_transaction(trx), balance_claimed_too_often);
|
||||
GRAPHENE_CHECK_THROW(db.push_transaction(trx), balance_claimed_too_often);
|
||||
|
||||
db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1).first, delegate_priv_key, database::skip_nothing);
|
||||
slot = db.get_slot_at_time(vesting_balance_1.vesting_policy->begin_timestamp + 60);
|
||||
|
|
@ -1103,7 +1103,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
|
|||
trx.sign(n_key);
|
||||
trx.sign(v2_key);
|
||||
// Attempting to claim twice within a day
|
||||
BOOST_CHECK_THROW(db.push_transaction(trx), balance_claimed_too_often);
|
||||
GRAPHENE_CHECK_THROW(db.push_transaction(trx), balance_claimed_too_often);
|
||||
|
||||
db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1).first, delegate_priv_key, database::skip_nothing);
|
||||
slot = db.get_slot_at_time(db.head_block_time() + fc::days(1));
|
||||
|
|
|
|||
|
|
@ -84,10 +84,10 @@ BOOST_AUTO_TEST_CASE( override_transfer_test )
|
|||
trx.operations.push_back(otrans);
|
||||
|
||||
BOOST_TEST_MESSAGE( "Require throwing without signature" );
|
||||
BOOST_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception);
|
||||
BOOST_TEST_MESSAGE( "Require throwing with dan's signature" );
|
||||
trx.sign( dan_private_key );
|
||||
BOOST_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception);
|
||||
BOOST_TEST_MESSAGE( "Pass with issuer's signature" );
|
||||
trx.signatures.clear();
|
||||
trx.sign( sam_private_key );
|
||||
|
|
@ -112,14 +112,14 @@ BOOST_AUTO_TEST_CASE( override_transfer_test2 )
|
|||
trx.operations.push_back(otrans);
|
||||
|
||||
BOOST_TEST_MESSAGE( "Require throwing without signature" );
|
||||
BOOST_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception);
|
||||
BOOST_TEST_MESSAGE( "Require throwing with dan's signature" );
|
||||
trx.sign( dan_private_key );
|
||||
BOOST_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception);
|
||||
BOOST_TEST_MESSAGE( "Fail because overide_authority flag is not set" );
|
||||
trx.signatures.clear();
|
||||
trx.sign( sam_private_key );
|
||||
BOOST_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx, 0 ), fc::exception );
|
||||
|
||||
BOOST_REQUIRE_EQUAL( get_balance( dan, advanced ), 1000 );
|
||||
BOOST_REQUIRE_EQUAL( get_balance( eric, advanced ), 0 );
|
||||
|
|
@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE( issue_whitelist_uia )
|
|||
asset_issue_operation op({asset(), advanced.issuer, advanced.amount(1000), nathan.id});
|
||||
trx.operations.emplace_back(op);
|
||||
//Fail because nathan is not whitelisted.
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
|
||||
account_whitelist_operation wop({asset(), account_id_type(), nathan.id, account_whitelist_operation::white_listed});
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE( transfer_whitelist_uia )
|
|||
transfer_operation op({advanced.amount(0), nathan.id, dan.id, advanced.amount(100)});
|
||||
trx.operations.push_back(op);
|
||||
//Fail because dan is not whitelisted.
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
|
||||
account_whitelist_operation wop({asset(), account_id_type(), dan.id, account_whitelist_operation::white_listed});
|
||||
trx.operations.back() = wop;
|
||||
|
|
@ -187,14 +187,14 @@ BOOST_AUTO_TEST_CASE( transfer_whitelist_uia )
|
|||
op.amount = advanced.amount(50);
|
||||
trx.operations.back() = op;
|
||||
//Fail because nathan is blacklisted
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
trx.operations = {asset_reserve_operation{asset(), nathan.id, advanced.amount(10)}};
|
||||
//Fail because nathan is blacklisted
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
std::swap(op.from, op.to);
|
||||
trx.operations.back() = op;
|
||||
//Fail because nathan is blacklisted
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
|
||||
{
|
||||
asset_update_operation op;
|
||||
|
|
@ -221,7 +221,7 @@ BOOST_AUTO_TEST_CASE( transfer_whitelist_uia )
|
|||
trx.operations.back() = op;
|
||||
//Fail because nathan is blacklisted
|
||||
BOOST_CHECK(!nathan.is_authorized_asset(advanced));
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
|
||||
//Remove nathan from genesis' whitelist, add him to dan's. This should not authorize him to hold ADVANCED.
|
||||
wop.authorizing_account = account_id_type();
|
||||
|
|
@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE( transfer_whitelist_uia )
|
|||
trx.operations.back() = op;
|
||||
//Fail because nathan is not whitelisted
|
||||
BOOST_CHECK(!nathan.is_authorized_asset(advanced));
|
||||
BOOST_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
|
||||
|
||||
trx.operations = {asset_reserve_operation{asset(), dan.id, advanced.amount(10)}};
|
||||
PUSH_TX(db, trx, ~0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue