diff --git a/tests/tests/operation_tests.cpp b/tests/tests/operation_tests.cpp index 3492cb33..3cf8b037 100644 --- a/tests/tests/operation_tests.cpp +++ b/tests/tests/operation_tests.cpp @@ -206,171 +206,6 @@ BOOST_AUTO_TEST_CASE( margin_call_limit_test ) } } -BOOST_AUTO_TEST_CASE( margin_call_limit_test_protected ) -{ try { - FC_ASSERT( !"TODO - Reimplement with new short semantics" ); - /* - const asset_object& bitusd = create_bitasset( "BITUSD" ); - const asset_object& core = get_asset( GRAPHENE_SYMBOL ); - - db.modify( bitusd.bitasset_data(db), [&]( asset_bitasset_data_object& usd ){ - usd.current_feed.call_limit = core.amount(1) / bitusd.amount(1); - }); - - const account_object& shorter1 = create_account( "shorter1" ); - const account_object& shorter2 = create_account( "shorter2" ); - const account_object& buyer1 = create_account( "buyer1" ); - const account_object& buyer2 = create_account( "buyer2" ); - - transfer( genesis_account(db), shorter1, asset( 10000 ) ); - transfer( genesis_account(db), shorter2, asset( 10000 ) ); - transfer( genesis_account(db), buyer1, asset( 10000 ) ); - transfer( genesis_account(db), buyer2, asset( 10000 ) ); - - BOOST_REQUIRE( create_sell_order( buyer1, asset(1000), bitusd.amount(1000) ) ); - BOOST_REQUIRE( !create_short( shorter1, bitusd.amount(1000), asset(1000) ) ); - BOOST_REQUIRE_EQUAL( get_balance(buyer1, bitusd), 990 ); // 1000 - 1% fee - - ilog( "=================================== START===================================\n\n"); - // this should cause the highest bid to below the margin call threshold - // which means it should be filled by the cover - auto unmatched = create_sell_order( buyer1, bitusd.amount(990), core.amount(1500) ); - if( unmatched ) edump((*unmatched)); - BOOST_REQUIRE( unmatched ); - */ - - } catch( const fc::exception& e) { - edump((e.to_detail_string())); - throw; - } -} - -BOOST_AUTO_TEST_CASE( dont_margin_call_limit_test ) -{ try { - FC_ASSERT( !"TODO - Reimplement with new short semantics" ); - /* - const asset_object& bitusd = create_bitasset( "BITUSD" ); - const asset_object& core = get_asset( GRAPHENE_SYMBOL ); - - db.modify( bitusd.bitasset_data(db), [&]( asset_bitasset_data_object& usd ){ - usd.current_feed.call_limit = core.amount(3) / bitusd.amount(1); - }); - - const account_object& shorter1 = create_account( "shorter1" ); - const account_object& shorter2 = create_account( "shorter2" ); - const account_object& buyer1 = create_account( "buyer1" ); - const account_object& buyer2 = create_account( "buyer2" ); - - transfer( genesis_account(db), shorter1, asset( 10000 ) ); - transfer( genesis_account(db), shorter2, asset( 10000 ) ); - transfer( genesis_account(db), buyer1, asset( 10000 ) ); - transfer( genesis_account(db), buyer2, asset( 10000 ) ); - - BOOST_REQUIRE( create_sell_order( buyer1, asset(1000), bitusd.amount(1000) ) ); - BOOST_REQUIRE( !create_short( shorter1, bitusd.amount(1000), asset(1000) ) ); - BOOST_REQUIRE_EQUAL( get_balance(buyer1, bitusd), 990 ); // 1000 - 1% fee - - // this should cause the highest bid to below the margin call threshold - // which means it should be filled by the cover - auto unmatched = create_sell_order( buyer1, bitusd.amount(990), core.amount(1100) ); - if( unmatched ) edump((*unmatched)); - BOOST_REQUIRE( unmatched ); - */ - - } catch( const fc::exception& e) { - edump((e.to_detail_string())); - throw; - } -} - -BOOST_AUTO_TEST_CASE( margin_call_short_test ) -{ try { - FC_ASSERT( !"TODO - Reimplement with new short semantics" ); - /* - const asset_object& bitusd = create_bitasset( "BITUSD" ); - const asset_object& core = get_asset( GRAPHENE_SYMBOL ); - - db.modify( bitusd.bitasset_data(db), [&]( asset_bitasset_data_object& usd ){ - usd.current_feed.call_limit = core.amount(3) / bitusd.amount(1); - }); - - const account_object& shorter1 = create_account( "shorter1" ); - const account_object& shorter2 = create_account( "shorter2" ); - const account_object& buyer1 = create_account( "buyer1" ); - const account_object& buyer2 = create_account( "buyer2" ); - - transfer( genesis_account(db), shorter1, asset( 10000 ) ); - transfer( genesis_account(db), shorter2, asset( 10000 ) ); - transfer( genesis_account(db), buyer1, asset( 10000 ) ); - transfer( genesis_account(db), buyer2, asset( 10000 ) ); - - BOOST_REQUIRE( create_sell_order( buyer1, asset(1000), bitusd.amount(1000) ) ); - BOOST_REQUIRE( !create_short( shorter1, bitusd.amount(1000), asset(1000) ) ); - BOOST_REQUIRE_EQUAL( get_balance(buyer1, bitusd), 990 ); // 1000 - 1% fee - ilog( "=================================== START===================================\n\n"); - - // this should cause the highest bid to below the margin call threshold - // which means it should be filled by the cover - auto unmatched = create_short( buyer1, bitusd.amount(990), core.amount(1500) ); - if( unmatched ) edump((*unmatched)); - BOOST_REQUIRE( !unmatched ); - */ - - } catch( const fc::exception& e) { - edump((e.to_detail_string())); - throw; - } -} - -BOOST_AUTO_TEST_CASE( margin_call_short_test_limit_protected ) -{ try { - FC_ASSERT( !"TODO - Reimplement with new short semantics" ); - /* - const asset_object& bitusd = create_bitasset( "BITUSD" ); - const asset_object& core = get_asset( GRAPHENE_SYMBOL ); - - db.modify( bitusd.bitasset_data(db), [&]( asset_bitasset_data_object& usd ){ - usd.current_feed.call_limit = core.amount(3) / bitusd.amount(4); - }); - - const account_object& shorter1 = create_account( "shorter1" ); - const account_object& shorter2 = create_account( "shorter2" ); - const account_object& buyer1 = create_account( "buyer1" ); - const account_object& buyer2 = create_account( "buyer2" ); - - transfer( genesis_account(db), shorter1, asset( 10000 ) ); - transfer( genesis_account(db), shorter2, asset( 10000 ) ); - transfer( genesis_account(db), buyer1, asset( 10000 ) ); - transfer( genesis_account(db), buyer2, asset( 10000 ) ); - - BOOST_REQUIRE( create_sell_order( buyer1, asset(1000), bitusd.amount(1000) ) ); - BOOST_REQUIRE( !create_short( shorter1, bitusd.amount(1000), asset(1000) ) ); - BOOST_REQUIRE_EQUAL( get_balance(buyer1, bitusd), 990 ); // 1000 - 1% fee - ilog( "=================================== START===================================\n\n"); - - // this should cause the highest bid to below the margin call threshold - // which means it should be filled by the cover - auto unmatched = create_short( buyer1, bitusd.amount(990), core.amount(1500) ); - if( unmatched ) edump((*unmatched)); - BOOST_REQUIRE( unmatched ); - */ - - } catch( const fc::exception& e) { - edump((e.to_detail_string())); - throw; - } -} - - - - - - - - - - - BOOST_AUTO_TEST_CASE( create_account_test ) {