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