diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-09 22:05:22 +0800 |
---|---|---|
committer | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-09 22:05:22 +0800 |
commit | 5cc0812d357e70614b9a0d78812ae7e6ecaa5ef0 (patch) | |
tree | 5d59b64355b33260d7c702d4219253f2d2d089f9 /TestHelper.h | |
parent | 5fb44b241debf9230aea69b7708e204a88ba9d83 (diff) | |
parent | d586a88f3cab21db88f31dd574daac4bb9a28b7d (diff) | |
download | dexon-solidity-5cc0812d357e70614b9a0d78812ae7e6ecaa5ef0.tar dexon-solidity-5cc0812d357e70614b9a0d78812ae7e6ecaa5ef0.tar.gz dexon-solidity-5cc0812d357e70614b9a0d78812ae7e6ecaa5ef0.tar.bz2 dexon-solidity-5cc0812d357e70614b9a0d78812ae7e6ecaa5ef0.tar.lz dexon-solidity-5cc0812d357e70614b9a0d78812ae7e6ecaa5ef0.tar.xz dexon-solidity-5cc0812d357e70614b9a0d78812ae7e6ecaa5ef0.tar.zst dexon-solidity-5cc0812d357e70614b9a0d78812ae7e6ecaa5ef0.zip |
Merge remote-tracking branch 'upstream/develop' into evmjit
Diffstat (limited to 'TestHelper.h')
-rw-r--r-- | TestHelper.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/TestHelper.h b/TestHelper.h index 849f822b..0f23f945 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -44,6 +44,59 @@ 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 _statenent The statement 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(_statement, _message) \ + do \ + { \ + try \ + { \ + BOOST_TEST_PASSPOINT(); \ + _statement; \ + } \ + catch (boost::exception const& _e) \ + { \ + auto msg = std::string(_message " due to an exception thrown by " \ + BOOST_STRINGIZE(_statement) "\n") + boost::diagnostic_information(_e); \ + BOOST_CHECK_IMPL(false, msg, REQUIRE, CHECK_MSG); \ + } \ + catch (...) \ + { \ + BOOST_CHECK_IMPL(false, "Unknown exception thrown by " \ + BOOST_STRINGIZE(_statement), REQUIRE, CHECK_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 _statement The statement 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(_statement, _message) \ + do \ + { \ + try \ + { \ + BOOST_TEST_PASSPOINT(); \ + _statement; \ + } \ + catch (boost::exception const& _e) \ + { \ + auto msg = std::string(_message " due to an exception thrown by " \ + BOOST_STRINGIZE(_statement) "\n") + boost::diagnostic_information(_e); \ + BOOST_CHECK_IMPL(false, msg, CHECK, CHECK_MSG); \ + } \ + catch (...) \ + { \ + BOOST_CHECK_IMPL(false, "Unknown exception thrown by " \ + BOOST_STRINGIZE(_statement), CHECK, CHECK_MSG ); \ + } \ + } \ + while (0) + + class ImportTest { public: |