2007-08-02 21:42:37 +00:00
|
|
|
#ifndef _APITEST_H
|
|
|
|
#define _APITEST_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
2007-08-04 16:45:12 +00:00
|
|
|
#include <fcntl.h>
|
2007-08-02 21:42:37 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
2007-08-05 03:32:24 +00:00
|
|
|
#define open _open
|
|
|
|
|
2007-08-04 16:45:12 +00:00
|
|
|
#define APISTATUS_NORMAL 0
|
|
|
|
#define APISTATUS_NOT_FOUND 1
|
|
|
|
#define APISTATUS_UNIMPLEMENTED 2
|
|
|
|
#define APISTATUS_ASSERTION_FAILED 3
|
|
|
|
#define APISTATUS_REGRESSION 4
|
2007-08-02 21:42:37 +00:00
|
|
|
|
|
|
|
/* type definitions */
|
|
|
|
|
|
|
|
typedef struct tagTESTINFO
|
|
|
|
{
|
|
|
|
INT passed;
|
|
|
|
INT failed;
|
|
|
|
INT rfailed;
|
|
|
|
BOOL bRegress;
|
2007-08-04 16:45:12 +00:00
|
|
|
INT nApiStatus;
|
2007-08-02 21:42:37 +00:00
|
|
|
} TESTINFO, *PTESTINFO;
|
|
|
|
|
2007-08-04 16:45:12 +00:00
|
|
|
typedef INT (*TESTPROC)(PTESTINFO);
|
2007-08-02 21:42:37 +00:00
|
|
|
|
|
|
|
typedef struct tagTEST
|
|
|
|
{
|
|
|
|
WCHAR* Test;
|
|
|
|
TESTPROC Proc;
|
|
|
|
} TESTENTRY, *PTESTENTRY;
|
|
|
|
|
|
|
|
|
|
|
|
/* macros */
|
|
|
|
|
|
|
|
#define TEST(x) \
|
|
|
|
if (pti->bRegress) \
|
|
|
|
{ \
|
|
|
|
if (x)\
|
|
|
|
{\
|
|
|
|
(pti->passed)++;\
|
|
|
|
printf("non-rtest succeeded in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
|
|
|
} else {\
|
|
|
|
(pti->failed)++;\
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
if (x)\
|
|
|
|
{\
|
|
|
|
(pti->passed)++;\
|
|
|
|
} else {\
|
|
|
|
(pti->failed)++;\
|
|
|
|
printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define RTEST(x) \
|
|
|
|
if (pti->bRegress) \
|
|
|
|
{ \
|
|
|
|
if (x)\
|
|
|
|
{\
|
|
|
|
(pti->passed)++;\
|
|
|
|
} else {\
|
|
|
|
(pti->failed)++;\
|
|
|
|
(pti->rfailed)++;\
|
|
|
|
printf("rtest failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
if (x)\
|
|
|
|
{\
|
|
|
|
(pti->passed)++;\
|
|
|
|
} else {\
|
|
|
|
(pti->failed)++;\
|
|
|
|
printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2007-08-28 15:06:36 +00:00
|
|
|
#undef ASSERT
|
|
|
|
#define ASSERT(x) \
|
2007-08-04 16:45:12 +00:00
|
|
|
if (!(x)) \
|
|
|
|
{ \
|
|
|
|
printf("Assertion failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
|
|
|
return APISTATUS_ASSERTION_FAILED; \
|
|
|
|
}
|
|
|
|
|
|
|
|
int TestMain(LPWSTR pszExe, LPWSTR pszModule);
|
2007-08-02 21:42:37 +00:00
|
|
|
extern TESTENTRY TestList[];
|
|
|
|
INT NumTests(void);
|
|
|
|
BOOL IsFunctionPresent(LPWSTR lpszFunction);
|
|
|
|
|
|
|
|
#endif /* _APITEST_H */
|