diff options
Diffstat (limited to 'libdevcore/Assertions.h')
-rw-r--r-- | libdevcore/Assertions.h | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/libdevcore/Assertions.h b/libdevcore/Assertions.h index e54b9d55..0151cfc1 100644 --- a/libdevcore/Assertions.h +++ b/libdevcore/Assertions.h @@ -25,7 +25,6 @@ #pragma once #include "Exceptions.h" -#include "debugbreak.h" namespace dev { @@ -38,37 +37,6 @@ namespace dev #define ETH_FUNC __func__ #endif -#define asserts(A) ::dev::assertAux(A, #A, __LINE__, __FILE__, ETH_FUNC) -#define assertsEqual(A, B) ::dev::assertEqualAux(A, B, #A, #B, __LINE__, __FILE__, ETH_FUNC) - -inline bool assertAux(bool _a, char const* _aStr, unsigned _line, char const* _file, char const* _func) -{ - bool ret = _a; - if (!ret) - { - std::cerr << "Assertion failed:" << _aStr << " [func=" << _func << ", line=" << _line << ", file=" << _file << "]" << std::endl; -#if ETH_DEBUG - debug_break(); -#endif - } - return !ret; -} - -template<class A, class B> -inline bool assertEqualAux(A const& _a, B const& _b, char const* _aStr, char const* _bStr, unsigned _line, char const* _file, char const* _func) -{ - bool ret = _a == _b; - if (!ret) - { - std::cerr << "Assertion failed: " << _aStr << " == " << _bStr << " [func=" << _func << ", line=" << _line << ", file=" << _file << "]" << std::endl; - std::cerr << " Fail equality: " << _a << "==" << _b << std::endl; -#if ETH_DEBUG - debug_break(); -#endif - } - return !ret; -} - /// Assertion that throws an exception containing the given description if it is not met. /// Use it as assertThrow(1 == 1, ExceptionType, "Mathematics is wrong."); /// Do NOT supply an exception object as the second parameter. |