diff options
author | subtly <subtly@users.noreply.github.com> | 2015-03-08 01:35:59 +0800 |
---|---|---|
committer | subtly <subtly@users.noreply.github.com> | 2015-03-08 01:35:59 +0800 |
commit | c46b429993f631c2579fed0aed8b4e18d5fd4948 (patch) | |
tree | ce95149aa030eda1a0be86c79395b93abae8fab5 /TestHelper.h | |
parent | 1e91b7d1deabd69bcc969e98a128edf71f35c780 (diff) | |
parent | 986fdb9d5fef87769caa140d9b4903178cf1874a (diff) | |
download | dexon-solidity-c46b429993f631c2579fed0aed8b4e18d5fd4948.tar dexon-solidity-c46b429993f631c2579fed0aed8b4e18d5fd4948.tar.gz dexon-solidity-c46b429993f631c2579fed0aed8b4e18d5fd4948.tar.bz2 dexon-solidity-c46b429993f631c2579fed0aed8b4e18d5fd4948.tar.lz dexon-solidity-c46b429993f631c2579fed0aed8b4e18d5fd4948.tar.xz dexon-solidity-c46b429993f631c2579fed0aed8b4e18d5fd4948.tar.zst dexon-solidity-c46b429993f631c2579fed0aed8b4e18d5fd4948.zip |
Merge branch 'develop' into p2p
Diffstat (limited to 'TestHelper.h')
-rw-r--r-- | TestHelper.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/TestHelper.h b/TestHelper.h index 6f9143c5..91ec977d 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -44,12 +44,48 @@ void connectClients(Client& c1, Client& c2); namespace test { +/// Make sure that no Exception is thrown during testing. If one is thrown show its info and fail the test. +/// Our version of BOOST_REQUIRE_NO_THROW() +/// @param _expression The expression for which to make sure no exceptions are thrown +/// @param _message A message to act as a prefix to the expression's error information +#define ETH_TEST_REQUIRE_NO_THROW(_expression, _message) \ + do \ + { \ + try \ + { \ + _expression; \ + } \ + catch (boost::exception const& _e) \ + { \ + auto msg = std::string(_message"\n") + boost::diagnostic_information(_e); \ + BOOST_FAIL(msg); \ + } \ + } while (0) + +/// Check if an Exception is thrown during testing. If one is thrown show its info and continue the test +/// Our version of BOOST_CHECK_NO_THROW() +/// @param _expression The expression for which to make sure no exceptions are thrown +/// @param _message A message to act as a prefix to the expression's error information +#define ETH_TEST_CHECK_NO_THROW(_expression, _message) \ + do \ + { \ + try \ + { \ + _expression; \ + } \ + catch (boost::exception const& _e) \ + { \ + auto msg = std::string(_message"\n") + boost::diagnostic_information(_e); \ + BOOST_MESSAGE(msg); \ + } \ + } while (0) + + class ImportTest { public: - ImportTest(json_spirit::mObject& _o) : m_TestObject(_o) {} + ImportTest(json_spirit::mObject& _o) : m_statePre(Address(), OverlayDB(), eth::BaseState::Empty), m_statePost(Address(), OverlayDB(), eth::BaseState::Empty), m_TestObject(_o) {} ImportTest(json_spirit::mObject& _o, bool isFiller); - // imports void importEnv(json_spirit::mObject& _o); void importState(json_spirit::mObject& _o, eth::State& _state); |