comctl32: Remove redundant parameter from a helper.
[wine/multimedia.git] / dlls / msvcrt / tests / headers.c
blob7c102b4c3199edd3a008f7814598ed38c16e540a
1 /*
2 * Copyright 2004 Dimitrie O. Paun
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 * This file contains tests to ensure the consistency between symbols
19 * defined in the regular msvcrt headers, and the corresponding duplicated
20 * symbols defined in msvcrt.h (prefixed by MSVCRT_).
23 #include "dos.h"
24 #include "math.h"
25 #include "stdlib.h"
26 #include "io.h"
27 #include "errno.h"
28 #include "fcntl.h"
29 #include "malloc.h"
30 #include "limits.h"
31 #include "mbctype.h"
32 #include "stdio.h"
33 #include "wchar.h"
34 #include "ctype.h"
35 #include "crtdbg.h"
36 #include "share.h"
37 #include "search.h"
38 #include "wctype.h"
39 #include "float.h"
40 #include "stddef.h"
41 #include "mbstring.h"
42 #include "sys/locking.h"
43 #include "sys/utime.h"
44 #include "sys/types.h"
45 #include "sys/stat.h"
46 #include "sys/timeb.h"
47 #include "direct.h"
48 #include "conio.h"
49 #include "process.h"
50 #include "string.h"
51 #include "signal.h"
52 #include "time.h"
53 #include "locale.h"
54 #include "setjmp.h"
55 #include "wine/test.h"
57 #ifdef __WINE_USE_MSVCRT
58 /* Wine-specific msvcrt headers */
59 #define __WINE_MSVCRT_TEST
60 #include "eh.h"
61 #include "msvcrt.h"
63 #ifdef __GNUC__
64 #define TYPEOF(type) typeof(type)
65 #else
66 #define TYPEOF(type) int
67 #endif
68 #define MSVCRT(x) MSVCRT_##x
69 #define OFFSET(T,F) ((unsigned int)((char *)&((struct T *)0L)->F - (char *)0L))
70 #define CHECK_SIZE(e) ok(sizeof(e) == sizeof(MSVCRT(e)), "Element has different sizes\n")
71 #define CHECK_TYPE(t) { TYPEOF(t) a = 0; TYPEOF(MSVCRT(t)) b = a; a = b; CHECK_SIZE(t); }
72 #define CHECK_STRUCT(s) ok(sizeof(struct s) == sizeof(struct MSVCRT(s)), "Struct has different sizes\n")
73 #define CHECK_FIELD(s,e) ok(OFFSET(s,e) == OFFSET(MSVCRT(s),e), "Bad offset\n")
74 #define CHECK_DEF(d) ok(d == MSVCRT_##d, "Defines (MSVCRT_)" #d " are different: %d vs. %d\n", d, MSVCRT_##d)
76 /************* Checking types ***************/
77 static void test_types(void)
79 CHECK_TYPE(wchar_t);
80 CHECK_TYPE(wint_t);
81 CHECK_TYPE(wctype_t);
82 CHECK_TYPE(_ino_t);
83 CHECK_TYPE(_fsize_t);
84 CHECK_TYPE(size_t);
85 CHECK_TYPE(intptr_t);
86 CHECK_TYPE(uintptr_t);
87 CHECK_TYPE(_dev_t);
88 CHECK_TYPE(_off_t);
89 CHECK_TYPE(clock_t);
90 CHECK_TYPE(__time32_t);
91 CHECK_TYPE(__time64_t);
92 CHECK_TYPE(fpos_t);
93 CHECK_SIZE(FILE);
94 CHECK_TYPE(terminate_handler);
95 CHECK_TYPE(terminate_function);
96 CHECK_TYPE(unexpected_handler);
97 CHECK_TYPE(unexpected_function);
98 CHECK_TYPE(_se_translator_function);
99 CHECK_TYPE(_beginthread_start_routine_t);
100 CHECK_TYPE(_onexit_t);
101 CHECK_TYPE(__sighandler_t);
104 /************* Checking structs ***************/
105 static void test_structs(void)
107 CHECK_STRUCT(tm);
108 CHECK_FIELD(tm, tm_sec);
109 CHECK_FIELD(tm, tm_min);
110 CHECK_FIELD(tm, tm_hour);
111 CHECK_FIELD(tm, tm_mday);
112 CHECK_FIELD(tm, tm_mon);
113 CHECK_FIELD(tm, tm_year);
114 CHECK_FIELD(tm, tm_wday);
115 CHECK_FIELD(tm, tm_yday);
116 CHECK_FIELD(tm, tm_isdst);
117 CHECK_STRUCT(__timeb32);
118 CHECK_FIELD(__timeb32, time);
119 CHECK_FIELD(__timeb32, millitm);
120 CHECK_FIELD(__timeb32, timezone);
121 CHECK_FIELD(__timeb32, dstflag);
122 CHECK_STRUCT(__timeb64);
123 CHECK_FIELD(__timeb64, time);
124 CHECK_FIELD(__timeb64, millitm);
125 CHECK_FIELD(__timeb64, timezone);
126 CHECK_FIELD(__timeb64, dstflag);
127 CHECK_STRUCT(_iobuf);
128 CHECK_FIELD(_iobuf, _ptr);
129 CHECK_FIELD(_iobuf, _cnt);
130 CHECK_FIELD(_iobuf, _base);
131 CHECK_FIELD(_iobuf, _flag);
132 CHECK_FIELD(_iobuf, _file);
133 CHECK_FIELD(_iobuf, _charbuf);
134 CHECK_FIELD(_iobuf, _bufsiz);
135 CHECK_FIELD(_iobuf, _tmpfname);
136 CHECK_STRUCT(lconv);
137 CHECK_FIELD(lconv, decimal_point);
138 CHECK_FIELD(lconv, thousands_sep);
139 CHECK_FIELD(lconv, grouping);
140 CHECK_FIELD(lconv, int_curr_symbol);
141 CHECK_FIELD(lconv, currency_symbol);
142 CHECK_FIELD(lconv, mon_decimal_point);
143 CHECK_FIELD(lconv, mon_thousands_sep);
144 CHECK_FIELD(lconv, mon_grouping);
145 CHECK_FIELD(lconv, positive_sign);
146 CHECK_FIELD(lconv, negative_sign);
147 CHECK_FIELD(lconv, int_frac_digits);
148 CHECK_FIELD(lconv, frac_digits);
149 CHECK_FIELD(lconv, p_cs_precedes);
150 CHECK_FIELD(lconv, p_sep_by_space);
151 CHECK_FIELD(lconv, n_cs_precedes);
152 CHECK_FIELD(lconv, n_sep_by_space);
153 CHECK_FIELD(lconv, p_sign_posn);
154 CHECK_FIELD(lconv, n_sign_posn);
155 CHECK_STRUCT(_exception);
156 CHECK_FIELD(_exception, type);
157 CHECK_FIELD(_exception, name);
158 CHECK_FIELD(_exception, arg1);
159 CHECK_FIELD(_exception, arg2);
160 CHECK_FIELD(_exception, retval);
161 CHECK_STRUCT(_complex);
162 CHECK_FIELD(_complex, x);
163 CHECK_FIELD(_complex, y);
164 CHECK_STRUCT(_div_t);
165 CHECK_FIELD(_div_t, quot);
166 CHECK_FIELD(_div_t, rem);
167 CHECK_STRUCT(_ldiv_t);
168 CHECK_FIELD(_ldiv_t, quot);
169 CHECK_FIELD(_ldiv_t, rem);
170 CHECK_STRUCT(_heapinfo);
171 CHECK_FIELD(_heapinfo, _pentry);
172 CHECK_FIELD(_heapinfo, _size);
173 CHECK_FIELD(_heapinfo, _useflag);
174 #ifdef __i386__
175 CHECK_STRUCT(__JUMP_BUFFER);
176 CHECK_FIELD(__JUMP_BUFFER, Ebp);
177 CHECK_FIELD(__JUMP_BUFFER, Ebx);
178 CHECK_FIELD(__JUMP_BUFFER, Edi);
179 CHECK_FIELD(__JUMP_BUFFER, Esi);
180 CHECK_FIELD(__JUMP_BUFFER, Esp);
181 CHECK_FIELD(__JUMP_BUFFER, Eip);
182 CHECK_FIELD(__JUMP_BUFFER, Registration);
183 CHECK_FIELD(__JUMP_BUFFER, TryLevel);
184 CHECK_FIELD(__JUMP_BUFFER, Cookie);
185 CHECK_FIELD(__JUMP_BUFFER, UnwindFunc);
186 CHECK_FIELD(__JUMP_BUFFER, UnwindData[6]);
187 #endif
188 CHECK_STRUCT(_diskfree_t);
189 CHECK_FIELD(_diskfree_t, total_clusters);
190 CHECK_FIELD(_diskfree_t, avail_clusters);
191 CHECK_FIELD(_diskfree_t, sectors_per_cluster);
192 CHECK_FIELD(_diskfree_t, bytes_per_sector);
193 CHECK_STRUCT(_finddata_t);
194 CHECK_FIELD(_finddata_t, attrib);
195 CHECK_FIELD(_finddata_t, time_create);
196 CHECK_FIELD(_finddata_t, time_access);
197 CHECK_FIELD(_finddata_t, time_write);
198 CHECK_FIELD(_finddata_t, size);
199 CHECK_FIELD(_finddata_t, name[260]);
200 CHECK_STRUCT(_finddatai64_t);
201 CHECK_FIELD(_finddatai64_t, attrib);
202 CHECK_FIELD(_finddatai64_t, time_create);
203 CHECK_FIELD(_finddatai64_t, time_access);
204 CHECK_FIELD(_finddatai64_t, time_write);
205 CHECK_FIELD(_finddatai64_t, size);
206 CHECK_FIELD(_finddatai64_t, name[260]);
207 CHECK_STRUCT(_wfinddata_t);
208 CHECK_FIELD(_wfinddata_t, attrib);
209 CHECK_FIELD(_wfinddata_t, time_create);
210 CHECK_FIELD(_wfinddata_t, time_access);
211 CHECK_FIELD(_wfinddata_t, time_write);
212 CHECK_FIELD(_wfinddata_t, size);
213 CHECK_FIELD(_wfinddata_t, name[260]);
214 CHECK_STRUCT(_wfinddatai64_t);
215 CHECK_FIELD(_wfinddatai64_t, attrib);
216 CHECK_FIELD(_wfinddatai64_t, time_create);
217 CHECK_FIELD(_wfinddatai64_t, time_access);
218 CHECK_FIELD(_wfinddatai64_t, time_write);
219 CHECK_FIELD(_wfinddatai64_t, size);
220 CHECK_FIELD(_wfinddatai64_t, name[260]);
221 CHECK_STRUCT(__utimbuf32);
222 CHECK_FIELD(__utimbuf32, actime);
223 CHECK_FIELD(__utimbuf32, modtime);
224 CHECK_STRUCT(__utimbuf64);
225 CHECK_FIELD(__utimbuf64, actime);
226 CHECK_FIELD(__utimbuf64, modtime);
227 CHECK_STRUCT(_stat);
228 CHECK_FIELD(_stat, st_dev);
229 CHECK_FIELD(_stat, st_ino);
230 CHECK_FIELD(_stat, st_mode);
231 CHECK_FIELD(_stat, st_nlink);
232 CHECK_FIELD(_stat, st_uid);
233 CHECK_FIELD(_stat, st_gid);
234 CHECK_FIELD(_stat, st_rdev);
235 CHECK_FIELD(_stat, st_size);
236 CHECK_FIELD(_stat, st_atime);
237 CHECK_FIELD(_stat, st_mtime);
238 CHECK_FIELD(_stat, st_ctime);
239 CHECK_STRUCT(_stati64);
240 CHECK_FIELD(_stati64, st_dev);
241 CHECK_FIELD(_stati64, st_ino);
242 CHECK_FIELD(_stati64, st_mode);
243 CHECK_FIELD(_stati64, st_nlink);
244 CHECK_FIELD(_stati64, st_uid);
245 CHECK_FIELD(_stati64, st_gid);
246 CHECK_FIELD(_stati64, st_rdev);
247 CHECK_FIELD(_stati64, st_size);
248 CHECK_FIELD(_stati64, st_atime);
249 CHECK_FIELD(_stati64, st_mtime);
250 CHECK_FIELD(_stati64, st_ctime);
251 CHECK_STRUCT(_stat64);
252 CHECK_FIELD(_stat64, st_dev);
253 CHECK_FIELD(_stat64, st_ino);
254 CHECK_FIELD(_stat64, st_mode);
255 CHECK_FIELD(_stat64, st_nlink);
256 CHECK_FIELD(_stat64, st_uid);
257 CHECK_FIELD(_stat64, st_gid);
258 CHECK_FIELD(_stat64, st_rdev);
259 CHECK_FIELD(_stat64, st_size);
260 CHECK_FIELD(_stat64, st_atime);
261 CHECK_FIELD(_stat64, st_mtime);
262 CHECK_FIELD(_stat64, st_ctime);
263 CHECK_SIZE(_CRT_FLOAT);
266 /************* Checking defines ***************/
267 static void test_defines(void)
269 CHECK_DEF(WEOF);
270 CHECK_DEF(EOF);
271 CHECK_DEF(TMP_MAX);
272 CHECK_DEF(RAND_MAX);
273 CHECK_DEF(BUFSIZ);
274 CHECK_DEF(STDIN_FILENO);
275 CHECK_DEF(STDOUT_FILENO);
276 CHECK_DEF(STDERR_FILENO);
277 CHECK_DEF(_IOFBF);
278 CHECK_DEF(_IONBF);
279 CHECK_DEF(_IOLBF);
280 CHECK_DEF(FILENAME_MAX);
281 CHECK_DEF(_P_WAIT);
282 CHECK_DEF(_P_NOWAIT);
283 CHECK_DEF(_P_OVERLAY);
284 CHECK_DEF(_P_NOWAITO);
285 CHECK_DEF(_P_DETACH);
286 CHECK_DEF(EPERM);
287 CHECK_DEF(ENOENT);
288 CHECK_DEF(ESRCH);
289 CHECK_DEF(EINTR);
290 CHECK_DEF(EIO);
291 CHECK_DEF(ENXIO);
292 CHECK_DEF(E2BIG);
293 CHECK_DEF(ENOEXEC);
294 CHECK_DEF(EBADF);
295 CHECK_DEF(ECHILD);
296 CHECK_DEF(EAGAIN);
297 CHECK_DEF(ENOMEM);
298 CHECK_DEF(EACCES);
299 CHECK_DEF(EFAULT);
300 CHECK_DEF(EBUSY);
301 CHECK_DEF(EEXIST);
302 CHECK_DEF(EXDEV);
303 CHECK_DEF(ENODEV);
304 CHECK_DEF(ENOTDIR);
305 CHECK_DEF(EISDIR);
306 CHECK_DEF(EINVAL);
307 CHECK_DEF(ENFILE);
308 CHECK_DEF(EMFILE);
309 CHECK_DEF(ENOTTY);
310 CHECK_DEF(EFBIG);
311 CHECK_DEF(ENOSPC);
312 CHECK_DEF(ESPIPE);
313 CHECK_DEF(EROFS);
314 CHECK_DEF(EMLINK);
315 CHECK_DEF(EPIPE);
316 CHECK_DEF(EDOM);
317 CHECK_DEF(ERANGE);
318 CHECK_DEF(EDEADLK);
319 CHECK_DEF(EDEADLOCK);
320 CHECK_DEF(ENAMETOOLONG);
321 CHECK_DEF(ENOLCK);
322 CHECK_DEF(ENOSYS);
323 CHECK_DEF(ENOTEMPTY);
324 CHECK_DEF(EILSEQ);
325 CHECK_DEF(LC_ALL);
326 CHECK_DEF(LC_COLLATE);
327 CHECK_DEF(LC_CTYPE);
328 CHECK_DEF(LC_MONETARY);
329 CHECK_DEF(LC_NUMERIC);
330 CHECK_DEF(LC_TIME);
331 CHECK_DEF(LC_MIN);
332 CHECK_DEF(LC_MAX);
333 CHECK_DEF(CLOCKS_PER_SEC);
334 CHECK_DEF(_HEAPEMPTY);
335 CHECK_DEF(_HEAPOK);
336 CHECK_DEF(_HEAPBADBEGIN);
337 CHECK_DEF(_HEAPBADNODE);
338 CHECK_DEF(_HEAPEND);
339 CHECK_DEF(_HEAPBADPTR);
340 CHECK_DEF(_FREEENTRY);
341 CHECK_DEF(_USEDENTRY);
342 CHECK_DEF(_OUT_TO_DEFAULT);
343 CHECK_DEF(_OUT_TO_STDERR);
344 CHECK_DEF(_OUT_TO_MSGBOX);
345 CHECK_DEF(_REPORT_ERRMODE);
346 CHECK_DEF(_UPPER);
347 CHECK_DEF(_LOWER);
348 CHECK_DEF(_DIGIT);
349 CHECK_DEF(_SPACE);
350 CHECK_DEF(_PUNCT);
351 CHECK_DEF(_CONTROL);
352 CHECK_DEF(_BLANK);
353 CHECK_DEF(_HEX);
354 CHECK_DEF(_LEADBYTE);
355 CHECK_DEF(_ALPHA);
356 CHECK_DEF(_IOREAD);
357 CHECK_DEF(_IOWRT);
358 CHECK_DEF(_IOMYBUF);
359 CHECK_DEF(_IOEOF);
360 CHECK_DEF(_IOERR);
361 CHECK_DEF(_IOSTRG);
362 CHECK_DEF(_IORW);
363 CHECK_DEF(_S_IEXEC);
364 CHECK_DEF(_S_IWRITE);
365 CHECK_DEF(_S_IREAD);
366 CHECK_DEF(_S_IFIFO);
367 CHECK_DEF(_S_IFCHR);
368 CHECK_DEF(_S_IFDIR);
369 CHECK_DEF(_S_IFREG);
370 CHECK_DEF(_S_IFMT);
371 CHECK_DEF(_LK_UNLCK);
372 CHECK_DEF(_LK_LOCK);
373 CHECK_DEF(_LK_NBLCK);
374 CHECK_DEF(_LK_RLCK);
375 CHECK_DEF(_LK_NBRLCK);
376 CHECK_DEF(_O_RDONLY);
377 CHECK_DEF(_O_WRONLY);
378 CHECK_DEF(_O_RDWR);
379 CHECK_DEF(_O_ACCMODE);
380 CHECK_DEF(_O_APPEND);
381 CHECK_DEF(_O_RANDOM);
382 CHECK_DEF(_O_SEQUENTIAL);
383 CHECK_DEF(_O_TEMPORARY);
384 CHECK_DEF(_O_NOINHERIT);
385 CHECK_DEF(_O_CREAT);
386 CHECK_DEF(_O_TRUNC);
387 CHECK_DEF(_O_EXCL);
388 CHECK_DEF(_O_SHORT_LIVED);
389 CHECK_DEF(_O_TEXT);
390 CHECK_DEF(_O_BINARY);
391 CHECK_DEF(_O_RAW);
392 CHECK_DEF(_SW_INEXACT);
393 CHECK_DEF(_SW_UNDERFLOW);
394 CHECK_DEF(_SW_OVERFLOW);
395 CHECK_DEF(_SW_ZERODIVIDE);
396 CHECK_DEF(_SW_INVALID);
397 CHECK_DEF(_SW_UNEMULATED);
398 CHECK_DEF(_SW_SQRTNEG);
399 CHECK_DEF(_SW_STACKOVERFLOW);
400 CHECK_DEF(_SW_STACKUNDERFLOW);
401 CHECK_DEF(_SW_DENORMAL);
402 CHECK_DEF(_FPCLASS_SNAN);
403 CHECK_DEF(_FPCLASS_QNAN);
404 CHECK_DEF(_FPCLASS_NINF);
405 CHECK_DEF(_FPCLASS_NN);
406 CHECK_DEF(_FPCLASS_ND);
407 CHECK_DEF(_FPCLASS_NZ);
408 CHECK_DEF(_FPCLASS_PZ);
409 CHECK_DEF(_FPCLASS_PD);
410 CHECK_DEF(_FPCLASS_PN);
411 CHECK_DEF(_FPCLASS_PINF);
412 CHECK_DEF(SIGINT);
413 CHECK_DEF(SIGILL);
414 CHECK_DEF(SIGFPE);
415 CHECK_DEF(SIGSEGV);
416 CHECK_DEF(SIGTERM);
417 CHECK_DEF(SIGBREAK);
418 CHECK_DEF(SIGABRT);
419 CHECK_DEF(NSIG);
420 CHECK_DEF(_FPE_INVALID);
421 CHECK_DEF(_FPE_DENORMAL);
422 CHECK_DEF(_FPE_ZERODIVIDE);
423 CHECK_DEF(_FPE_OVERFLOW);
424 CHECK_DEF(_FPE_UNDERFLOW);
425 CHECK_DEF(_FPE_INEXACT);
426 CHECK_DEF(_FPE_UNEMULATED);
427 CHECK_DEF(_FPE_SQRTNEG);
428 CHECK_DEF(_FPE_STACKOVERFLOW);
429 CHECK_DEF(_FPE_STACKUNDERFLOW);
430 CHECK_DEF(_FPE_EXPLICITGEN);
431 CHECK_DEF(_MCW_EM);
432 CHECK_DEF(_MCW_IC);
433 CHECK_DEF(_MCW_RC);
434 CHECK_DEF(_MCW_PC);
435 CHECK_DEF(_MCW_DN);
436 CHECK_DEF(_EM_INVALID);
437 CHECK_DEF(_EM_DENORMAL);
438 CHECK_DEF(_EM_ZERODIVIDE);
439 CHECK_DEF(_EM_OVERFLOW);
440 CHECK_DEF(_EM_UNDERFLOW);
441 CHECK_DEF(_EM_INEXACT);
442 CHECK_DEF(_IC_AFFINE);
443 CHECK_DEF(_IC_PROJECTIVE);
444 CHECK_DEF(_RC_CHOP);
445 CHECK_DEF(_RC_UP);
446 CHECK_DEF(_RC_DOWN);
447 CHECK_DEF(_RC_NEAR);
448 CHECK_DEF(_PC_24);
449 CHECK_DEF(_PC_53);
450 CHECK_DEF(_PC_64);
451 CHECK_DEF(_DN_SAVE);
452 CHECK_DEF(_DN_FLUSH);
453 CHECK_DEF(_DN_FLUSH_OPERANDS_SAVE_RESULTS);
454 CHECK_DEF(_DN_SAVE_OPERANDS_FLUSH_RESULTS);
455 CHECK_DEF(_EM_AMBIGUOUS);
456 CHECK_DEF(_OVERFLOW);
457 CHECK_DEF(_UNDERFLOW);
458 CHECK_DEF(_WRITE_ABORT_MSG);
459 CHECK_DEF(_CALL_REPORTFAULT);
460 CHECK_DEF(_TWO_DIGIT_EXPONENT);
463 #endif /* __WINE_USE_MSVCRT */
465 START_TEST(headers)
467 #ifdef __WINE_USE_MSVCRT
468 test_types();
469 test_structs();
470 test_defines();
471 #endif