crypt32: Make sure we show Unicode characters (Dutch translation).
[wine] / dlls / shlwapi / tests / generated.c
1 /* File generated automatically from tools/winapi/tests.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 #include "windef.h"
16 #include "winbase.h"
17 #include "wtypes.h"
18 #include "winreg.h"
19 #include "shlwapi.h"
20
21 #include "wine/test.h"
22
23 /***********************************************************************
24  * Compatibility macros
25  */
26
27 #define DWORD_PTR UINT_PTR
28 #define LONG_PTR INT_PTR
29 #define ULONG_PTR UINT_PTR
30
31 /***********************************************************************
32  * Windows API extension
33  */
34
35 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
36 # define _TYPE_ALIGNMENT(type) __alignof(type)
37 #elif defined(__GNUC__)
38 # define _TYPE_ALIGNMENT(type) __alignof__(type)
39 #else
40 /*
41  * FIXME: May not be possible without a compiler extension
42  *        (if type is not just a name that is, otherwise the normal
43  *         TYPE_ALIGNMENT can be used)
44  */
45 #endif
46
47 #if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
48 #pragma warning(disable:4116)
49 #endif
50
51 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
52 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
53 #endif
54
55 /***********************************************************************
56  * Test helper macros
57  */
58
59 #ifdef _WIN64
60
61 # define TEST_TYPE_SIZE(type, size)
62 # define TEST_TYPE_ALIGN(type, align)
63 # define TEST_TARGET_ALIGN(type, align)
64 # define TEST_FIELD_ALIGN(type, field, align)
65 # define TEST_FIELD_OFFSET(type, field, offset)
66
67 #else
68
69 # define TEST_TYPE_SIZE(type, size)             C_ASSERT(sizeof(type) == size);
70
71 # ifdef TYPE_ALIGNMENT
72 #  define TEST_TYPE_ALIGN(type, align)          C_ASSERT(TYPE_ALIGNMENT(type) == align);
73 # else
74 #  define TEST_TYPE_ALIGN(type, align)
75 # endif
76
77 # ifdef _TYPE_ALIGNMENT
78 #  define TEST_TARGET_ALIGN(type, align)        C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
79 #  define TEST_FIELD_ALIGN(type, field, align)  C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
80 # else
81 #  define TEST_TARGET_ALIGN(type, align)
82 #  define TEST_FIELD_ALIGN(type, field, align)
83 # endif
84
85 # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
86
87 #endif
88
89 #define TEST_TARGET_SIZE(type, size)            TEST_TYPE_SIZE(*(type)0, size)
90 #define TEST_FIELD_SIZE(type, field, size)      TEST_TYPE_SIZE((((type*)0)->field), size)
91 #define TEST_TYPE_SIGNED(type)                  C_ASSERT((type) -1 < 0);
92 #define TEST_TYPE_UNSIGNED(type)                C_ASSERT((type) -1 > 0);
93
94
95 static void test_pack_ASSOCF(void)
96 {
97     /* ASSOCF */
98     TEST_TYPE_SIZE   (ASSOCF, 4)
99     TEST_TYPE_ALIGN  (ASSOCF, 4)
100     TEST_TYPE_UNSIGNED(ASSOCF)
101 }
102
103 static void test_pack_DLLGETVERSIONPROC(void)
104 {
105     /* DLLGETVERSIONPROC */
106     TEST_TYPE_SIZE   (DLLGETVERSIONPROC, 4)
107     TEST_TYPE_ALIGN  (DLLGETVERSIONPROC, 4)
108 }
109
110 static void test_pack_DLLVERSIONINFO(void)
111 {
112     /* DLLVERSIONINFO (pack 8) */
113     TEST_TYPE_SIZE   (DLLVERSIONINFO, 20)
114     TEST_TYPE_ALIGN  (DLLVERSIONINFO, 4)
115     TEST_FIELD_SIZE  (DLLVERSIONINFO, cbSize, 4)
116     TEST_FIELD_ALIGN (DLLVERSIONINFO, cbSize, 4)
117     TEST_FIELD_OFFSET(DLLVERSIONINFO, cbSize, 0)
118     TEST_FIELD_SIZE  (DLLVERSIONINFO, dwMajorVersion, 4)
119     TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMajorVersion, 4)
120     TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMajorVersion, 4)
121     TEST_FIELD_SIZE  (DLLVERSIONINFO, dwMinorVersion, 4)
122     TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMinorVersion, 4)
123     TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMinorVersion, 8)
124     TEST_FIELD_SIZE  (DLLVERSIONINFO, dwBuildNumber, 4)
125     TEST_FIELD_ALIGN (DLLVERSIONINFO, dwBuildNumber, 4)
126     TEST_FIELD_OFFSET(DLLVERSIONINFO, dwBuildNumber, 12)
127     TEST_FIELD_SIZE  (DLLVERSIONINFO, dwPlatformID, 4)
128     TEST_FIELD_ALIGN (DLLVERSIONINFO, dwPlatformID, 4)
129     TEST_FIELD_OFFSET(DLLVERSIONINFO, dwPlatformID, 16)
130 }
131
132 static void test_pack_DLLVERSIONINFO2(void)
133 {
134     /* DLLVERSIONINFO2 (pack 8) */
135     TEST_TYPE_SIZE   (DLLVERSIONINFO2, 32)
136     TEST_TYPE_ALIGN  (DLLVERSIONINFO2, 8)
137     TEST_FIELD_SIZE  (DLLVERSIONINFO2, info1, 20)
138     TEST_FIELD_ALIGN (DLLVERSIONINFO2, info1, 4)
139     TEST_FIELD_OFFSET(DLLVERSIONINFO2, info1, 0)
140     TEST_FIELD_SIZE  (DLLVERSIONINFO2, dwFlags, 4)
141     TEST_FIELD_ALIGN (DLLVERSIONINFO2, dwFlags, 4)
142     TEST_FIELD_OFFSET(DLLVERSIONINFO2, dwFlags, 20)
143     TEST_FIELD_SIZE  (DLLVERSIONINFO2, ullVersion, 8)
144     TEST_FIELD_ALIGN (DLLVERSIONINFO2, ullVersion, 8)
145     TEST_FIELD_OFFSET(DLLVERSIONINFO2, ullVersion, 24)
146 }
147
148 static void test_pack_HUSKEY(void)
149 {
150     /* HUSKEY */
151     TEST_TYPE_SIZE   (HUSKEY, 4)
152     TEST_TYPE_ALIGN  (HUSKEY, 4)
153 }
154
155 static void test_pack_PHUSKEY(void)
156 {
157     /* PHUSKEY */
158     TEST_TYPE_SIZE   (PHUSKEY, 4)
159     TEST_TYPE_ALIGN  (PHUSKEY, 4)
160     TEST_TARGET_SIZE (PHUSKEY, 4)
161     TEST_TARGET_ALIGN(PHUSKEY, 4)
162 }
163
164 static void test_pack(void)
165 {
166     test_pack_ASSOCF();
167     test_pack_DLLGETVERSIONPROC();
168     test_pack_DLLVERSIONINFO();
169     test_pack_DLLVERSIONINFO2();
170     test_pack_HUSKEY();
171     test_pack_PHUSKEY();
172 }
173
174 START_TEST(generated)
175 {
176 #ifdef _WIN64
177     ok(0, "The type size / alignment tests don't support Win64 yet\n");
178 #else
179     test_pack();
180 #endif
181 }