Archived
1
0
Fork 0

unit test api needs to be rewritten. crazy to assert functions with heap allocated memory or "in place"

manipulation.
This commit is contained in:
Henrik Hautakoski 2010-05-16 22:47:38 +02:00 committed by Henrik Hautakoski
parent 64b6356e61
commit 9fa5c9eac9
5 changed files with 14 additions and 13 deletions

View file

@ -1,7 +1,7 @@
#ifndef _UNIT_H
#define _UNIT_H
#define _UNIT_H 1
#include <stdlib.h>
#include <stdio.h>
@ -15,15 +15,7 @@
} 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);
}
void __assert_str(char *file, int line, char *func, char *a, char *b);
#define assert_string(a, b) __assert_str(__FILE__, __LINE__, __FUNCTION__, a, b)