diff --git a/include/sta/assert.hpp b/include/sta/assert.hpp index 11c92e4..9974f11 100644 --- a/include/sta/assert.hpp +++ b/include/sta/assert.hpp @@ -72,6 +72,21 @@ namespace sta * @param msg Message shown on failure */ # define STA_ASSERT_MSG(expr, msg) ((void)(!(expr) && (sta::assert_failed(msg, __FILE__, __LINE__), 1) && (STA_HALT(), 1))) +/** + * @brief Assert expression if condition is true. + * + * @param cond Condition + * @param expr Expression + */ +# define STA_ASSERT_COND(cond, expr) ((void)((cond) ? STA_ASSERT(expr) : 1)) +/** + * @brief Assert expression if condition is true. + * + * @param cond Condition + * @param expr Expression + * @param msg Message shown on failure + */ +# define STA_ASSERT_COND_MSG(cond, expr, msg) ((void)((cond) ? STA_ASSERT_MSG(expr, msg))) #else // !STA_ASSERT_ENABLE @@ -88,6 +103,21 @@ namespace sta * @param msg Message shown on failure */ # define STA_ASSERT_MSG(expr, msg) ((void)0) +/** + * @brief Assert expression if condition is true. + * + * @param cond Condition + * @param expr Expression + */ +# define STA_ASSERT_COND(cond, expr) ((void)0) +/** + * @brief Assert expression if condition is true. + * + * @param cond Condition + * @param expr Expression + * @param msg Message shown on failure + */ +# define STA_ASSERT_COND_MSG(cond, expr, msg) ((void)0) #endif // !STA_ASSERT_ENABLE