From 731338f03c6d137164972264bfa279f201c1ce55 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Sun, 6 Aug 2017 18:59:31 +0200 Subject: [PATCH] Added test case for broken merge on empty undo_db --- tests/tests/database_tests.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/tests/database_tests.cpp b/tests/tests/database_tests.cpp index 5dc35f27..0e2f1295 100644 --- a/tests/tests/database_tests.cpp +++ b/tests/tests/database_tests.cpp @@ -59,3 +59,22 @@ BOOST_AUTO_TEST_CASE( undo_test ) throw; } } + +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& 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; + } +}