2 * Definitions for Wine C unit tests.
4 * Copyright (C) 2002 Alexandre Julliard
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.
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.
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
21 #ifndef __WINE_WINE_TEST_H
22 #define __WINE_WINE_TEST_H
29 #ifdef __WINE_CONFIG_H
30 #error config.h should not be used in Wine tests
32 #ifdef __WINE_WINE_LIBRARY_H
33 #error wine/library.h should not be used in Wine tests
35 #ifdef __WINE_WINE_UNICODE_H
36 #error wine/unicode.h should not be used in Wine tests
38 #ifdef __WINE_WINE_DEBUG_H
39 #error wine/debug.h should not be used in Wine tests
46 #ifndef INVALID_FILE_ATTRIBUTES
47 #define INVALID_FILE_ATTRIBUTES (~0u)
49 #ifndef INVALID_SET_FILE_POINTER
50 #define INVALID_SET_FILE_POINTER (~0u)
54 extern int winetest_debug
;
56 extern int report_success
;
58 /* running in interactive mode? */
59 extern int winetest_interactive
;
61 /* current platform */
62 extern const char *winetest_platform
;
64 extern void winetest_set_location( const char* file
, int line
);
65 extern void winetest_start_todo( int is_todo
);
66 extern int winetest_loop_todo(void);
67 extern void winetest_end_todo(void);
68 extern int winetest_get_mainargs( char*** pargv
);
69 extern LONG
winetest_get_failures(void);
70 extern LONG
winetest_get_successes(void);
71 extern void winetest_add_failures( LONG new_failures
);
72 extern void winetest_wait_child_process( HANDLE process
);
73 extern void winetest_disable_success_count_start();
74 extern int winetest_disable_success_count_end();
75 extern int winetest_disable_success_count_get();
76 extern int winetest_disable_success_count_set();
78 extern const char *wine_dbgstr_wn( const WCHAR
*str
, intptr_t n
);
79 extern const char *wine_dbgstr_guid( const GUID
*guid
);
80 extern const char *wine_dbgstr_point( const POINT
*guid
);
81 extern const char *wine_dbgstr_size( const SIZE
*guid
);
82 extern const char *wine_dbgstr_rect( const RECT
*rect
);
83 #ifdef WINETEST_USE_DBGSTR_LONGLONG
84 extern const char *wine_dbgstr_longlong( ULONGLONG ll
);
86 static inline const char *wine_dbgstr_w( const WCHAR
*s
) { return wine_dbgstr_wn( s
, -1 ); }
88 /* strcmpW is available for tests compiled under Wine, but not in standalone
89 * builds under Windows, so we reimplement it under a different name. */
90 static inline int winetest_strcmpW( const WCHAR
*str1
, const WCHAR
*str2
)
92 while (*str1
&& (*str1
== *str2
)) { str1
++; str2
++; }
98 #define START_TEST(name) \
99 static void func_##name(void); \
100 const struct test winetest_testlist[] = { { #name, func_##name }, { 0, 0 } }; \
101 static void func_##name(void)
103 #else /* STANDALONE */
106 #define START_TEST(name) extern "C" void func_##name(void)
108 #define START_TEST(name) void func_##name(void)
111 #endif /* STANDALONE */
113 #if defined(__x86_64__) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT)
114 #define __winetest_cdecl __cdecl
115 #define __winetest_va_list __builtin_ms_va_list
117 #define __winetest_cdecl
118 #define __winetest_va_list va_list
121 extern int broken( int condition
);
122 extern int winetest_vok( int condition
, const char *msg
, __winetest_va_list ap
);
123 extern void winetest_vskip( const char *msg
, __winetest_va_list ap
);
126 # define WINETEST_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
127 extern void __winetest_cdecl
winetest_ok( int condition
, const char *msg
, ... ) __attribute__((format (printf
,2,3) ));
128 extern void __winetest_cdecl
winetest_skip( const char *msg
, ... ) __attribute__((format (printf
,1,2)));
129 extern void __winetest_cdecl
winetest_win_skip( const char *msg
, ... ) __attribute__((format (printf
,1,2)));
130 extern void __winetest_cdecl
winetest_trace( const char *msg
, ... ) __attribute__((format (printf
,1,2)));
131 extern void __winetest_cdecl
winetest_print(const char* msg
, ...) __attribute__((format(printf
, 1, 2)));
134 # define WINETEST_PRINTF_ATTR(fmt,args)
135 extern void __winetest_cdecl
winetest_ok( int condition
, const char *msg
, ... );
136 extern void __winetest_cdecl
winetest_skip( const char *msg
, ... );
137 extern void __winetest_cdecl
winetest_win_skip( const char *msg
, ... );
138 extern void __winetest_cdecl
winetest_trace( const char *msg
, ... );
139 extern void __winetest_cdecl
winetest_print(const char* msg
, ...);
141 #endif /* __GNUC__ */
143 #define ok_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_ok
144 #define skip_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_skip
145 #define win_skip_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_win_skip
146 #define trace_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_trace
148 #define ok ok_(__FILE__, __LINE__)
149 #define skip skip_(__FILE__, __LINE__)
150 #define win_skip win_skip_(__FILE__, __LINE__)
151 #define trace trace_(__FILE__, __LINE__)
153 #define todo_if(is_todo) for (winetest_start_todo(is_todo); \
154 winetest_loop_todo(); \
157 #define todo_ros todo_if(!strcmp(winetest_platform, "reactos"))
158 #define todo_ros_if(is_todo) todo_if((is_todo) && !strcmp(winetest_platform, "reactos"))
159 #ifdef USE_WINE_TODOS
160 #define todo_wine todo_ros
161 #define todo_wine_if todo_ros_if
163 #define todo_wine todo_if(!strcmp(winetest_platform, "wine"))
164 #define todo_wine_if(is_todo) todo_if((is_todo) && !strcmp(winetest_platform, "wine"))
167 #define ros_skip_flaky for (winetest_print("Skipping flaky test\n");0;)
169 #define disable_success_count for (winetest_disable_success_count_start(); \
170 (winetest_disable_success_count_get() ? \
171 winetest_disable_success_count_end() : \
172 winetest_disable_success_count_set()); \
175 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
177 #ifdef NONAMELESSUNION
179 # define U1(x) (x).u1
180 # define U2(x) (x).u2
181 # define U3(x) (x).u3
182 # define U4(x) (x).u4
183 # define U5(x) (x).u5
184 # define U6(x) (x).u6
185 # define U7(x) (x).u7
186 # define U8(x) (x).u8
199 #ifdef NONAMELESSSTRUCT
201 # define S1(x) (x).s1
202 # define S2(x) (x).s2
203 # define S3(x) (x).s3
204 # define S4(x) (x).s4
205 # define S5(x) (x).s5
216 /************************************************************************/
217 /* Below is the implementation of the various functions, to be included
218 * directly into the generated testlist.c file.
219 * It is done that way so that the dlls can build the test routines with
220 * different includes or flags if needed.
227 #if defined(__x86_64__) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT)
228 # define __winetest_va_start(list,arg) __builtin_ms_va_start(list,arg)
229 # define __winetest_va_end(list) __builtin_ms_va_end(list)
231 # define __winetest_va_start(list,arg) va_start(list,arg)
232 # define __winetest_va_end(list) va_end(list)
235 /* Define WINETEST_MSVC_IDE_FORMATTING to alter the output format winetest will use for file/line numbers.
236 This alternate format makes the file/line numbers clickable in visual studio, to directly jump to them. */
237 #if defined(WINETEST_MSVC_IDE_FORMATTING)
238 # define __winetest_file_line_prefix "%s(%d)"
240 # define __winetest_file_line_prefix "%s:%d"
249 extern const struct test winetest_testlist
[];
252 int winetest_debug
= 1;
254 /* interactive mode? */
255 int winetest_interactive
= 0;
257 /* current platform */
258 const char *winetest_platform
= "windows";
260 /* report successful tests (BOOL) */
261 int report_success
= 0;
263 /* passing arguments around */
264 static int winetest_argc
;
265 static char** winetest_argv
;
267 static const struct test
*current_test
; /* test currently being run */
269 static LONG successes
; /* number of successful tests */
270 static LONG failures
; /* number of failures */
271 static LONG skipped
; /* number of skipped test chunks */
272 static LONG todo_successes
; /* number of successful tests inside todo block */
273 static LONG todo_failures
; /* number of failures inside todo block */
275 /* The following data must be kept track of on a per-thread basis */
278 const char* current_file
; /* file of current check */
279 int current_line
; /* line of current check */
280 unsigned int todo_level
; /* current todo nesting level */
281 unsigned int nocount_level
;
283 char *str_pos
; /* position in debug buffer */
284 char strings
[2000]; /* buffer for debug strings */
286 static DWORD tls_index
;
288 static tls_data
* get_tls_data(void)
293 last_error
=GetLastError();
294 data
=(tls_data
*)TlsGetValue(tls_index
);
297 data
=(tls_data
*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(tls_data
));
298 data
->str_pos
= data
->strings
;
299 TlsSetValue(tls_index
,data
);
301 SetLastError(last_error
);
305 /* allocate some tmp space for a string */
306 static char *get_temp_buffer( size_t n
)
308 tls_data
*data
= get_tls_data();
309 char *res
= data
->str_pos
;
311 if (res
+ n
>= &data
->strings
[sizeof(data
->strings
)]) res
= data
->strings
;
312 data
->str_pos
= res
+ n
;
316 /* release extra space that we requested in gimme1() */
317 static void release_temp_buffer( char *ptr
, size_t size
)
319 tls_data
*data
= get_tls_data();
320 data
->str_pos
= ptr
+ size
;
323 static void exit_process( int code
)
330 void winetest_set_location( const char* file
, int line
)
332 tls_data
* data
=get_tls_data();
333 #if defined(WINETEST_MSVC_IDE_FORMATTING)
334 data
->current_file
= file
;
336 data
->current_file
=strrchr(file
,'/');
337 if (data
->current_file
==NULL
)
338 data
->current_file
=strrchr(file
,'\\');
339 if (data
->current_file
==NULL
)
340 data
->current_file
=file
;
342 data
->current_file
++;
344 data
->current_line
=line
;
347 int broken( int condition
)
349 return ((strcmp(winetest_platform
, "windows") == 0)
350 #ifndef USE_WINE_TODOS
351 || (strcmp(winetest_platform
, "reactos") == 0)
359 * - condition - condition to check;
360 * - msg test description;
361 * - file - test application source code file name of the check
362 * - line - test application source code file line number of the check
364 * 0 if condition does not have the expected value, 1 otherwise
366 int winetest_vok( int condition
, const char *msg
, __winetest_va_list args
)
368 tls_data
* data
=get_tls_data();
370 if (data
->todo_level
)
374 fprintf( stdout
, __winetest_file_line_prefix
": Test succeeded inside todo block: ",
375 data
->current_file
, data
->current_line
);
376 vfprintf(stdout
, msg
, args
);
377 InterlockedIncrement(&todo_failures
);
382 /* show todos even if traces are disabled*/
383 /*if (winetest_debug > 0)*/
385 fprintf( stdout
, __winetest_file_line_prefix
": Test marked todo: ",
386 data
->current_file
, data
->current_line
);
387 vfprintf(stdout
, msg
, args
);
389 if (data
->nocount_level
== 0)
390 InterlockedIncrement(&todo_successes
);
398 fprintf( stdout
, __winetest_file_line_prefix
": Test failed: ",
399 data
->current_file
, data
->current_line
);
400 vfprintf(stdout
, msg
, args
);
401 InterlockedIncrement(&failures
);
406 if (report_success
&& data
->nocount_level
== 0)
407 fprintf( stdout
, __winetest_file_line_prefix
": Test succeeded\n",
408 data
->current_file
, data
->current_line
);
409 if (data
->nocount_level
== 0)
410 InterlockedIncrement(&successes
);
416 void __winetest_cdecl
winetest_ok( int condition
, const char *msg
, ... )
418 __winetest_va_list valist
;
420 __winetest_va_start(valist
, msg
);
421 winetest_vok(condition
, msg
, valist
);
422 __winetest_va_end(valist
);
425 void __winetest_cdecl
winetest_trace( const char *msg
, ... )
427 __winetest_va_list valist
;
428 tls_data
* data
=get_tls_data();
430 if (winetest_debug
> 0)
432 fprintf( stdout
, __winetest_file_line_prefix
": ", data
->current_file
, data
->current_line
);
433 __winetest_va_start(valist
, msg
);
434 vfprintf(stdout
, msg
, valist
);
435 __winetest_va_end(valist
);
439 void __winetest_cdecl
winetest_print(const char* msg
, ...)
441 __winetest_va_list valist
;
442 tls_data
* data
= get_tls_data();
444 fprintf(stdout
, __winetest_file_line_prefix
": ", data
->current_file
, data
->current_line
);
445 __winetest_va_start(valist
, msg
);
446 vfprintf(stdout
, msg
, valist
);
447 __winetest_va_end(valist
);
450 void winetest_vskip( const char *msg
, __winetest_va_list args
)
452 tls_data
* data
=get_tls_data();
454 fprintf( stdout
, __winetest_file_line_prefix
": Tests skipped: ", data
->current_file
, data
->current_line
);
455 vfprintf(stdout
, msg
, args
);
459 void __winetest_cdecl
winetest_skip( const char *msg
, ... )
461 __winetest_va_list valist
;
462 __winetest_va_start(valist
, msg
);
463 winetest_vskip(msg
, valist
);
464 __winetest_va_end(valist
);
467 void __winetest_cdecl
winetest_win_skip( const char *msg
, ... )
469 __winetest_va_list valist
;
470 __winetest_va_start(valist
, msg
);
471 if ((strcmp(winetest_platform
, "windows") == 0)
472 #ifndef USE_WINE_TODOS
473 || (strcmp(winetest_platform
, "reactos") == 0)
476 winetest_vskip(msg
, valist
);
478 winetest_vok(0, msg
, valist
);
479 __winetest_va_end(valist
);
482 void winetest_start_todo( int is_todo
)
484 tls_data
* data
=get_tls_data();
485 data
->todo_level
= (data
->todo_level
<< 1) | (is_todo
!= 0);
486 data
->todo_do_loop
=1;
489 int winetest_loop_todo(void)
491 tls_data
* data
=get_tls_data();
492 int do_loop
=data
->todo_do_loop
;
493 data
->todo_do_loop
=0;
497 void winetest_end_todo(void)
499 tls_data
* data
=get_tls_data();
500 data
->todo_level
>>= 1;
503 int winetest_get_mainargs( char*** pargv
)
505 *pargv
= winetest_argv
;
506 return winetest_argc
;
509 LONG
winetest_get_failures(void)
514 LONG
winetest_get_successes(void)
519 void winetest_add_failures( LONG new_failures
)
521 while (new_failures
-- > 0)
522 InterlockedIncrement( &failures
);
525 void winetest_wait_child_process( HANDLE process
)
529 if (WaitForSingleObject( process
, 30000 ))
530 fprintf( stdout
, "%s: child process wait failed\n", current_test
->name
);
532 GetExitCodeProcess( process
, &exit_code
);
538 fprintf( stdout
, "%s: exception 0x%08x in child process\n", current_test
->name
, (unsigned)exit_code
);
539 InterlockedIncrement( &failures
);
543 fprintf( stdout
, "%s: %u failures in child process\n",
544 current_test
->name
, (unsigned)exit_code
);
545 while (exit_code
-- > 0)
546 InterlockedIncrement(&failures
);
551 void winetest_disable_success_count_start()
553 get_tls_data()->nocount_level
<<= 1;
556 int winetest_disable_success_count_end()
558 get_tls_data()->nocount_level
>>= 1;
562 int winetest_disable_success_count_get()
564 return get_tls_data()->nocount_level
& 1;
567 int winetest_disable_success_count_set()
569 get_tls_data()->nocount_level
|= 1;
573 const char *wine_dbgstr_wn( const WCHAR
*str
, intptr_t n
)
578 if (!((ULONG_PTR
)str
>> 16))
580 if (!str
) return "(null)";
581 res
= get_temp_buffer( 6 );
582 sprintf( res
, "#%04x", LOWORD(str
) );
587 const WCHAR
*end
= str
;
592 size
= 12 + min( 300, n
* 5 );
593 dst
= res
= get_temp_buffer( size
);
596 while (n
-- > 0 && dst
<= res
+ size
- 10)
601 case '\n': *dst
++ = '\\'; *dst
++ = 'n'; break;
602 case '\r': *dst
++ = '\\'; *dst
++ = 'r'; break;
603 case '\t': *dst
++ = '\\'; *dst
++ = 't'; break;
604 case '"': *dst
++ = '\\'; *dst
++ = '"'; break;
605 case '\\': *dst
++ = '\\'; *dst
++ = '\\'; break;
607 if (c
>= ' ' && c
<= 126)
612 sprintf(dst
,"%04x",c
);
625 release_temp_buffer( res
, dst
- res
);
629 const char *wine_dbgstr_guid( const GUID
*guid
)
633 if (!guid
) return "(null)";
634 res
= get_temp_buffer( 39 ); /* CHARS_IN_GUID */
635 sprintf( res
, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
636 guid
->Data1
, guid
->Data2
, guid
->Data3
, guid
->Data4
[0],
637 guid
->Data4
[1], guid
->Data4
[2], guid
->Data4
[3], guid
->Data4
[4],
638 guid
->Data4
[5], guid
->Data4
[6], guid
->Data4
[7] );
642 const char *wine_dbgstr_point( const POINT
*point
)
646 if (!point
) return "(null)";
647 res
= get_temp_buffer( 60 );
648 #ifdef __ROS_LONG64__
649 sprintf( res
, "(%d,%d)", point
->x
, point
->y
);
651 sprintf( res
, "(%ld,%ld)", point
->x
, point
->y
);
653 release_temp_buffer( res
, strlen(res
) + 1 );
657 const char *wine_dbgstr_size( const SIZE
*size
)
661 if (!size
) return "(null)";
662 res
= get_temp_buffer( 60 );
663 #ifdef __ROS_LONG64__
664 sprintf( res
, "(%d,%d)", size
->cx
, size
->cy
);
666 sprintf( res
, "(%ld,%ld)", size
->cx
, size
->cy
);
668 release_temp_buffer( res
, strlen(res
) + 1 );
672 const char *wine_dbgstr_rect( const RECT
*rect
)
676 if (!rect
) return "(null)";
677 res
= get_temp_buffer( 60 );
678 #ifdef __ROS_LONG64__
679 sprintf( res
, "(%d,%d)-(%d,%d)", rect
->left
, rect
->top
, rect
->right
, rect
->bottom
);
681 sprintf( res
, "(%ld,%ld)-(%ld,%ld)", rect
->left
, rect
->top
, rect
->right
, rect
->bottom
);
683 release_temp_buffer( res
, strlen(res
) + 1 );
687 #ifdef WINETEST_USE_DBGSTR_LONGLONG
688 const char *wine_dbgstr_longlong( ULONGLONG ll
)
692 res
= get_temp_buffer( 20 );
693 if (/*sizeof(ll) > sizeof(unsigned long) &&*/ ll
>> 32) /* ULONGLONG is always > long in ReactOS */
694 sprintf( res
, "%lx%08lx", (unsigned long)(ll
>> 32), (unsigned long)ll
);
696 sprintf( res
, "%lx", (unsigned long)ll
);
697 release_temp_buffer( res
, strlen(res
) + 1 );
702 /* Find a test by name */
703 static const struct test
*find_test( const char *name
)
705 const struct test
*test
;
709 if ((p
= strrchr( name
, '/' ))) name
= p
+ 1;
710 if ((p
= strrchr( name
, '\\' ))) name
= p
+ 1;
712 if (len
> 2 && !strcmp( name
+ len
- 2, ".c" )) len
-= 2;
714 for (test
= winetest_testlist
; test
->name
; test
++)
716 if (!strncmp( test
->name
, name
, len
) && !test
->name
[len
]) break;
718 return test
->name
? test
: NULL
;
722 /* Display list of valid tests */
723 static void list_tests(void)
725 const struct test
*test
;
727 fprintf( stdout
, "Valid test names:\n" );
728 for (test
= winetest_testlist
; test
->name
; test
++) fprintf( stdout
, " %s\n", test
->name
);
731 /* Disable false-positive claiming "test" would be NULL-dereferenced */
732 #if defined(_MSC_VER)
733 #pragma warning(push)
734 #pragma warning(disable:28182)
737 /* Run a named test, and return exit status */
738 static int run_test( const char *name
)
740 const struct test
*test
;
743 if (!(test
= find_test( name
)))
745 fprintf( stdout
, "Fatal: test '%s' does not exist.\n", name
);
748 successes
= failures
= todo_successes
= todo_failures
= 0;
749 tls_index
=TlsAlloc();
753 /* show test results even if traces are disabled */
754 /*if (winetest_debug)*/
756 fprintf( stdout
, "\n%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
757 test
->name
, (int)(successes
+ failures
+ todo_successes
+ todo_failures
),
758 (int)todo_successes
, (int)(failures
+ todo_failures
),
759 (failures
+ todo_failures
!= 1) ? "failures" : "failure",
762 status
= (failures
+ todo_failures
< 255) ? failures
+ todo_failures
: 255;
766 #if defined(_MSC_VER)
770 /* Display usage and exit */
771 static void usage( const char *argv0
)
773 fprintf( stdout
, "Usage: %s test_name\n\n", argv0
);
780 int main( int argc
, char **argv
)
784 setvbuf (stdout
, NULL
, _IONBF
, 0);
786 winetest_argc
= argc
;
787 winetest_argv
= argv
;
789 if (GetEnvironmentVariableA( "WINETEST_PLATFORM", p
, sizeof(p
) )) winetest_platform
= _strdup(p
);
790 if (GetEnvironmentVariableA( "WINETEST_DEBUG", p
, sizeof(p
) )) winetest_debug
= atoi(p
);
791 if (GetEnvironmentVariableA( "WINETEST_INTERACTIVE", p
, sizeof(p
) )) winetest_interactive
= atoi(p
);
792 if (GetEnvironmentVariableA( "WINETEST_REPORT_SUCCESS", p
, sizeof(p
) )) report_success
= atoi(p
);
794 if (!winetest_interactive
) SetErrorMode( SEM_FAILCRITICALERRORS
| SEM_NOGPFAULTERRORBOX
);
798 if (winetest_testlist
[0].name
&& !winetest_testlist
[1].name
) /* only one test */
799 return run_test( winetest_testlist
[0].name
);
802 if (!strcmp( argv
[1], "--list" ))
807 return run_test(argv
[1]);
810 #endif /* STANDALONE */
812 // hack for ntdll winetest (this is defined in excpt.h)
813 #undef exception_info
815 // Some helpful definitions
817 #define ok_hex(expression, result) \
819 int _value = (expression); \
820 ok(_value == (result), "Wrong value for '%s', expected: " #result " (0x%x), got: 0x%x\n", \
821 #expression, (int)(result), _value); \
824 #define ok_dec(expression, result) \
826 int _value = (expression); \
827 ok(_value == (result), "Wrong value for '%s', expected: " #result " (%d), got: %d\n", \
828 #expression, (int)(result), _value); \
831 #define ok_ptr(expression, result) \
833 void *_value = (expression); \
834 ok(_value == (result), "Wrong value for '%s', expected: " #result " (%p), got: %p\n", \
835 #expression, (void*)(result), _value); \
838 #define ok_size_t(expression, result) \
840 size_t _value = (expression); \
841 ok(_value == (result), "Wrong value for '%s', expected: " #result " (%Ix), got: %Ix\n", \
842 #expression, (size_t)(result), _value); \
845 #define ok_char(expression, result) ok_hex(expression, result)
847 #define ok_err(error) \
848 ok(GetLastError() == (error), "Wrong last error. Expected " #error ", got 0x%lx\n", GetLastError())
850 #define ok_str(x, y) \
851 ok(strcmp(x, y) == 0, "Wrong string. Expected '%s', got '%s'\n", y, x)
853 #define ok_wstr(x, y) \
854 ok(wcscmp(x, y) == 0, "Wrong string. Expected '%S', got '%S'\n", y, x)
856 #define ok_long(expression, result) ok_hex(expression, result)
857 #define ok_int(expression, result) ok_dec(expression, result)
858 #define ok_ntstatus(status, expected) ok_hex(status, expected)
859 #define ok_hdl ok_ptr
865 #endif /* __WINE_WINE_TEST_H */