updated dirname/basepath to follow a modification of IEEE standard.
This commit is contained in:
parent
304049064e
commit
654f4bff80
6 changed files with 217 additions and 194 deletions
20
test/unit.h
20
test/unit.h
|
|
@ -8,8 +8,24 @@
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define assert_string(a, b) \
|
||||
assert(strcmp((char*)a, (char*)b) == 0)
|
||||
#define __uexit(file, line, func, fmt, ...) \
|
||||
do { \
|
||||
fprintf(stderr, "ASSERT %s in %s(%i): " fmt, func, file, line, __VA_ARGS__); \
|
||||
exit(1); \
|
||||
} while(0)
|
||||
|
||||
/* internal function. assert_* macros below expands to this */
|
||||
inline void __assert_str(char *file, int line, char *func, char *a, char *b) {
|
||||
|
||||
if (a == NULL || b == NULL)
|
||||
__uexit(file, line, func, "a or b is null\n", NULL);
|
||||
|
||||
if (strcmp(a, b) != 0)
|
||||
__uexit(file, line, func, "\"%s\" != \"%s\"\n", a, b);
|
||||
|
||||
}
|
||||
|
||||
#define assert_string(a, b) __assert_str(__FILE__, __LINE__, __FUNCTION__, a, b)
|
||||
|
||||
void utest_init_RNG();
|
||||
|
||||
|
|
|
|||
Reference in a new issue