[IPHLPAPI_APITEST]
[reactos.git] / rostests / apitests / apitest.h
1 #ifndef _APITEST_H
2 #define _APITEST_H
3
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <windef.h>
7 #include <winbase.h>
8 #include <winreg.h>
9 #include <shellapi.h>
10
11 #define APISTATUS_NORMAL 0
12 #define APISTATUS_NOT_FOUND 1
13 #define APISTATUS_UNIMPLEMENTED 2
14 #define APISTATUS_ASSERTION_FAILED 3
15 #define APISTATUS_REGRESSION 4
16
17 /* type definitions */
18
19 typedef struct tagTESTINFO
20 {
21 INT passed;
22 INT failed;
23 INT rfailed;
24 BOOL bRegress;
25 INT nApiStatus;
26 } TESTINFO, *PTESTINFO;
27
28 typedef INT (*TESTPROC)(PTESTINFO);
29
30 typedef struct tagTEST
31 {
32 WCHAR* Test;
33 TESTPROC Proc;
34 } TESTENTRY, *PTESTENTRY;
35
36
37 /* macros */
38
39 #define TEST(x) \
40 if (pti->bRegress) \
41 { \
42 if (x)\
43 {\
44 (pti->passed)++;\
45 printf("%s:%d: non-rtest succeeded (%s)\n", __FILE__, __LINE__, #x);\
46 } else {\
47 (pti->failed)++;\
48 } \
49 } \
50 else \
51 { \
52 if (x)\
53 {\
54 (pti->passed)++;\
55 } else {\
56 (pti->failed)++;\
57 printf("%s:%d: test failed (%s)\n", __FILE__, __LINE__, #x);\
58 } \
59 }
60
61 #define TESTX(x, format, ...) \
62 if (pti->bRegress) \
63 { \
64 if (x)\
65 {\
66 (pti->passed)++;\
67 printf("%s:%d: non-rtest succeeded (%s)\n", __FILE__, __LINE__, #x);\
68 } else {\
69 (pti->failed)++;\
70 } \
71 } \
72 else \
73 { \
74 if (x)\
75 {\
76 (pti->passed)++;\
77 } else {\
78 (pti->failed)++;\
79 printf("%s:%d: test failed (%s) ", __FILE__, __LINE__, #x);\
80 printf(format, __VA_ARGS__); \
81 } \
82 }
83
84 #define RTEST(x) \
85 if (pti->bRegress) \
86 { \
87 if (x)\
88 {\
89 (pti->passed)++;\
90 } else {\
91 (pti->failed)++;\
92 (pti->rfailed)++;\
93 printf("rtest failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
94 } \
95 } \
96 else \
97 { \
98 if (x)\
99 {\
100 (pti->passed)++;\
101 } else {\
102 (pti->failed)++;\
103 printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
104 } \
105 }
106
107 #undef ASSERT
108 #define ASSERT(x) \
109 if (!(x)) \
110 { \
111 printf("Assertion failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
112 return APISTATUS_ASSERTION_FAILED; \
113 }
114
115 int TestMain(LPWSTR pszExe, LPWSTR pszModule);
116 extern TESTENTRY TestList[];
117 INT NumTests(void);
118 BOOL IsFunctionPresent(LPWSTR lpszFunction);
119 VOID DumpMem(PVOID pData, ULONG cbSize, ULONG nWidth);
120
121 #endif /* _APITEST_H */