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