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
19 #include "wine/test.h"
21 /***********************************************************************
25 #define DWORD_PTR UINT_PTR
26 #define LONG_PTR INT_PTR
27 #define ULONG_PTR UINT_PTR
29 /***********************************************************************
30 * Windows API extension
33 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
34 # define FIELD_ALIGNMENT(type, field) __alignof(((type*)0)->field)
35 #elif defined(__GNUC__)
36 # define FIELD_ALIGNMENT(type, field) __alignof__(((type*)0)->field)
38 /* FIXME: Not sure if is possible to do without compiler extension */
41 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
42 # define _TYPE_ALIGNMENT(type) __alignof(type)
43 #elif defined(__GNUC__)
44 # define _TYPE_ALIGNMENT(type) __alignof__(type)
47 * FIXME: Not sure if is possible to do without compiler extension
48 * (if type is not just a name that is, if so the normal)
49 * TYPE_ALIGNMENT can be used)
53 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
54 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
57 /***********************************************************************
61 #ifdef FIELD_ALIGNMENT
62 # define TEST_FIELD_ALIGNMENT(type, field, align) \
63 ok(FIELD_ALIGNMENT(type, field) == align, \
64 "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
65 FIELD_ALIGNMENT(type, field))
67 # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
70 #define TEST_FIELD_OFFSET(type, field, offset) \
71 ok(FIELD_OFFSET(type, field) == offset, \
72 "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
73 FIELD_OFFSET(type, field))
75 #ifdef _TYPE_ALIGNMENT
76 #define TEST__TYPE_ALIGNMENT(type, align) \
77 ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", _TYPE_ALIGNMENT(type))
79 # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
83 #define TEST_TYPE_ALIGNMENT(type, align) \
84 ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", TYPE_ALIGNMENT(type))
86 # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
89 #define TEST_TYPE_SIZE(type, size) \
90 ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", sizeof(type))
92 /***********************************************************************
96 #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
97 TEST_TYPE_SIZE(field_type, field_size); \
98 TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
99 TEST_FIELD_OFFSET(type, field_name, field_offset); \
101 #define TEST_TYPE(type, size, align) \
102 TEST_TYPE_ALIGNMENT(type, align); \
103 TEST_TYPE_SIZE(type, size)
105 #define TEST_TYPE_POINTER(type, size, align) \
106 TEST__TYPE_ALIGNMENT(*(type)0, align); \
107 TEST_TYPE_SIZE(*(type)0, size)
109 #define TEST_TYPE_SIGNED(type) \
110 ok((type) -1 < 0, "(" #type ") -1 < 0\n");
112 #define TEST_TYPE_UNSIGNED(type) \
113 ok((type) -1 > 0, "(" #type ") -1 > 0\n");
115 static void test_pack_BINDINFO(void)
117 /* BINDINFO (pack 4) */
118 TEST_FIELD(BINDINFO, ULONG, cbSize, 0, 4, 4);
119 TEST_FIELD(BINDINFO, LPWSTR, szExtraInfo, 4, 4, 4);
122 static void test_pack_IBindHost(void)
127 static void test_pack_IBindStatusCallback(void)
129 /* IBindStatusCallback */
132 static void test_pack_IBinding(void)
137 static void test_pack_IWinInetHttpInfo(void)
139 /* IWinInetHttpInfo */
142 static void test_pack_IWinInetInfo(void)
147 static void test_pack(void)
149 test_pack_BINDINFO();
150 test_pack_IBindHost();
151 test_pack_IBindStatusCallback();
152 test_pack_IBinding();
153 test_pack_IWinInetHttpInfo();
154 test_pack_IWinInetInfo();
157 START_TEST(generated)