Add IO type checking functions, add ReadLine
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
#define BH_UNIT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
typedef int (*BH_UnitCallback)(void);
|
||||
|
||||
|
||||
#define BH_VERIFY(e) \
|
||||
do { \
|
||||
if (!(e)) { \
|
||||
@@ -35,6 +38,17 @@ typedef int (*BH_UnitCallback)(void);
|
||||
} while(0)
|
||||
|
||||
|
||||
#define BH_VERIFY_STR_EQ(actual, expected) \
|
||||
do { \
|
||||
BH_VERIFY((actual) != NULL && (expected) != NULL); \
|
||||
if (strcmp((actual), (expected)) != 0) { \
|
||||
printf("%s:%d\tExpected '%s', got '%s'\n", \
|
||||
__FILE__, __LINE__, (expected), (actual)); \
|
||||
return -1; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define BH_UNIT_TEST(name) \
|
||||
static int unit##name(void)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user