Added test case for broken merge on empty undo_db

This commit is contained in:
Peter Conrad 2017-08-06 18:59:31 +02:00 committed by gladcow
parent e905534ea6
commit 903f82b3c9

View file

@ -91,4 +91,23 @@ BOOST_AUTO_TEST_CASE( flat_index_test )
FC_ASSERT( !(*bitusd.bitasset_data_id)(db).current_feed.settlement_price.is_null() );
}
BOOST_AUTO_TEST_CASE( merge_test )
{
try {
database db;
auto ses = db._undo_db.start_undo_session();
const auto& bal_obj1 = db.create<account_balance_object>( [&]( account_balance_object& obj ){
obj.balance = 42;
});
ses.merge();
auto balance = db.get_balance( account_id_type(), asset_id_type() );
BOOST_CHECK_EQUAL( 42, balance.amount.value );
} catch ( const fc::exception& e )
{
edump( (e.to_detail_string()) );
throw;
}
}
BOOST_AUTO_TEST_SUITE_END()