ReactOS 0.4.15-dev-8241-g63935f8
apitest.h
Go to the documentation of this file.
1#ifndef _APITEST_H
2#define _APITEST_H
3
4// #define __ROS_LONG64__
5
6/* The user must #define STANDALONE if it uses this header in testlist.c */
7#define WIN32_NO_STATUS
8#include <wine/test.h>
9#undef WIN32_NO_STATUS
10
11/* See kmtests/include/kmt_test.h */
12#define InvalidPointer ((PVOID)0x5555555555555555ULL)
13// #define InvalidPointer ((PVOID)0x0123456789ABCDEFULL)
14
15#ifdef __USE_PSEH2__
16#include <pseh/pseh2.h>
17
18#define StartSeh() \
19{ \
20 NTSTATUS ExceptionStatus = STATUS_SUCCESS; \
21 _SEH2_TRY \
22 {
23
24#define EndSeh(ExpectedStatus) \
25 } \
26 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) \
27 { \
28 ExceptionStatus = _SEH2_GetExceptionCode(); \
29 } \
30 _SEH2_END; \
31 ok(ExceptionStatus == (ExpectedStatus), \
32 "Exception 0x%08lx, expected 0x%08lx\n", \
33 ExceptionStatus, (ExpectedStatus)); \
34}
35#else
36#define StartSeh() \
37{ \
38 NTSTATUS ExceptionStatus = STATUS_SUCCESS; \
39 __try \
40 {
41
42#define EndSeh(ExpectedStatus) \
43 } \
44 __except(EXCEPTION_EXECUTE_HANDLER) \
45 { \
46 ExceptionStatus = GetExceptionCode(); \
47 } \
48 ok(ExceptionStatus == (ExpectedStatus), \
49 "Exception 0x%08lx, expected 0x%08lx\n", \
50 ExceptionStatus, (ExpectedStatus)); \
51}
52#endif
53
54#define ok_hr(status, expected) ok_hex(status, expected)
55#define ok_hr_(file, line, status, expected) ok_hex_(file, line, status, expected)
56
57#define ok_eq_print(value, expected, spec) ok((value) == (expected), #value " = " spec ", expected " spec "\n", value, expected)
58#define ok_eq_print_(file, line, value, expected, spec) ok_(file,line)((value) == (expected), #value " = " spec ", expected " spec "\n", value, expected)
59#define ok_eq_pointer(value, expected) ok_eq_print(value, expected, "%p")
60#define ok_eq_int(value, expected) ok_eq_print(value, expected, "%d")
61#define ok_eq_uint(value, expected) ok_eq_print(value, expected, "%u")
62#define ok_eq_long(value, expected) ok_eq_print(value, expected, "%ld")
63#define ok_eq_ulong(value, expected) ok_eq_print(value, expected, "%lu")
64#define ok_eq_longlong(value, expected) ok_eq_print(value, expected, "%I64d")
65#define ok_eq_ulonglong(value, expected) ok_eq_print(value, expected, "%I64u")
66#define ok_eq_char(value, expected) ok_eq_print(value, expected, "%c")
67#define ok_eq_wchar(value, expected) ok_eq_print(value, expected, "%C")
68#ifndef _WIN64
69#define ok_eq_size(value, expected) ok_eq_print(value, (SIZE_T)(expected), "%lu")
70#define ok_eq_longptr(value, expected) ok_eq_print(value, (LONG_PTR)(expected), "%ld")
71#define ok_eq_ulongptr(value, expected) ok_eq_print(value, (ULONG_PTR)(expected), "%lu")
72#elif defined _WIN64
73#define ok_eq_size(value, expected) ok_eq_print(value, (SIZE_T)(expected), "%I64u")
74#define ok_eq_longptr(value, expected) ok_eq_print(value, (LONG_PTR)(expected), "%I64d")
75#define ok_eq_ulongptr(value, expected) ok_eq_print(value, (ULONG_PTR)(expected), "%I64u")
76#endif /* defined _WIN64 */
77#define ok_eq_hex(value, expected) ok_eq_print(value, expected, "0x%08lx")
78#define ok_bool_true(value, desc) ok((value) == TRUE, desc " FALSE, expected TRUE\n")
79#define ok_bool_false(value, desc) ok((value) == FALSE, desc " TRUE, expected FALSE\n")
80#define ok_eq_bool(value, expected) ok((value) == (expected), #value " = %s, expected %s\n", \
81 (value) ? "TRUE" : "FALSE", \
82 (expected) ? "TRUE" : "FALSE")
83#define ok_eq_str(value, expected) ok(!strcmp(value, expected), #value " = \"%s\", expected \"%s\"\n", value, expected)
84#define ok_eq_wstr(value, expected) ok(!wcscmp(value, expected), #value " = \"%ls\", expected \"%ls\"\n", value, expected)
85#define ok_eq_tag(value, expected) ok_eq_print(value, expected, "0x%08lx")
86
87#define ok_eq_hex_(file, line, value, expected) ok_eq_print_(file, line, value, expected, "0x%08lx")
88#define ok_eq_hex64_(file, line, value, expected) ok_eq_print_(file, line, value, expected, "%I64x")
89#define ok_eq_hex64(value, expected) ok_eq_print(value, expected, "%I64x")
90#define ok_eq_xmm(value, expected) ok((value).Low == (expected).Low, #value " = %I64x'%08I64x, expected %I64x'%08I64x\n", (value).Low, (value).High, (expected).Low, (expected).High)
91
92#endif /* _APITEST_H */