mirror of
https://github.com/pound-emu/ballistic.git
synced 2026-03-09 10:45:39 -07:00
This only tests if the CONST instruction was emmited correctly by testing its opcodes and operands. SSA state testing is the next logical step to complete before I move on to OPCODE_ADD. Signed-off-by: Ronald Caesar <github43132@proton.me>
37 lines
2.1 KiB
C
37 lines
2.1 KiB
C
#ifndef BALLISTIC_COMMON_ASSERT_H
|
|
#define BALLISTIC_COMMON_ASSERT_H
|
|
|
|
#include <stddef.h>
|
|
|
|
void bal_internal_assert_fail(
|
|
const char *file, int line, const char *func, const char *expr_str, const char *user_msg, ...);
|
|
|
|
#define BAL_ASSERT(expression) \
|
|
do \
|
|
{ \
|
|
if (!(expression)) \
|
|
{ \
|
|
bal_internal_assert_fail(__FILE__, __LINE__, __func__, #expression, NULL, NULL); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define BAL_ASSERT_MSG(expression, format, ...) \
|
|
do \
|
|
{ \
|
|
if (!(expression)) \
|
|
{ \
|
|
bal_internal_assert_fail( \
|
|
__FILE__, __LINE__, __func__, #expression, format __VA_OPT__(, ) __VA_ARGS__); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define BAL_UNREACHABLE(...) \
|
|
bal_internal_assert_fail(__FILE__, \
|
|
__LINE__, \
|
|
__func__, \
|
|
"BAL_UNREACHABLE()", \
|
|
"Unreachable code executed", \
|
|
##__VA_ARGS__);
|
|
|
|
#endif // BALLISTIC_COMMON_ASSERT_H
|