This repository has been archived on 2026-04-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
bhlib-old/unit/include/bh/unit.h

25 lines
851 B
C
Raw Normal View History

2024-04-13 14:52:29 +03:00
#ifndef BHLIB_UNIT_H
#define BHLIB_UNIT_H
#include <stdio.h>
typedef int (*bh_unit_cb_t)(void);
#define bh_unit_assert(e) \
if (!(e)) { \
printf("%s:%d\t%s", __FILE__, __LINE__, #e); \
return -1; \
}
#define bh_unit_assert_delta(x, y, e) \
if ((((x)>(y))?((x)-(y)):((y)-(x)))>(e)) { \
printf("%s:%d\t%s", __FILE__, __LINE__, #x " == " #y); \
return -1; \
}
void bh_unit_add(const char *name, bh_unit_cb_t func);
int bh_unit_run(void);
#endif /* BHLIB_UNIT_H */