1 /* File generated automatically from tools/winapi/test.dat; do not edit! */
2 /* This file can be copied, modified and distributed without restriction. */
5 * Unit tests for data structure packing
9 #define _WIN32_IE 0x0501
10 #define _WIN32_WINNT 0x0501
12 #define WINE_NOWINSOCK
20 #include "wine/test.h"
22 /***********************************************************************
26 #define DWORD_PTR UINT_PTR
27 #define LONG_PTR INT_PTR
28 #define ULONG_PTR UINT_PTR
30 /***********************************************************************
31 * Windows API extension
34 #if (_MSC_VER >= 1300) && defined(__cplusplus)
35 # define FIELD_ALIGNMENT(type, field) __alignof(((type*)0)->field)
36 #elif defined(__GNUC__)
37 # define FIELD_ALIGNMENT(type, field) __alignof__(((type*)0)->field)
39 /* FIXME: Not sure if is possible to do without compiler extension */
42 #if (_MSC_VER >= 1300) && defined(__cplusplus)
43 # define _TYPE_ALIGNMENT(type) __alignof(type)
44 #elif defined(__GNUC__)
45 # define _TYPE_ALIGNMENT(type) __alignof__(type)
48 * FIXME: Not sure if is possible to do without compiler extension
49 * (if type is not just a name that is, if so the normal)
50 * TYPE_ALIGNMENT can be used)
54 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
55 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
58 /***********************************************************************
62 #ifdef FIELD_ALIGNMENT
63 # define TEST_FIELD_ALIGNMENT(type, field, align) \
64 ok(FIELD_ALIGNMENT(type, field) == align, \
65 "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")", \
66 FIELD_ALIGNMENT(type, field))
68 # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
71 #define TEST_FIELD_OFFSET(type, field, offset) \
72 ok(FIELD_OFFSET(type, field) == offset, \
73 "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")", \
74 FIELD_OFFSET(type, field))
76 #ifdef _TYPE_ALIGNMENT
77 #define TEST__TYPE_ALIGNMENT(type, align) \
78 ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")", _TYPE_ALIGNMENT(type))
80 # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
84 #define TEST_TYPE_ALIGNMENT(type, align) \
85 ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")", TYPE_ALIGNMENT(type))
87 # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
90 #define TEST_TYPE_SIZE(type, size) \
91 ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")", sizeof(type))
93 /***********************************************************************
97 #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
98 TEST_TYPE_SIZE(field_type, field_size); \
99 TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
100 TEST_FIELD_OFFSET(type, field_name, field_offset); \
102 #define TEST_TYPE(type, size, align) \
103 TEST_TYPE_ALIGNMENT(type, align); \
104 TEST_TYPE_SIZE(type, size)
106 #define TEST_TYPE_POINTER(type, size, align) \
107 TEST__TYPE_ALIGNMENT(*(type)0, align); \
108 TEST_TYPE_SIZE(*(type)0, size)
110 #define TEST_TYPE_SIGNED(type) \
111 ok((type) -1 < 0, "(" #type ") -1 < 0");
113 #define TEST_TYPE_UNSIGNED(type) \
114 ok((type) -1 > 0, "(" #type ") -1 > 0");
116 static void test_pack_BINDINFO(void)
118 /* BINDINFO (pack 4) */
119 TEST_FIELD(BINDINFO
, ULONG
, cbSize
, 0, 4, 4);
120 TEST_FIELD(BINDINFO
, LPWSTR
, szExtraInfo
, 4, 4, 4);
123 static void test_pack_IBindHost(void)
128 static void test_pack_IBindStatusCallback(void)
130 /* IBindStatusCallback */
133 static void test_pack_IBinding(void)
138 static void test_pack_IWinInetHttpInfo(void)
140 /* IWinInetHttpInfo */
143 static void test_pack_IWinInetInfo(void)
148 static void test_pack(void)
150 test_pack_BINDINFO();
151 test_pack_IBindHost();
152 test_pack_IBindStatusCallback();
153 test_pack_IBinding();
154 test_pack_IWinInetHttpInfo();
155 test_pack_IWinInetInfo();
158 START_TEST(generated
)