-
Notifications
You must be signed in to change notification settings - Fork 130
/
test.h
39 lines (31 loc) · 1.07 KB
/
test.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef _WGTCC_TEST_H_
#define _WGTCC_TEST_H_
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#define fail(msg) \
fprintf(stderr, "error:%s:%s:%d: failed, %s\n", \
__FILE__, __func__, __LINE__, (msg)); \
#define expect(a, b) \
if ((a) != (b)) { \
fprintf(stderr, "error:%s:%s:%d: failed, %d != %d\n", \
__FILE__, __func__, __LINE__, (a), (b)); \
};
#define expectl expect
#define expectf expect_float
#define expectd expect_float
#define expect_float(a, b) \
if ((a) != (b)) { \
fprintf(stderr, "error:%s:%s:%d: failed, %f != %f\n", \
__FILE__, __func__, __LINE__, (a), (b)); \
};
#define expect_string(a, b) \
if (strcmp((a), (b))) { \
fprintf(stderr, "error:%s:%s:%d: failed, %s != %s\n", \
__FILE__, __func__, __LINE__, (a), (b)); \
};
#endif