From 26c2eb4c7ac6f8dea7bce5a90c9be6148a0c5f16 Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Wed, 9 Aug 2017 13:53:37 -0400 Subject: [PATCH] Make the bet_place helper in the test fixture return the bet id --- tests/common/database_fixture.cpp | 4 +++- tests/common/database_fixture.hpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index 38558079..403feaed 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -1395,7 +1395,7 @@ void database_fixture::update_betting_market(betting_market_id_type betting_mark } FC_CAPTURE_AND_RETHROW( (betting_market_id) (group_id) (payout_condition) ) } - void database_fixture::place_bet(account_id_type bettor_id, betting_market_id_type betting_market_id, bet_type back_or_lay, asset amount_to_bet, bet_multiplier_type backer_multiplier) + bet_id_type database_fixture::place_bet(account_id_type bettor_id, betting_market_id_type betting_market_id, bet_type back_or_lay, asset amount_to_bet, bet_multiplier_type backer_multiplier) { try { bet_place_operation bet_place_op; bet_place_op.bettor_id = bettor_id; @@ -1408,6 +1408,8 @@ void database_fixture::update_betting_market(betting_market_id_type betting_mark trx.validate(); processed_transaction ptx = db.push_transaction(trx, ~0); trx.operations.clear(); + BOOST_CHECK_MESSAGE(ptx.operation_results.size() == 1, "Place Bet Transaction should have had exactly one operation result"); + return ptx.operation_results.front().get().as(); } FC_CAPTURE_AND_RETHROW( (bettor_id)(back_or_lay)(amount_to_bet) ) } void database_fixture::resolve_betting_market_group(betting_market_group_id_type betting_market_group_id, diff --git a/tests/common/database_fixture.hpp b/tests/common/database_fixture.hpp index 3b24c934..2bd40e9c 100644 --- a/tests/common/database_fixture.hpp +++ b/tests/common/database_fixture.hpp @@ -319,7 +319,7 @@ struct database_fixture { /*fc::optional description,*/ fc::optional payout_condition); - void place_bet(account_id_type bettor_id, betting_market_id_type betting_market_id, bet_type back_or_lay, asset amount_to_bet, bet_multiplier_type backer_multiplier); + bet_id_type place_bet(account_id_type bettor_id, betting_market_id_type betting_market_id, bet_type back_or_lay, asset amount_to_bet, bet_multiplier_type backer_multiplier); void resolve_betting_market_group(betting_market_group_id_type betting_market_group_id, std::map resolutions); void cancel_unmatched_bets(betting_market_group_id_type betting_market_group_id);