Wrap TEST_ASSERT with do...while(0)

Fix compile errors when doing
if (blah) TEST_ASSERT(cond, message)
This commit is contained in:
Jake Turner
2021-02-20 05:10:19 +00:00
committed by Baldur Karlsson
parent a7ac9d7923
commit f14130fc2d
+9 -6
View File
@@ -316,12 +316,15 @@ std::string trim(const std::string &str);
void DebugPrint(const char *fmt, ...);
#define TEST_ASSERT(cond, fmt, ...) \
if(!(cond)) \
{ \
DebugPrint("%s:%d Assert Failure '%s': " fmt "\n", __FILE__, __LINE__, #cond, ##__VA_ARGS__); \
DEBUG_BREAK(); \
}
#define TEST_ASSERT(cond, fmt, ...) \
do \
{ \
if(!(cond)) \
{ \
DebugPrint("%s:%d Assert Failure '%s': " fmt "\n", __FILE__, __LINE__, #cond, ##__VA_ARGS__); \
DEBUG_BREAK(); \
} \
} while(0)
#define TEST_LOG(fmt, ...) \
do \