2008-06-01 18:06:22 +00:00
|
|
|
#ifndef _APITEST_H
|
|
|
|
#define _APITEST_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2013-02-05 17:54:22 +00:00
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
#include <winreg.h>
|
|
|
|
#include <shellapi.h>
|
2008-06-01 18:06:22 +00:00
|
|
|
|
|
|
|
#define APISTATUS_NORMAL 0
|
|
|
|
#define APISTATUS_NOT_FOUND 1
|
|
|
|
#define APISTATUS_UNIMPLEMENTED 2
|
|
|
|
#define APISTATUS_ASSERTION_FAILED 3
|
|
|
|
#define APISTATUS_REGRESSION 4
|
|
|
|
|
|
|
|
/* type definitions */
|
|
|
|
|
|
|
|
typedef struct tagTESTINFO
|
|
|
|
{
|
|
|
|
INT passed;
|
|
|
|
INT failed;
|
|
|
|
INT rfailed;
|
|
|
|
BOOL bRegress;
|
|
|
|
INT nApiStatus;
|
|
|
|
} TESTINFO, *PTESTINFO;
|
|
|
|
|
|
|
|
typedef INT (*TESTPROC)(PTESTINFO);
|
|
|
|
|
|
|
|
typedef struct tagTEST
|
|
|
|
{
|
|
|
|
WCHAR* Test;
|
|
|
|
TESTPROC Proc;
|
|
|
|
} TESTENTRY, *PTESTENTRY;
|
|
|
|
|
|
|
|
|
|
|
|
/* macros */
|
|
|
|
|
|
|
|
#define TEST(x) \
|
|
|
|
if (pti->bRegress) \
|
|
|
|
{ \
|
|
|
|
if (x)\
|
|
|
|
{\
|
|
|
|
(pti->passed)++;\
|
2009-03-25 04:25:39 +00:00
|
|
|
printf("%s:%d: non-rtest succeeded (%s)\n", __FILE__, __LINE__, #x);\
|
2008-06-01 18:06:22 +00:00
|
|
|
} else {\
|
|
|
|
(pti->failed)++;\
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
if (x)\
|
|
|
|
{\
|
|
|
|
(pti->passed)++;\
|
|
|
|
} else {\
|
|
|
|
(pti->failed)++;\
|
2009-03-25 04:25:39 +00:00
|
|
|
printf("%s:%d: test failed (%s)\n", __FILE__, __LINE__, #x);\
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define TESTX(x, format, ...) \
|
|
|
|
if (pti->bRegress) \
|
|
|
|
{ \
|
|
|
|
if (x)\
|
|
|
|
{\
|
|
|
|
(pti->passed)++;\
|
|
|
|
printf("%s:%d: non-rtest succeeded (%s)\n", __FILE__, __LINE__, #x);\
|
|
|
|
} else {\
|
|
|
|
(pti->failed)++;\
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
if (x)\
|
|
|
|
{\
|
|
|
|
(pti->passed)++;\
|
|
|
|
} else {\
|
|
|
|
(pti->failed)++;\
|
|
|
|
printf("%s:%d: test failed (%s) ", __FILE__, __LINE__, #x);\
|
|
|
|
printf(format, __VA_ARGS__); \
|
2008-06-01 18:06:22 +00:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#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);\
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef ASSERT
|
|
|
|
#define ASSERT(x) \
|
|
|
|
if (!(x)) \
|
|
|
|
{ \
|
|
|
|
printf("Assertion failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
|
|
|
return APISTATUS_ASSERTION_FAILED; \
|
|
|
|
}
|
|
|
|
|
|
|
|
int TestMain(LPWSTR pszExe, LPWSTR pszModule);
|
|
|
|
extern TESTENTRY TestList[];
|
|
|
|
INT NumTests(void);
|
|
|
|
BOOL IsFunctionPresent(LPWSTR lpszFunction);
|
2008-12-13 16:52:49 +00:00
|
|
|
VOID DumpMem(PVOID pData, ULONG cbSize, ULONG nWidth);
|
2008-06-01 18:06:22 +00:00
|
|
|
|
|
|
|
#endif /* _APITEST_H */
|