ReactOS 0.4.15-dev-8393-g61b7fb9
generated.c
Go to the documentation of this file.
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 WINE_NOWINSOCK
9
10#include <stdarg.h>
11#include "windef.h"
12#include "winbase.h"
13#include "wtypes.h"
14#include "winreg.h"
15#include "shlwapi.h"
16
17#include "wine/test.h"
18
19/***********************************************************************
20 * Compatibility macros
21 */
22
23#define DWORD_PTR UINT_PTR
24#define LONG_PTR INT_PTR
25#define ULONG_PTR UINT_PTR
26
27/***********************************************************************
28 * Windows API extension
29 */
30
31#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
32# define _TYPE_ALIGNMENT(type) __alignof(type)
33#elif defined(__GNUC__)
34# define _TYPE_ALIGNMENT(type) __alignof__(type)
35#else
36/*
37 * FIXME: May not be possible without a compiler extension
38 * (if type is not just a name that is, otherwise the normal
39 * TYPE_ALIGNMENT can be used)
40 */
41#endif
42
43#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
44#pragma warning(disable:4116)
45#endif
46
47#if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
48# define TYPE_ALIGNMENT _TYPE_ALIGNMENT
49#endif
50
51/***********************************************************************
52 * Test helper macros
53 */
54
55#define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
56
57#ifdef TYPE_ALIGNMENT
58# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
59#else
60# define TEST_TYPE_ALIGN(type, align)
61#endif
62
63#ifdef _TYPE_ALIGNMENT
64# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
65# define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
66#else
67# define TEST_TARGET_ALIGN(type, align)
68# define TEST_FIELD_ALIGN(type, field, align)
69#endif
70
71#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
72
73#define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
74#define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
75#define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
76#define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
77
78
79#ifdef _WIN64
80
81static void test_pack_ASSOCF(void)
82{
83 /* ASSOCF */
87}
88
89static void test_pack_DLLGETVERSIONPROC(void)
90{
91 /* DLLGETVERSIONPROC */
94}
95
96static void test_pack_DLLVERSIONINFO(void)
97{
98 /* DLLVERSIONINFO (pack 8) */
104 TEST_FIELD_SIZE (DLLVERSIONINFO, dwMajorVersion, 4)
105 TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMajorVersion, 4)
106 TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMajorVersion, 4)
107 TEST_FIELD_SIZE (DLLVERSIONINFO, dwMinorVersion, 4)
108 TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMinorVersion, 4)
109 TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMinorVersion, 8)
110 TEST_FIELD_SIZE (DLLVERSIONINFO, dwBuildNumber, 4)
111 TEST_FIELD_ALIGN (DLLVERSIONINFO, dwBuildNumber, 4)
112 TEST_FIELD_OFFSET(DLLVERSIONINFO, dwBuildNumber, 12)
113 TEST_FIELD_SIZE (DLLVERSIONINFO, dwPlatformID, 4)
114 TEST_FIELD_ALIGN (DLLVERSIONINFO, dwPlatformID, 4)
115 TEST_FIELD_OFFSET(DLLVERSIONINFO, dwPlatformID, 16)
116}
117
118static void test_pack_DLLVERSIONINFO2(void)
119{
120 /* DLLVERSIONINFO2 (pack 8) */
129 TEST_FIELD_SIZE (DLLVERSIONINFO2, ullVersion, 8)
130 TEST_FIELD_ALIGN (DLLVERSIONINFO2, ullVersion, 8)
131 TEST_FIELD_OFFSET(DLLVERSIONINFO2, ullVersion, 24)
132}
133
134static void test_pack_HUSKEY(void)
135{
136 /* HUSKEY */
139}
140
141static void test_pack_PHUSKEY(void)
142{
143 /* PHUSKEY */
148}
149
150#else /* _WIN64 */
151
152static void test_pack_ASSOCF(void)
153{
154 /* ASSOCF */
158}
159
161{
162 /* DLLGETVERSIONPROC */
165}
166
168{
169 /* DLLVERSIONINFO (pack 8) */
175 TEST_FIELD_SIZE (DLLVERSIONINFO, dwMajorVersion, 4)
176 TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMajorVersion, 4)
177 TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMajorVersion, 4)
178 TEST_FIELD_SIZE (DLLVERSIONINFO, dwMinorVersion, 4)
179 TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMinorVersion, 4)
180 TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMinorVersion, 8)
181 TEST_FIELD_SIZE (DLLVERSIONINFO, dwBuildNumber, 4)
182 TEST_FIELD_ALIGN (DLLVERSIONINFO, dwBuildNumber, 4)
183 TEST_FIELD_OFFSET(DLLVERSIONINFO, dwBuildNumber, 12)
184 TEST_FIELD_SIZE (DLLVERSIONINFO, dwPlatformID, 4)
185 TEST_FIELD_ALIGN (DLLVERSIONINFO, dwPlatformID, 4)
186 TEST_FIELD_OFFSET(DLLVERSIONINFO, dwPlatformID, 16)
187}
188
190{
191 /* DLLVERSIONINFO2 (pack 8) */
200 TEST_FIELD_SIZE (DLLVERSIONINFO2, ullVersion, 8)
201 TEST_FIELD_ALIGN (DLLVERSIONINFO2, ullVersion, 8)
202 TEST_FIELD_OFFSET(DLLVERSIONINFO2, ullVersion, 24)
203}
204
205static void test_pack_HUSKEY(void)
206{
207 /* HUSKEY */
210}
211
212static void test_pack_PHUSKEY(void)
213{
214 /* PHUSKEY */
219}
220
221#endif /* _WIN64 */
222
223static void test_pack(void)
224{
231}
232
233START_TEST(generated)
234{
235 test_pack();
236}
#define START_TEST(x)
Definition: atltest.h:75
#define TEST_TARGET_SIZE(type, size)
Definition: generated.c:68
#define TEST_FIELD_OFFSET(type, field, offset)
Definition: generated.c:66
#define TEST_TARGET_ALIGN(type, align)
Definition: generated.c:62
static void test_pack(void)
Definition: generated.c:13122
#define TEST_TYPE_SIZE(type, size)
Definition: generated.c:50
#define TEST_FIELD_SIZE(type, field, size)
Definition: generated.c:69
#define TEST_TYPE_ALIGN(type, align)
Definition: generated.c:55
#define TEST_FIELD_ALIGN(type, field, align)
Definition: generated.c:63
#define TEST_TYPE_UNSIGNED(type)
Definition: generated.c:71
static void test_pack_DLLGETVERSIONPROC(void)
Definition: generated.c:160
static void test_pack_DLLVERSIONINFO2(void)
Definition: generated.c:189
static void test_pack_ASSOCF(void)
Definition: generated.c:152
static void test_pack_DLLVERSIONINFO(void)
Definition: generated.c:167
static void test_pack_HUSKEY(void)
Definition: generated.c:205
static void test_pack_PHUSKEY(void)
Definition: generated.c:212
HRESULT(CALLBACK * DLLGETVERSIONPROC)(DLLVERSIONINFO *)
Definition: shlwapi.h:1964
DWORD ASSOCF
Definition: shlwapi.h:599
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176