0acd10edcfdfea1c49da3400b0b38b36fd30b000
[reactos.git] / reactos / include / reactos / wine / test.h
1 /*
2 * Definitions for Wine C unit tests.
3 *
4 * Copyright (C) 2002 Alexandre Julliard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #ifndef __WINE_WINE_TEST_H
22 #define __WINE_WINE_TEST_H
23
24 #include <stdarg.h>
25 #include <stdlib.h>
26 #include <windef.h>
27 #include <winbase.h>
28
29 #ifdef __WINE_CONFIG_H
30 #error config.h should not be used in Wine tests
31 #endif
32 #ifdef __WINE_WINE_LIBRARY_H
33 #error wine/library.h should not be used in Wine tests
34 #endif
35 #ifdef __WINE_WINE_UNICODE_H
36 #error wine/unicode.h should not be used in Wine tests
37 #endif
38 #ifdef __WINE_WINE_DEBUG_H
39 #error wine/debug.h should not be used in Wine tests
40 #endif
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 #ifndef INVALID_FILE_ATTRIBUTES
47 #define INVALID_FILE_ATTRIBUTES (~0u)
48 #endif
49 #ifndef INVALID_SET_FILE_POINTER
50 #define INVALID_SET_FILE_POINTER (~0u)
51 #endif
52
53 /* debug level */
54 extern int winetest_debug;
55
56 /* running in interactive mode? */
57 extern int winetest_interactive;
58
59 /* current platform */
60 extern const char *winetest_platform;
61
62 extern void winetest_set_location( const char* file, int line );
63 extern void winetest_start_todo( const char* platform );
64 extern int winetest_loop_todo(void);
65 extern void winetest_end_todo( const char* platform );
66 extern int winetest_get_mainargs( char*** pargv );
67 extern LONG winetest_get_failures(void);
68 extern void winetest_add_failures( LONG new_failures );
69 extern void winetest_wait_child_process( HANDLE process );
70
71 extern const char *wine_dbgstr_wn( const WCHAR *str, intptr_t n );
72 extern const char *wine_dbgstr_guid( const GUID *guid );
73 static inline const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
74
75 /* strcmpW is available for tests compiled under Wine, but not in standalone
76 * builds under Windows, so we reimplement it under a different name. */
77 static inline int winetest_strcmpW( const WCHAR *str1, const WCHAR *str2 )
78 {
79 while (*str1 && (*str1 == *str2)) { str1++; str2++; }
80 return *str1 - *str2;
81 }
82
83 #ifdef STANDALONE
84
85 #define START_TEST(name) \
86 static void func_##name(void); \
87 const struct test winetest_testlist[] = { { #name, func_##name }, { 0, 0 } }; \
88 static void func_##name(void)
89
90 #else /* STANDALONE */
91
92 #ifdef __cplusplus
93 #define START_TEST(name) extern "C" void func_##name(void)
94 #else
95 #define START_TEST(name) void func_##name(void)
96 #endif
97
98 #endif /* STANDALONE */
99
100 #if defined(__x86_64__) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT)
101 #define __winetest_cdecl __cdecl
102 #define __winetest_va_list __builtin_ms_va_list
103 #else
104 #define __winetest_cdecl
105 #define __winetest_va_list va_list
106 #endif
107
108 extern int broken( int condition );
109 extern int winetest_vok( int condition, const char *msg, __winetest_va_list ap );
110 extern void winetest_vskip( const char *msg, __winetest_va_list ap );
111
112 #ifdef __GNUC__
113 # define WINETEST_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
114 extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... ) __attribute__((format (printf,2,3) ));
115 extern void __winetest_cdecl winetest_skip( const char *msg, ... ) __attribute__((format (printf,1,2)));
116 extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ) __attribute__((format (printf,1,2)));
117 extern void __winetest_cdecl winetest_trace( const char *msg, ... ) __attribute__((format (printf,1,2)));
118
119 #else /* __GNUC__ */
120 # define WINETEST_PRINTF_ATTR(fmt,args)
121 extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... );
122 extern void __winetest_cdecl winetest_skip( const char *msg, ... );
123 extern void __winetest_cdecl winetest_win_skip( const char *msg, ... );
124 extern void __winetest_cdecl winetest_trace( const char *msg, ... );
125
126 #endif /* __GNUC__ */
127
128 #define ok_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_ok
129 #define skip_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_skip
130 #define win_skip_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_win_skip
131 #define trace_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_trace
132
133 #define ok ok_(__FILE__, __LINE__)
134 #define skip skip_(__FILE__, __LINE__)
135 #define win_skip win_skip_(__FILE__, __LINE__)
136 #define trace trace_(__FILE__, __LINE__)
137
138 #define todo(platform) for (winetest_start_todo(platform); \
139 winetest_loop_todo(); \
140 winetest_end_todo(platform))
141
142 #define todo_ros todo("reactos")
143 #ifdef USE_WINE_TODOS
144 #define todo_wine todo_ros
145 #else
146 #define todo_wine todo("wine")
147 #endif
148
149 #ifdef USE_WINE_TODOS
150 #define todo_wine_if(is_todo) \
151 if ((is_todo) && (!strcmp(winetest_platform, "reactos"))) \
152 todo(winetest_platform)
153 #else
154 #define todo_wine_if(is_todo) \
155 if ((is_todo) && (!strcmp(winetest_platform, "wine"))) \
156 todo(winetest_platform)
157 #endif
158
159
160 #ifdef NONAMELESSUNION
161 # define U(x) (x).u
162 # define U1(x) (x).u1
163 # define U2(x) (x).u2
164 # define U3(x) (x).u3
165 # define U4(x) (x).u4
166 # define U5(x) (x).u5
167 # define U6(x) (x).u6
168 # define U7(x) (x).u7
169 # define U8(x) (x).u8
170 #else
171 # define U(x) (x)
172 # define U1(x) (x)
173 # define U2(x) (x)
174 # define U3(x) (x)
175 # define U4(x) (x)
176 # define U5(x) (x)
177 # define U6(x) (x)
178 # define U7(x) (x)
179 # define U8(x) (x)
180 #endif
181
182 #ifdef NONAMELESSSTRUCT
183 # define S(x) (x).s
184 # define S1(x) (x).s1
185 # define S2(x) (x).s2
186 # define S3(x) (x).s3
187 # define S4(x) (x).s4
188 # define S5(x) (x).s5
189 #else
190 # define S(x) (x)
191 # define S1(x) (x)
192 # define S2(x) (x)
193 # define S3(x) (x)
194 # define S4(x) (x)
195 # define S5(x) (x)
196 #endif
197
198
199 /************************************************************************/
200 /* Below is the implementation of the various functions, to be included
201 * directly into the generated testlist.c file.
202 * It is done that way so that the dlls can build the test routines with
203 * different includes or flags if needed.
204 */
205
206 #ifdef STANDALONE
207
208 #include <stdio.h>
209
210 #if defined(__x86_64__) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT)
211 # define __winetest_va_start(list,arg) __builtin_ms_va_start(list,arg)
212 # define __winetest_va_end(list) __builtin_ms_va_end(list)
213 #else
214 # define __winetest_va_start(list,arg) va_start(list,arg)
215 # define __winetest_va_end(list) va_end(list)
216 #endif
217
218 /* Define WINETEST_MSVC_IDE_FORMATTING to alter the output format winetest will use for file/line numbers.
219 This alternate format makes the file/line numbers clickable in visual studio, to directly jump to them. */
220 #if defined(WINETEST_MSVC_IDE_FORMATTING)
221 # define __winetest_file_line_prefix "%s(%d)"
222 #else
223 # define __winetest_file_line_prefix "%s:%d"
224 #endif
225
226 struct test
227 {
228 const char *name;
229 void (*func)(void);
230 };
231
232 extern const struct test winetest_testlist[];
233
234 /* debug level */
235 int winetest_debug = 1;
236
237 /* interactive mode? */
238 int winetest_interactive = 0;
239
240 /* current platform */
241 const char *winetest_platform = "windows";
242
243 /* report successful tests (BOOL) */
244 static int report_success = 0;
245
246 /* passing arguments around */
247 static int winetest_argc;
248 static char** winetest_argv;
249
250 static const struct test *current_test; /* test currently being run */
251
252 static LONG successes; /* number of successful tests */
253 static LONG failures; /* number of failures */
254 static LONG skipped; /* number of skipped test chunks */
255 static LONG todo_successes; /* number of successful tests inside todo block */
256 static LONG todo_failures; /* number of failures inside todo block */
257
258 /* The following data must be kept track of on a per-thread basis */
259 typedef struct
260 {
261 const char* current_file; /* file of current check */
262 int current_line; /* line of current check */
263 int todo_level; /* current todo nesting level */
264 int todo_do_loop;
265 char *str_pos; /* position in debug buffer */
266 char strings[2000]; /* buffer for debug strings */
267 } tls_data;
268 static DWORD tls_index;
269
270 static tls_data* get_tls_data(void)
271 {
272 tls_data* data;
273 DWORD last_error;
274
275 last_error=GetLastError();
276 data=(tls_data*)TlsGetValue(tls_index);
277 if (!data)
278 {
279 data=(tls_data*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(tls_data));
280 data->str_pos = data->strings;
281 TlsSetValue(tls_index,data);
282 }
283 SetLastError(last_error);
284 return data;
285 }
286
287 /* allocate some tmp space for a string */
288 static char *get_temp_buffer( size_t n )
289 {
290 tls_data *data = get_tls_data();
291 char *res = data->str_pos;
292
293 if (res + n >= &data->strings[sizeof(data->strings)]) res = data->strings;
294 data->str_pos = res + n;
295 return res;
296 }
297
298 /* release extra space that we requested in gimme1() */
299 static void release_temp_buffer( char *ptr, size_t size )
300 {
301 tls_data *data = get_tls_data();
302 data->str_pos = ptr + size;
303 }
304
305 static void exit_process( int code )
306 {
307 fflush( stdout );
308 ExitProcess( code );
309 }
310
311
312 void winetest_set_location( const char* file, int line )
313 {
314 tls_data* data=get_tls_data();
315 #if defined(WINETEST_MSVC_IDE_FORMATTING)
316 data->current_file = file;
317 #else
318 data->current_file=strrchr(file,'/');
319 if (data->current_file==NULL)
320 data->current_file=strrchr(file,'\\');
321 if (data->current_file==NULL)
322 data->current_file=file;
323 else
324 data->current_file++;
325 #endif
326 data->current_line=line;
327 }
328
329 int broken( int condition )
330 {
331 return ((strcmp(winetest_platform, "windows") == 0)
332 #ifndef USE_WINE_TODOS
333 || (strcmp(winetest_platform, "reactos") == 0)
334 #endif
335 ) && condition;
336 }
337
338 /*
339 * Checks condition.
340 * Parameters:
341 * - condition - condition to check;
342 * - msg test description;
343 * - file - test application source code file name of the check
344 * - line - test application source code file line number of the check
345 * Return:
346 * 0 if condition does not have the expected value, 1 otherwise
347 */
348 int winetest_vok( int condition, const char *msg, __winetest_va_list args )
349 {
350 tls_data* data=get_tls_data();
351
352 if (data->todo_level)
353 {
354 if (condition)
355 {
356 fprintf( stdout, __winetest_file_line_prefix ": Test succeeded inside todo block: ",
357 data->current_file, data->current_line );
358 vfprintf(stdout, msg, args);
359 InterlockedIncrement(&todo_failures);
360 return 0;
361 }
362 else
363 {
364 /* show todos even if traces are disabled*/
365 /*if (winetest_debug > 0)*/
366 {
367 fprintf( stdout, __winetest_file_line_prefix ": Test marked todo: ",
368 data->current_file, data->current_line );
369 vfprintf(stdout, msg, args);
370 }
371 InterlockedIncrement(&todo_successes);
372 return 1;
373 }
374 }
375 else
376 {
377 if (!condition)
378 {
379 fprintf( stdout, __winetest_file_line_prefix ": Test failed: ",
380 data->current_file, data->current_line );
381 vfprintf(stdout, msg, args);
382 InterlockedIncrement(&failures);
383 return 0;
384 }
385 else
386 {
387 if (report_success)
388 fprintf( stdout, __winetest_file_line_prefix ": Test succeeded\n",
389 data->current_file, data->current_line);
390 InterlockedIncrement(&successes);
391 return 1;
392 }
393 }
394 }
395
396 void __winetest_cdecl winetest_ok( int condition, const char *msg, ... )
397 {
398 __winetest_va_list valist;
399
400 __winetest_va_start(valist, msg);
401 winetest_vok(condition, msg, valist);
402 __winetest_va_end(valist);
403 }
404
405 void __winetest_cdecl winetest_trace( const char *msg, ... )
406 {
407 __winetest_va_list valist;
408 tls_data* data=get_tls_data();
409
410 if (winetest_debug > 0)
411 {
412 fprintf( stdout, __winetest_file_line_prefix ": ", data->current_file, data->current_line );
413 __winetest_va_start(valist, msg);
414 vfprintf(stdout, msg, valist);
415 __winetest_va_end(valist);
416 }
417 }
418
419 void winetest_vskip( const char *msg, __winetest_va_list args )
420 {
421 tls_data* data=get_tls_data();
422
423 fprintf( stdout, __winetest_file_line_prefix ": Tests skipped: ", data->current_file, data->current_line );
424 vfprintf(stdout, msg, args);
425 skipped++;
426 }
427
428 void __winetest_cdecl winetest_skip( const char *msg, ... )
429 {
430 __winetest_va_list valist;
431 __winetest_va_start(valist, msg);
432 winetest_vskip(msg, valist);
433 __winetest_va_end(valist);
434 }
435
436 void __winetest_cdecl winetest_win_skip( const char *msg, ... )
437 {
438 __winetest_va_list valist;
439 __winetest_va_start(valist, msg);
440 if ((strcmp(winetest_platform, "windows") == 0)
441 #ifndef USE_WINE_TODOS
442 || (strcmp(winetest_platform, "reactos") == 0)
443 #endif
444 )
445 winetest_vskip(msg, valist);
446 else
447 winetest_vok(0, msg, valist);
448 __winetest_va_end(valist);
449 }
450
451 void winetest_start_todo( const char* platform )
452 {
453 tls_data* data=get_tls_data();
454 if (strcmp(winetest_platform,platform)==0)
455 data->todo_level++;
456 data->todo_do_loop=1;
457 }
458
459 int winetest_loop_todo(void)
460 {
461 tls_data* data=get_tls_data();
462 int do_loop=data->todo_do_loop;
463 data->todo_do_loop=0;
464 return do_loop;
465 }
466
467 void winetest_end_todo( const char* platform )
468 {
469 if (strcmp(winetest_platform,platform)==0)
470 {
471 tls_data* data=get_tls_data();
472 data->todo_level--;
473 }
474 }
475
476 int winetest_get_mainargs( char*** pargv )
477 {
478 *pargv = winetest_argv;
479 return winetest_argc;
480 }
481
482 LONG winetest_get_failures(void)
483 {
484 return failures;
485 }
486
487 void winetest_add_failures( LONG new_failures )
488 {
489 while (new_failures-- > 0)
490 InterlockedIncrement( &failures );
491 }
492
493 void winetest_wait_child_process( HANDLE process )
494 {
495 DWORD exit_code = 1;
496
497 if (WaitForSingleObject( process, 30000 ))
498 fprintf( stdout, "%s: child process wait failed\n", current_test->name );
499 else
500 GetExitCodeProcess( process, &exit_code );
501
502 if (exit_code)
503 {
504 if (exit_code > 255)
505 {
506 fprintf( stdout, "%s: exception 0x%08x in child process\n", current_test->name, (unsigned)exit_code );
507 InterlockedIncrement( &failures );
508 }
509 else
510 {
511 fprintf( stdout, "%s: %u failures in child process\n",
512 current_test->name, (unsigned)exit_code );
513 while (exit_code-- > 0)
514 InterlockedIncrement(&failures);
515 }
516 }
517 }
518
519 const char *wine_dbgstr_wn( const WCHAR *str, intptr_t n )
520 {
521 char *dst, *res;
522 size_t size;
523
524 if (!((ULONG_PTR)str >> 16))
525 {
526 if (!str) return "(null)";
527 res = get_temp_buffer( 6 );
528 sprintf( res, "#%04x", LOWORD(str) );
529 return res;
530 }
531 if (n == -1)
532 {
533 const WCHAR *end = str;
534 while (*end) end++;
535 n = end - str;
536 }
537 if (n < 0) n = 0;
538 size = 12 + min( 300, n * 5 );
539 dst = res = get_temp_buffer( size );
540 *dst++ = 'L';
541 *dst++ = '"';
542 while (n-- > 0 && dst <= res + size - 10)
543 {
544 WCHAR c = *str++;
545 switch (c)
546 {
547 case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
548 case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
549 case '\t': *dst++ = '\\'; *dst++ = 't'; break;
550 case '"': *dst++ = '\\'; *dst++ = '"'; break;
551 case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
552 default:
553 if (c >= ' ' && c <= 126)
554 *dst++ = (char)c;
555 else
556 {
557 *dst++ = '\\';
558 sprintf(dst,"%04x",c);
559 dst+=4;
560 }
561 }
562 }
563 *dst++ = '"';
564 if (n > 0)
565 {
566 *dst++ = '.';
567 *dst++ = '.';
568 *dst++ = '.';
569 }
570 *dst++ = 0;
571 release_temp_buffer( res, dst - res );
572 return res;
573 }
574
575 const char *wine_dbgstr_guid( const GUID *guid )
576 {
577 char *res;
578
579 if (!guid) return "(null)";
580 res = get_temp_buffer( 39 ); /* CHARS_IN_GUID */
581 sprintf( res, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
582 guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
583 guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
584 guid->Data4[5], guid->Data4[6], guid->Data4[7] );
585 return res;
586 }
587
588 /* Find a test by name */
589 static const struct test *find_test( const char *name )
590 {
591 const struct test *test;
592 const char *p;
593 size_t len;
594
595 if ((p = strrchr( name, '/' ))) name = p + 1;
596 if ((p = strrchr( name, '\\' ))) name = p + 1;
597 len = strlen(name);
598 if (len > 2 && !strcmp( name + len - 2, ".c" )) len -= 2;
599
600 for (test = winetest_testlist; test->name; test++)
601 {
602 if (!strncmp( test->name, name, len ) && !test->name[len]) break;
603 }
604 return test->name ? test : NULL;
605 }
606
607
608 /* Display list of valid tests */
609 static void list_tests(void)
610 {
611 const struct test *test;
612
613 fprintf( stdout, "Valid test names:\n" );
614 for (test = winetest_testlist; test->name; test++) fprintf( stdout, " %s\n", test->name );
615 }
616
617 /* Disable false-positive claiming "test" would be NULL-dereferenced */
618 #if defined(_MSC_VER)
619 #pragma warning(push)
620 #pragma warning(disable:28182)
621 #endif
622
623 /* Run a named test, and return exit status */
624 static int run_test( const char *name )
625 {
626 const struct test *test;
627 int status;
628
629 if (!(test = find_test( name )))
630 {
631 fprintf( stdout, "Fatal: test '%s' does not exist.\n", name );
632 exit_process(1);
633 }
634 successes = failures = todo_successes = todo_failures = 0;
635 tls_index=TlsAlloc();
636 current_test = test;
637 test->func();
638
639 /* show test results even if traces are disabled */
640 /*if (winetest_debug)*/
641 {
642 fprintf( stdout, "\n%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
643 test->name, (int)(successes + failures + todo_successes + todo_failures),
644 (int)todo_successes, (int)(failures + todo_failures),
645 (failures + todo_failures != 1) ? "failures" : "failure",
646 (int)skipped );
647 }
648 status = (failures + todo_failures < 255) ? failures + todo_failures : 255;
649 return status;
650 }
651
652 #if defined(_MSC_VER)
653 #pragma warning(pop)
654 #endif
655
656 /* Display usage and exit */
657 static void usage( const char *argv0 )
658 {
659 fprintf( stdout, "Usage: %s test_name\n\n", argv0 );
660 list_tests();
661 exit_process(1);
662 }
663
664
665 /* main function */
666 int main( int argc, char **argv )
667 {
668 char p[128];
669
670 setvbuf (stdout, NULL, _IONBF, 0);
671
672 winetest_argc = argc;
673 winetest_argv = argv;
674
675 if (GetEnvironmentVariableA( "WINETEST_PLATFORM", p, sizeof(p) )) winetest_platform = _strdup(p);
676 if (GetEnvironmentVariableA( "WINETEST_DEBUG", p, sizeof(p) )) winetest_debug = atoi(p);
677 if (GetEnvironmentVariableA( "WINETEST_INTERACTIVE", p, sizeof(p) )) winetest_interactive = atoi(p);
678 if (GetEnvironmentVariableA( "WINETEST_REPORT_SUCCESS", p, sizeof(p) )) report_success = atoi(p);
679
680 if (!winetest_interactive) SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX );
681
682 if (!argv[1])
683 {
684 if (winetest_testlist[0].name && !winetest_testlist[1].name) /* only one test */
685 return run_test( winetest_testlist[0].name );
686 usage( argv[0] );
687 }
688 if (!strcmp( argv[1], "--list" ))
689 {
690 list_tests();
691 return 0;
692 }
693 return run_test(argv[1]);
694 }
695
696 #endif /* STANDALONE */
697
698 // hack for ntdll winetest (this is defined in excpt.h)
699 #undef exception_info
700
701 // Some helpful definitions
702
703 #define ok_hex(expression, result) \
704 do { \
705 int _value = (expression); \
706 ok(_value == (result), "Wrong value for '%s', expected: " #result " (0x%x), got: 0x%x\n", \
707 #expression, (int)(result), _value); \
708 } while (0)
709
710 #define ok_dec(expression, result) \
711 do { \
712 int _value = (expression); \
713 ok(_value == (result), "Wrong value for '%s', expected: " #result " (%d), got: %d\n", \
714 #expression, (int)(result), _value); \
715 } while (0)
716
717 #define ok_ptr(expression, result) \
718 do { \
719 void *_value = (expression); \
720 ok(_value == (result), "Wrong value for '%s', expected: " #result " (%p), got: %p\n", \
721 #expression, (void*)(result), _value); \
722 } while (0)
723
724 #define ok_size_t(expression, result) \
725 do { \
726 size_t _value = (expression); \
727 ok(_value == (result), "Wrong value for '%s', expected: " #result " (%Ix), got: %Ix\n", \
728 #expression, (size_t)(result), _value); \
729 } while (0)
730
731 #define ok_char(expression, result) ok_hex(expression, result)
732
733 #define ok_err(error) \
734 ok(GetLastError() == (error), "Wrong last error. Expected " #error ", got 0x%lx\n", GetLastError())
735
736 #define ok_str(x, y) \
737 ok(strcmp(x, y) == 0, "Wrong string. Expected '%s', got '%s'\n", y, x)
738
739 #define ok_wstr(x, y) \
740 ok(wcscmp(x, y) == 0, "Wrong string. Expected '%S', got '%S'\n", y, x)
741
742 #define ok_long(expression, result) ok_hex(expression, result)
743 #define ok_int(expression, result) ok_dec(expression, result)
744 #define ok_ntstatus(status, expected) ok_hex(status, expected)
745 #define ok_hdl ok_ptr
746
747 #ifdef __cplusplus
748 } /* extern "C" */
749 #endif
750
751 #endif /* __WINE_WINE_TEST_H */