-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.h
65 lines (62 loc) · 4.09 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef TIMEZONE_TEST_H
#define TIMEZONE_TEST_H
#include <stdio.h>
#include <stdlib.h>
#define TEST_TRUE(a) \
{ \
if (!(a)) { \
printf("%s[%s:%d]: TEST_TRUE failed!\n", __FUNCTION__, __FILE__, \
__LINE__); \
exit(1); \
} \
}
#define TEST_FALSE(a) \
{ \
if (a) { \
printf("%s[%s:%d]: TEST_FALSE failed!\n", __FUNCTION__, __FILE__, \
__LINE__); \
exit(1); \
} \
}
#define TEST_EQUAL(a, b) \
{ \
if (a != b) { \
printf("%s[%s:%d]: TEST_EQUAL failed! %lld != %lld \n", \
__FUNCTION__, __FILE__, __LINE__, (long long int)a, \
(long long int)b); \
exit(1); \
} \
}
#define TEST_NOT_EQUAL(a, b) \
{ \
if (a == b) { \
printf("%s[%s:%d]: TEST_NOT_EQUAL failed!\n", __FUNCTION__, \
__FILE__, __LINE__); \
exit(1); \
} \
}
#define TEST_STRING_EQUAL(a, b) \
{ \
if (strcmp(a, b) != 0) { \
printf("%s[%s:%d]: TEST_STRING_EQUAL failed!\n", __FUNCTION__, \
__FILE__, __LINE__); \
exit(1); \
} \
}
#define TEST_NULL(a) \
{ \
if (a != NULL) { \
printf("%s[%s:%d]: TEST_NULL failed!\n", __FUNCTION__, __FILE__, \
__LINE__); \
exit(1); \
} \
}
#define TEST_NOT_NULL(a) \
{ \
if (a == NULL) { \
printf("%s[%s:%d]: TEST_NOT_NULL failed!\n", __FUNCTION__, \
__FILE__, __LINE__); \
exit(1); \
} \
}
#endif