- implement quick 'n dirty HTML api status output
[reactos.git] / rostests / apitests / apitest.h
1 #ifndef _APITEST_H
2 #define _APITEST_H
3
4 #define WINVER 0x501
5
6 #include <stdlib.h>
7 #include <stdarg.h>
8 #include <stdio.h>
9 #include <fcntl.h>
10 #include <windows.h>
11
12 #define APISTATUS_NORMAL 0
13 #define APISTATUS_NOT_FOUND 1
14 #define APISTATUS_UNIMPLEMENTED 2
15 #define APISTATUS_ASSERTION_FAILED 3
16 #define APISTATUS_REGRESSION 4
17
18 /* type definitions */
19
20 typedef struct tagTESTINFO
21 {
22 INT passed;
23 INT failed;
24 INT rfailed;
25 BOOL bRegress;
26 INT nApiStatus;
27 } TESTINFO, *PTESTINFO;
28
29 typedef INT (*TESTPROC)(PTESTINFO);
30
31 typedef struct tagTEST
32 {
33 WCHAR* Test;
34 TESTPROC Proc;
35 } TESTENTRY, *PTESTENTRY;
36
37
38 /* macros */
39
40 #define TEST(x) \
41 if (pti->bRegress) \
42 { \
43 if (x)\
44 {\
45 (pti->passed)++;\
46 printf("non-rtest succeeded in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
47 } else {\
48 (pti->failed)++;\
49 } \
50 } \
51 else \
52 { \
53 if (x)\
54 {\
55 (pti->passed)++;\
56 } else {\
57 (pti->failed)++;\
58 printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
59 } \
60 }
61
62 #define RTEST(x) \
63 if (pti->bRegress) \
64 { \
65 if (x)\
66 {\
67 (pti->passed)++;\
68 } else {\
69 (pti->failed)++;\
70 (pti->rfailed)++;\
71 printf("rtest failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
72 } \
73 } \
74 else \
75 { \
76 if (x)\
77 {\
78 (pti->passed)++;\
79 } else {\
80 (pti->failed)++;\
81 printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
82 } \
83 }
84
85
86 #define ASSERT(x) \
87 if (!(x)) \
88 { \
89 printf("Assertion failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
90 return APISTATUS_ASSERTION_FAILED; \
91 }
92
93 int TestMain(LPWSTR pszExe, LPWSTR pszModule);
94 extern TESTENTRY TestList[];
95 INT NumTests(void);
96 BOOL IsFunctionPresent(LPWSTR lpszFunction);
97
98 #endif /* _APITEST_H */