#ifndef _TESTCPP_H_
#define _TESTCPP_H_ 1
#include "testmore.h"
#ifdef __cplusplus
#define no_throw(THIS, TESTNAME) \
({ \
bool _this; \
try { THIS; _this = true; } catch (...) { _this = false; } \
test_ok(_this, TESTNAME, test_directive, test_reason, \
__FILE__, __LINE__, \
"# got: <unknown excepetion>\n" \
"# expected: <no throw>\n"); \
})
#define does_throw(THIS, TESTNAME) \
({ \
bool _this; \
try { THIS; _this = false; } catch (...) { _this = true; } \
test_ok(_this, TESTNAME, test_directive, test_reason, \
__FILE__, __LINE__, \
"# got: <no throw>\n" \
"# expected: <any excepetion>\n"); \
})
#define is_throw(THIS, CLASS, METHOD, VALUE, TESTNAME) \
({ \
bool _this; \
try \
{ \
THIS; \
_this = test_ok(false, TESTNAME, test_directive, test_reason, \
__FILE__, __LINE__, \
"# got: <no throw>\n" \
"# expected: %s.%s == %s\n", \
#CLASS, #METHOD, #VALUE); \
} \
catch (const CLASS &_exception) \
{ \
_this = test_ok(_exception.METHOD == (VALUE), TESTNAME, \
test_directive, test_reason, __FILE__, __LINE__, \
"# got: %d\n" \
"# expected: %s.%s == %s\n", \
_exception.METHOD, #CLASS, #METHOD, #VALUE); \
} \
catch (...) \
{ \
_this = test_ok(false, TESTNAME, test_directive, test_reason, \
__FILE__, __LINE__, \
"# got: <unknown excepetion>\n" \
"# expected: %s.%s == %s\n", \
#CLASS, #METHOD, #VALUE); \
} \
_this; \
})
#endif
#endif