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
17 #include "wine/test.h"
19 /***********************************************************************
23 #define DWORD_PTR UINT_PTR
24 #define LONG_PTR INT_PTR
25 #define ULONG_PTR UINT_PTR
27 /***********************************************************************
28 * Windows API extension
31 #if (_MSC_VER >= 1300) && defined(__cplusplus)
32 # define FIELD_ALIGNMENT(type, field) __alignof(((type*)0)->field)
33 #elif defined(__GNUC__)
34 # define FIELD_ALIGNMENT(type, field) __alignof__(((type*)0)->field)
36 /* FIXME: Not sure if is possible to do without compiler extension */
39 #if (_MSC_VER >= 1300) && defined(__cplusplus)
40 # define _TYPE_ALIGNMENT(type) __alignof(type)
41 #elif defined(__GNUC__)
42 # define _TYPE_ALIGNMENT(type) __alignof__(type)
45 * FIXME: Not sure if is possible to do without compiler extension
46 * (if type is not just a name that is, if so the normal)
47 * TYPE_ALIGNMENT can be used)
51 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
52 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
55 /***********************************************************************
59 #ifdef FIELD_ALIGNMENT
60 # define TEST_FIELD_ALIGNMENT(type, field, align) \
61 ok(FIELD_ALIGNMENT(type, field) == align, \
62 "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")", \
63 FIELD_ALIGNMENT(type, field))
65 # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
68 #define TEST_FIELD_OFFSET(type, field, offset) \
69 ok(FIELD_OFFSET(type, field) == offset, \
70 "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")", \
71 FIELD_OFFSET(type, field))
73 #ifdef _TYPE_ALIGNMENT
74 #define TEST__TYPE_ALIGNMENT(type, align) \
75 ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")", _TYPE_ALIGNMENT(type))
77 # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
81 #define TEST_TYPE_ALIGNMENT(type, align) \
82 ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")", TYPE_ALIGNMENT(type))
84 # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
87 #define TEST_TYPE_SIZE(type, size) \
88 ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")", sizeof(type))
90 /***********************************************************************
94 #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
95 TEST_TYPE_SIZE(field_type, field_size); \
96 TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
97 TEST_FIELD_OFFSET(type, field_name, field_offset); \
99 #define TEST_TYPE(type, size, align) \
100 TEST_TYPE_ALIGNMENT(type, align); \
101 TEST_TYPE_SIZE(type, size)
103 #define TEST_TYPE_POINTER(type, size, align) \
104 TEST__TYPE_ALIGNMENT(*(type)0, align); \
105 TEST_TYPE_SIZE(*(type)0, size)
107 #define TEST_TYPE_SIGNED(type) \
108 ok((type) -1 < 0, "(" #type ") -1 < 0");
110 #define TEST_TYPE_UNSIGNED(type) \
111 ok((type) -1 > 0, "(" #type ") -1 > 0");
113 static void test_pack_BINDINFO(void)
115 /* BINDINFO (pack 4) */
116 TEST_FIELD(BINDINFO, ULONG, cbSize, 0, 4, 4);
117 TEST_FIELD(BINDINFO, LPWSTR, szExtraInfo, 4, 4, 4);
120 static void test_pack_IBindHost(void)
125 static void test_pack_IBindStatusCallback(void)
127 /* IBindStatusCallback */
130 static void test_pack_IBinding(void)
135 static void test_pack_IWinInetHttpInfo(void)
137 /* IWinInetHttpInfo */
140 static void test_pack_IWinInetInfo(void)
145 static void test_pack(void)
147 test_pack_BINDINFO();
148 test_pack_IBindHost();
149 test_pack_IBindStatusCallback();
150 test_pack_IBinding();
151 test_pack_IWinInetHttpInfo();
152 test_pack_IWinInetInfo();
155 START_TEST(generated)