Use INVALID_FILE_ATTRIBUTES to test for failure of
[wine] / dlls / shlwapi / tests / generated.c
1 /* File generated automatically from tools/winapi/test.dat; do not edit! */
2 /* This file can be copied, modified and distributed without restriction. */
3
4 /*
5  * Unit tests for data structure packing
6  */
7
8 #define WINVER 0x0501
9 #define _WIN32_IE 0x0501
10 #define _WIN32_WINNT 0x0501
11
12 #define WINE_NOWINSOCK
13
14 #include <stdarg.h>
15
16 #include "windef.h"
17 #include "winbase.h"
18 #include "wtypes.h"
19 #include "winreg.h"
20 #include "shlwapi.h"
21
22 #include "wine/test.h"
23
24 /***********************************************************************
25  * Compability macros
26  */
27
28 #define DWORD_PTR UINT_PTR
29 #define LONG_PTR INT_PTR
30 #define ULONG_PTR UINT_PTR
31
32 /***********************************************************************
33  * Windows API extension
34  */
35
36 #if (_MSC_VER >= 1300) && defined(__cplusplus)
37 # define FIELD_ALIGNMENT(type, field) __alignof(((type*)0)->field)
38 #elif defined(__GNUC__)
39 # define FIELD_ALIGNMENT(type, field) __alignof__(((type*)0)->field)
40 #else
41 /* FIXME: Not sure if is possible to do without compiler extension */
42 #endif
43
44 #if (_MSC_VER >= 1300) && defined(__cplusplus)
45 # define _TYPE_ALIGNMENT(type) __alignof(type)
46 #elif defined(__GNUC__)
47 # define _TYPE_ALIGNMENT(type) __alignof__(type)
48 #else
49 /*
50  * FIXME: Not sure if is possible to do without compiler extension
51  *        (if type is not just a name that is, if so the normal)
52  *         TYPE_ALIGNMENT can be used)
53  */
54 #endif
55
56 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
57 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
58 #endif
59
60 /***********************************************************************
61  * Test helper macros
62  */
63
64 #ifdef FIELD_ALIGNMENT
65 # define TEST_FIELD_ALIGNMENT(type, field, align) \
66    ok(FIELD_ALIGNMENT(type, field) == align, \
67        "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")", \
68            FIELD_ALIGNMENT(type, field))
69 #else
70 # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
71 #endif
72
73 #define TEST_FIELD_OFFSET(type, field, offset) \
74     ok(FIELD_OFFSET(type, field) == offset, \
75         "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")", \
76              FIELD_OFFSET(type, field))
77
78 #ifdef _TYPE_ALIGNMENT
79 #define TEST__TYPE_ALIGNMENT(type, align) \
80     ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")", _TYPE_ALIGNMENT(type))
81 #else
82 # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
83 #endif
84
85 #ifdef TYPE_ALIGNMENT
86 #define TEST_TYPE_ALIGNMENT(type, align) \
87     ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")", TYPE_ALIGNMENT(type))
88 #else
89 # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
90 #endif
91
92 #define TEST_TYPE_SIZE(type, size) \
93     ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")", sizeof(type))
94
95 /***********************************************************************
96  * Test macros
97  */
98
99 #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
100   TEST_TYPE_SIZE(field_type, field_size); \
101   TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
102   TEST_FIELD_OFFSET(type, field_name, field_offset); \
103
104 #define TEST_TYPE(type, size, align) \
105   TEST_TYPE_ALIGNMENT(type, align); \
106   TEST_TYPE_SIZE(type, size)
107
108 #define TEST_TYPE_POINTER(type, size, align) \
109     TEST__TYPE_ALIGNMENT(*(type)0, align); \
110     TEST_TYPE_SIZE(*(type)0, size)
111
112 #define TEST_TYPE_SIGNED(type) \
113     ok((type) -1 < 0, "(" #type ") -1 < 0");
114
115 #define TEST_TYPE_UNSIGNED(type) \
116      ok((type) -1 > 0, "(" #type ") -1 > 0");
117
118 static void test_pack_DLLGETVERSIONPROC(void)
119 {
120     /* DLLGETVERSIONPROC */
121     TEST_TYPE(DLLGETVERSIONPROC, 4, 4);
122 }
123
124 static void test_pack_DLLVERSIONINFO(void)
125 {
126     /* DLLVERSIONINFO (pack 1) */
127     TEST_TYPE(DLLVERSIONINFO, 20, 1);
128     TEST_FIELD(DLLVERSIONINFO, DWORD, cbSize, 0, 4, 1);
129     TEST_FIELD(DLLVERSIONINFO, DWORD, dwMajorVersion, 4, 4, 1);
130     TEST_FIELD(DLLVERSIONINFO, DWORD, dwMinorVersion, 8, 4, 1);
131     TEST_FIELD(DLLVERSIONINFO, DWORD, dwBuildNumber, 12, 4, 1);
132     TEST_FIELD(DLLVERSIONINFO, DWORD, dwPlatformID, 16, 4, 1);
133 }
134
135 static void test_pack_HUSKEY(void)
136 {
137     /* HUSKEY */
138     TEST_TYPE(HUSKEY, 4, 4);
139 }
140
141 static void test_pack_IQueryAssociations(void)
142 {
143     /* IQueryAssociations */
144 }
145
146 static void test_pack_PHUSKEY(void)
147 {
148     /* PHUSKEY */
149     TEST_TYPE(PHUSKEY, 4, 4);
150     TEST_TYPE_POINTER(PHUSKEY, 4, 4);
151 }
152
153 static void test_pack(void)
154 {
155     test_pack_DLLGETVERSIONPROC();
156     test_pack_DLLVERSIONINFO();
157     test_pack_HUSKEY();
158     test_pack_IQueryAssociations();
159     test_pack_PHUSKEY();
160 }
161
162 START_TEST(generated)
163 {
164     test_pack();
165 }