Skip to content

Commit

Permalink
BSIP74: Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelSantos committed May 25, 2020
1 parent d1b5624 commit 11aa1be
Show file tree
Hide file tree
Showing 3 changed files with 2,284 additions and 5 deletions.
10 changes: 7 additions & 3 deletions tests/common/database_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,8 @@ asset_create_operation database_fixture::make_bitasset(
uint16_t precision /* = GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS */,
asset_id_type backing_asset /* = CORE */,
share_type max_supply, /* = GRAPHENE_MAX_SHARE_SUPPLY */
optional<uint16_t> initial_cr /* = {} */
optional<uint16_t> initial_cr, /* = {} */
optional<uint16_t> margin_call_fee_ratio /* = {} */
)
{
asset_create_operation creator;
Expand All @@ -724,6 +725,7 @@ asset_create_operation database_fixture::make_bitasset(
creator.bitasset_opts = bitasset_options();
creator.bitasset_opts->short_backing_asset = backing_asset;
creator.bitasset_opts->extensions.value.initial_collateral_ratio = initial_cr;
creator.bitasset_opts->extensions.value.margin_call_fee_ratio = margin_call_fee_ratio;
return creator;
}

Expand All @@ -735,11 +737,13 @@ const asset_object& database_fixture::create_bitasset(
uint16_t precision /* = GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS */,
asset_id_type backing_asset /* = CORE */,
share_type max_supply, /* = GRAPHENE_MAX_SHARE_SUPPLY */
optional<uint16_t> initial_cr /* = {} */
optional<uint16_t> initial_cr, /* = {} */
optional<uint16_t> margin_call_fee_ratio /* = {} */
)
{ try {
asset_create_operation creator = make_bitasset( name, issuer, market_fee_percent, flags,
precision, backing_asset, max_supply, initial_cr );
precision, backing_asset, max_supply, initial_cr,
margin_call_fee_ratio );
trx.operations.clear();
trx.operations.push_back(std::move(creator));
trx.validate();
Expand Down
6 changes: 4 additions & 2 deletions tests/common/database_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,17 @@ struct database_fixture {
uint16_t precision = 2,
asset_id_type backing_asset = {},
share_type max_supply = GRAPHENE_MAX_SHARE_SUPPLY,
optional<uint16_t> initial_cr = {} );
optional<uint16_t> initial_cr = {},
optional<uint16_t> margin_call_fee_ratio = {} );
const asset_object& create_bitasset(const string& name,
account_id_type issuer = GRAPHENE_WITNESS_ACCOUNT,
uint16_t market_fee_percent = 100 /*1%*/,
uint16_t flags = charge_market_fee,
uint16_t precision = 2,
asset_id_type backing_asset = {},
share_type max_supply = GRAPHENE_MAX_SHARE_SUPPLY,
optional<uint16_t> initial_cr = {} );
optional<uint16_t> initial_cr = {},
optional<uint16_t> margin_call_fee_ratio = {} );
const asset_object& create_prediction_market(const string& name,
account_id_type issuer = GRAPHENE_WITNESS_ACCOUNT,
uint16_t market_fee_percent = 100 /*1%*/,
Expand Down
Loading

0 comments on commit 11aa1be

Please sign in to comment.