2016-01-18 19:53:26 +01:00
|
|
|
#ifndef TEST_CATCH_EXT_HPP
|
|
|
|
#define TEST_CATCH_EXT_HPP
|
|
|
|
|
|
|
|
#include "catch.hpp"
|
|
|
|
|
2022-08-11 22:54:50 +02:00
|
|
|
#define TRY_CHECK(expr) \
|
|
|
|
try \
|
|
|
|
{ \
|
|
|
|
CHECK(expr); \
|
2022-11-10 16:57:38 +01:00
|
|
|
} \
|
|
|
|
catch (Catch::TestFailureException&) \
|
2022-08-11 22:54:50 +02:00
|
|
|
{ \
|
|
|
|
/* thrown by CHECK after it catches and reports */ \
|
|
|
|
/* an exception from expr => swallow this */ \
|
2016-01-18 19:53:26 +01:00
|
|
|
}
|
|
|
|
|
2022-08-11 22:54:50 +02:00
|
|
|
#define TRY_CHECK_FALSE(expr) \
|
|
|
|
try \
|
|
|
|
{ \
|
|
|
|
CHECK_FALSE(expr); \
|
2022-11-10 16:57:38 +01:00
|
|
|
} \
|
|
|
|
catch (Catch::TestFailureException&) \
|
2022-08-11 22:54:50 +02:00
|
|
|
{}
|
2016-01-18 19:53:26 +01:00
|
|
|
|
|
|
|
#endif // TEST_CATCH_EXT_HPP
|