1 #ifndef __DIADES__UTILS__ASSERTION__HH 2 #define __DIADES__UTILS__ASSERTION__HH 8 #include <boost/format.hpp> 13 using std::runtime_error;
14 using std::domain_error;
29 if (!assertion)
throw X(s +
": requirement failed");
39 if (!assertion)
throw X(fmt.str() +
": requirement failed");
49 if (!assertion)
throw X(s +
": ensurement failed");
61 if (!assertion)
throw X(fmt.str() +
": requirement failed");
72 if (!assertion)
throw X(s +
": assertion failed");
82 if (!assertion)
throw X(fmt.str() +
": requirement failed");
87 #define require(Exception,expr,message) \ 88 Require<Exception>(expr,message) 90 #define require(Exception,expr,message) \ 95 #define ensure(Exception,expr,message) \ 96 Ensure<Exception>(expr,message) 98 #define ensure(Exception,expr,message) \ 103 #define assertion(Exception, expr, message) \ 104 Assertion<Exception>(expr,message) 106 #define assertion(Exception, expr, message) \ 122 #define always_require(Exception, expr, message) Require<Exception>(expr,message) 123 #define always_ensure(Exception, expr, message) Ensure<Exception>(expr,message) 124 #define always_assertion(Exception, expr, message) Assertion<Exception>(expr,message) void Ensure(A assertion, const string &s)
void Require(A assertion, const string &s)
void Assertion(A assertion, const string &s)
#define assertion(Exception, expr, message)