catch exceptions from TEST_CHECK

This commit is contained in:
Arvid Norberg 2009-01-19 09:30:38 +00:00
parent 52f7bbc185
commit 6b379c7137
1 changed files with 13 additions and 2 deletions

View File

@ -52,8 +52,19 @@ void report_failure(char const* str, char const* file, int line);
report_failure(x, line, file)
#define TEST_CHECK(x) \
if (!(x)) \
TEST_REPORT_AUX("TEST_CHECK failed: \"" #x "\"", __FILE__, __LINE__)
try \
{ \
if (!(x)) \
TEST_REPORT_AUX("TEST_CHECK failed: \"" #x "\"", __FILE__, __LINE__); \
} \
catch (std::exception& e) \
{ \
TEST_ERROR("Exception thrown: " #x " :" + std::string(e.what())); \
} \
catch (...) \
{ \
TEST_ERROR("Exception thrown: " #x); \
}
#define TEST_ERROR(x) \
TEST_REPORT_AUX((std::string("ERROR: \"") + x + "\"").c_str(), __FILE__, __LINE__)