aboutsummaryrefslogtreecommitdiffstats
path: root/TestHelper.h
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-03-06 19:06:12 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-03-06 21:37:20 +0800
commit79bbe1e5d81947436b00febd7aa75246c47eabd6 (patch)
treec0661c43376d7a2087e62163f516adab9592cc27 /TestHelper.h
parent10c666fb52271f1100888676e70ad43aa65c8cdf (diff)
downloaddexon-solidity-79bbe1e5d81947436b00febd7aa75246c47eabd6.tar
dexon-solidity-79bbe1e5d81947436b00febd7aa75246c47eabd6.tar.gz
dexon-solidity-79bbe1e5d81947436b00febd7aa75246c47eabd6.tar.bz2
dexon-solidity-79bbe1e5d81947436b00febd7aa75246c47eabd6.tar.lz
dexon-solidity-79bbe1e5d81947436b00febd7aa75246c47eabd6.tar.xz
dexon-solidity-79bbe1e5d81947436b00febd7aa75246c47eabd6.tar.zst
dexon-solidity-79bbe1e5d81947436b00febd7aa75246c47eabd6.zip
Move ETH_TEST() Macros to TestHelper.h
- Also use them in Solidity Parser
Diffstat (limited to 'TestHelper.h')
-rw-r--r--TestHelper.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/TestHelper.h b/TestHelper.h
index 849f822b..37c90add 100644
--- a/TestHelper.h
+++ b/TestHelper.h
@@ -44,6 +44,41 @@ 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) + 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) + boost::diagnostic_information(_e); \
+ BOOST_MESSAGE(msg); \
+ } \
+ }while (0)
+
+
class ImportTest
{
public: