database_fixture: Enable verbose output only if --record-assert-trip is passed on command line

This commit is contained in:
theoreticalbts 2015-07-08 12:14:54 -04:00
parent 4229e33525
commit 680dadf5b0
2 changed files with 22 additions and 8 deletions

View file

@ -48,6 +48,16 @@ database_fixture::database_fixture()
: app(), db( *app.chain_database() )
{
try {
int argc = boost::unit_test::framework::master_test_suite().argc;
char** argv = boost::unit_test::framework::master_test_suite().argv;
for( int i=1; i<argc; i++ )
{
const std::string arg = argv[i];
if( arg == "--record-assert-trip" )
fc::enable_record_assert_trip = true;
if( arg == "--show-test-names" )
std::cout << "running test " << boost::unit_test::framework::current_test_case().p_name << std::endl;
}
auto ahplugin = app.register_plugin<graphene::account_history::account_history_plugin>();
auto mhplugin = app.register_plugin<graphene::market_history::market_history_plugin>();
delegate_pub_key = delegate_priv_key.get_public_key();

View file

@ -59,11 +59,13 @@ using namespace graphene::db;
("expr", #expr) \
("exc_type", #exc_type) \
); \
std::cout << "GRAPHENE_REQUIRE_THROW begin " \
<< req_throw_info << std::endl; \
if( fc::enable_record_assert_trip ) \
std::cout << "GRAPHENE_REQUIRE_THROW begin " \
<< req_throw_info << std::endl; \
BOOST_REQUIRE_THROW( expr, exc_type ); \
std::cout << "GRAPHENE_REQUIRE_THROW end " \
<< req_throw_info << std::endl; \
if( fc::enable_record_assert_trip ) \
std::cout << "GRAPHENE_REQUIRE_THROW end " \
<< req_throw_info << std::endl; \
}
#define GRAPHENE_CHECK_THROW( expr, exc_type ) \
@ -75,11 +77,13 @@ using namespace graphene::db;
("expr", #expr) \
("exc_type", #exc_type) \
); \
std::cout << "GRAPHENE_CHECK_THROW begin " \
<< req_throw_info << std::endl; \
if( fc::enable_record_assert_trip ) \
std::cout << "GRAPHENE_CHECK_THROW begin " \
<< req_throw_info << std::endl; \
BOOST_CHECK_THROW( expr, exc_type ); \
std::cout << "GRAPHENE_CHECK_THROW end " \
<< req_throw_info << std::endl; \
if( fc::enable_record_assert_trip ) \
std::cout << "GRAPHENE_CHECK_THROW end " \
<< req_throw_info << std::endl; \
}
#define REQUIRE_OP_VALIDATION_FAILURE_2( op, field, value, exc_type ) \