2 * Copyright 2015-2016 Iván Matellanes
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
25 #include "wine/test.h"
27 typedef void (*vtable_ptr
)(void);
28 typedef LONG streamoff
;
29 typedef LONG streampos
;
31 typedef void* (__cdecl
*allocFunction
)(LONG
);
32 typedef void (__cdecl
*freeFunction
)(void*);
35 IOSTATE_goodbit
= 0x0,
37 IOSTATE_failbit
= 0x2,
46 OPENMODE_trunc
= 0x10,
47 OPENMODE_nocreate
= 0x20,
48 OPENMODE_noreplace
= 0x40,
49 OPENMODE_binary
= 0x80
66 FLAGS_showbase
= 0x80,
67 FLAGS_showpoint
= 0x100,
68 FLAGS_uppercase
= 0x200,
69 FLAGS_showpos
= 0x400,
70 FLAGS_scientific
= 0x800,
72 FLAGS_unitbuf
= 0x2000,
76 const int filebuf_sh_none
= 0x800;
77 const int filebuf_sh_read
= 0xa00;
78 const int filebuf_sh_write
= 0xc00;
79 const int filebuf_openprot
= 420;
80 const int filebuf_binary
= _O_BINARY
;
81 const int filebuf_text
= _O_TEXT
;
85 const vtable_ptr
*vtable
;
98 CRITICAL_SECTION lock
;
108 /* class strstreambuf */
115 allocFunction f_alloc
;
128 const vtable_ptr
*vtable
;
133 struct _ostream
*tie
;
139 CRITICAL_SECTION lock
;
143 typedef struct _ostream
{
146 ios base_ios
; /* virtually inherited */
154 ios base_ios
; /* virtually inherited */
159 struct { /* istream */
164 struct { /* ostream */
168 ios base_ios
; /* virtually inherited */
171 static inline float __port_infinity(void)
173 static const unsigned __inf_bytes
= 0x7f800000;
174 return *(const float *)&__inf_bytes
;
176 #define INFINITY __port_infinity()
178 static inline float __port_nan(void)
180 static const unsigned __nan_bytes
= 0x7fc00000;
181 return *(const float *)&__nan_bytes
;
183 #define NAN __port_nan()
187 #define __thiscall __stdcall
189 #define __thiscall __cdecl
192 static void* (__cdecl
*p_operator_new
)(unsigned int);
193 static void (__cdecl
*p_operator_delete
)(void*);
196 static streambuf
* (*__thiscall p_streambuf_reserve_ctor
)(streambuf
*, char*, int);
197 static streambuf
* (*__thiscall p_streambuf_ctor
)(streambuf
*);
198 static void (*__thiscall p_streambuf_dtor
)(streambuf
*);
199 static int (*__thiscall p_streambuf_allocate
)(streambuf
*);
200 static void (*__thiscall p_streambuf_clrclock
)(streambuf
*);
201 static int (*__thiscall p_streambuf_doallocate
)(streambuf
*);
202 static void (*__thiscall p_streambuf_gbump
)(streambuf
*, int);
203 static int (*__thiscall p_streambuf_in_avail
)(const streambuf
*);
204 static void (*__thiscall p_streambuf_lock
)(streambuf
*);
205 static int (*__thiscall p_streambuf_out_waiting
)(const streambuf
*);
206 static int (*__thiscall p_streambuf_pbackfail
)(streambuf
*, int);
207 static void (*__thiscall p_streambuf_pbump
)(streambuf
*, int);
208 static int (*__thiscall p_streambuf_sbumpc
)(streambuf
*);
209 static void (*__thiscall p_streambuf_setb
)(streambuf
*, char*, char*, int);
210 static void (*__thiscall p_streambuf_setlock
)(streambuf
*);
211 static streambuf
* (*__thiscall p_streambuf_setbuf
)(streambuf
*, char*, int);
212 static int (*__thiscall p_streambuf_sgetc
)(streambuf
*);
213 static int (*__thiscall p_streambuf_snextc
)(streambuf
*);
214 static int (*__thiscall p_streambuf_sputc
)(streambuf
*, int);
215 static void (*__thiscall p_streambuf_stossc
)(streambuf
*);
216 static int (*__thiscall p_streambuf_sync
)(streambuf
*);
217 static void (*__thiscall p_streambuf_unlock
)(streambuf
*);
218 static int (*__thiscall p_streambuf_xsgetn
)(streambuf
*, char*, int);
219 static int (*__thiscall p_streambuf_xsputn
)(streambuf
*, const char*, int);
222 static filebuf
* (*__thiscall p_filebuf_fd_ctor
)(filebuf
*, int);
223 static filebuf
* (*__thiscall p_filebuf_fd_reserve_ctor
)(filebuf
*, int, char*, int);
224 static filebuf
* (*__thiscall p_filebuf_ctor
)(filebuf
*);
225 static void (*__thiscall p_filebuf_dtor
)(filebuf
*);
226 static filebuf
* (*__thiscall p_filebuf_attach
)(filebuf
*, filedesc
);
227 static filebuf
* (*__thiscall p_filebuf_open
)(filebuf
*, const char*, ios_open_mode
, int);
228 static filebuf
* (*__thiscall p_filebuf_close
)(filebuf
*);
229 static int (*__thiscall p_filebuf_setmode
)(filebuf
*, int);
230 static streambuf
* (*__thiscall p_filebuf_setbuf
)(filebuf
*, char*, int);
231 static int (*__thiscall p_filebuf_sync
)(filebuf
*);
232 static int (*__thiscall p_filebuf_overflow
)(filebuf
*, int);
233 static int (*__thiscall p_filebuf_underflow
)(filebuf
*);
234 static streampos (*__thiscall p_filebuf_seekoff
)(filebuf
*, streamoff
, ios_seek_dir
, int);
237 static strstreambuf
* (*__thiscall p_strstreambuf_dynamic_ctor
)(strstreambuf
*, int);
238 static strstreambuf
* (*__thiscall p_strstreambuf_funcs_ctor
)(strstreambuf
*, allocFunction
, freeFunction
);
239 static strstreambuf
* (*__thiscall p_strstreambuf_buffer_ctor
)(strstreambuf
*, char*, int, char*);
240 static strstreambuf
* (*__thiscall p_strstreambuf_ubuffer_ctor
)(strstreambuf
*, unsigned char*, int, unsigned char*);
241 static strstreambuf
* (*__thiscall p_strstreambuf_ctor
)(strstreambuf
*);
242 static void (*__thiscall p_strstreambuf_dtor
)(strstreambuf
*);
243 static int (*__thiscall p_strstreambuf_doallocate
)(strstreambuf
*);
244 static void (*__thiscall p_strstreambuf_freeze
)(strstreambuf
*, int);
245 static int (*__thiscall p_strstreambuf_overflow
)(strstreambuf
*, int);
246 static streampos (*__thiscall p_strstreambuf_seekoff
)(strstreambuf
*, streamoff
, ios_seek_dir
, int);
247 static streambuf
* (*__thiscall p_strstreambuf_setbuf
)(strstreambuf
*, char*, int);
248 static int (*__thiscall p_strstreambuf_underflow
)(strstreambuf
*);
251 static stdiobuf
* (*__thiscall p_stdiobuf_file_ctor
)(stdiobuf
*, FILE*);
252 static void (*__thiscall p_stdiobuf_dtor
)(stdiobuf
*);
253 static int (*__thiscall p_stdiobuf_overflow
)(stdiobuf
*, int);
254 static int (*__thiscall p_stdiobuf_pbackfail
)(stdiobuf
*, int);
255 static streampos (*__thiscall p_stdiobuf_seekoff
)(stdiobuf
*, streamoff
, ios_seek_dir
, int);
256 static int (*__thiscall p_stdiobuf_setrwbuf
)(stdiobuf
*, int, int);
257 static int (*__thiscall p_stdiobuf_sync
)(stdiobuf
*);
258 static int (*__thiscall p_stdiobuf_underflow
)(stdiobuf
*);
261 static ios
* (*__thiscall p_ios_copy_ctor
)(ios
*, const ios
*);
262 static ios
* (*__thiscall p_ios_ctor
)(ios
*);
263 static ios
* (*__thiscall p_ios_sb_ctor
)(ios
*, streambuf
*);
264 static ios
* (*__thiscall p_ios_assign
)(ios
*, const ios
*);
265 static void (*__thiscall p_ios_init
)(ios
*, streambuf
*);
266 static void (*__thiscall p_ios_dtor
)(ios
*);
267 static void (*__cdecl p_ios_clrlock
)(ios
*);
268 static void (*__cdecl p_ios_setlock
)(ios
*);
269 static void (*__cdecl p_ios_lock
)(ios
*);
270 static void (*__cdecl p_ios_unlock
)(ios
*);
271 static void (*__cdecl p_ios_lockbuf
)(ios
*);
272 static void (*__cdecl p_ios_unlockbuf
)(ios
*);
273 static CRITICAL_SECTION
*p_ios_static_lock
;
274 static void (*__cdecl p_ios_lockc
)(void);
275 static void (*__cdecl p_ios_unlockc
)(void);
276 static LONG (*__thiscall p_ios_flags_set
)(ios
*, LONG
);
277 static LONG (*__thiscall p_ios_flags_get
)(const ios
*);
278 static LONG (*__thiscall p_ios_setf
)(ios
*, LONG
);
279 static LONG (*__thiscall p_ios_setf_mask
)(ios
*, LONG
, LONG
);
280 static LONG (*__thiscall p_ios_unsetf
)(ios
*, LONG
);
281 static int (*__thiscall p_ios_good
)(const ios
*);
282 static int (*__thiscall p_ios_bad
)(const ios
*);
283 static int (*__thiscall p_ios_eof
)(const ios
*);
284 static int (*__thiscall p_ios_fail
)(const ios
*);
285 static void (*__thiscall p_ios_clear
)(ios
*, int);
286 static LONG
*p_ios_maxbit
;
287 static LONG (*__cdecl p_ios_bitalloc
)(void);
288 static int *p_ios_curindex
;
289 static LONG
*p_ios_statebuf
;
290 static LONG
* (*__thiscall p_ios_iword
)(const ios
*, int);
291 static void** (*__thiscall p_ios_pword
)(const ios
*, int);
292 static int (*__cdecl p_ios_xalloc
)(void);
293 static void (*__cdecl p_ios_sync_with_stdio
)(void);
294 static int *p_ios_sunk_with_stdio
;
295 static int *p_ios_fLockcInit
;
298 static ostream
* (*__thiscall p_ostream_copy_ctor
)(ostream
*, const ostream
*, BOOL
);
299 static ostream
* (*__thiscall p_ostream_sb_ctor
)(ostream
*, streambuf
*, BOOL
);
300 static ostream
* (*__thiscall p_ostream_ctor
)(ostream
*, BOOL
);
301 static void (*__thiscall p_ostream_dtor
)(ios
*);
302 static ostream
* (*__thiscall p_ostream_assign
)(ostream
*, const ostream
*);
303 static ostream
* (*__thiscall p_ostream_assign_sb
)(ostream
*, streambuf
*);
304 static void (*__thiscall p_ostream_vbase_dtor
)(ostream
*);
305 static ostream
* (*__thiscall p_ostream_flush
)(ostream
*);
306 static int (*__thiscall p_ostream_opfx
)(ostream
*);
307 static void (*__thiscall p_ostream_osfx
)(ostream
*);
308 static ostream
* (*__thiscall p_ostream_put_char
)(ostream
*, char);
309 static ostream
* (*__thiscall p_ostream_write_char
)(ostream
*, const char*, int);
310 static ostream
* (*__thiscall p_ostream_seekp_offset
)(ostream
*, streamoff
, ios_seek_dir
);
311 static ostream
* (*__thiscall p_ostream_seekp
)(ostream
*, streampos
);
312 static streampos (*__thiscall p_ostream_tellp
)(ostream
*);
313 static ostream
* (*__thiscall p_ostream_writepad
)(ostream
*, const char*, const char*);
314 static ostream
* (*__thiscall p_ostream_print_char
)(ostream
*, char);
315 static ostream
* (*__thiscall p_ostream_print_str
)(ostream
*, const char*);
316 static ostream
* (*__thiscall p_ostream_print_int
)(ostream
*, int);
317 static ostream
* (*__thiscall p_ostream_print_float
)(ostream
*, float);
318 static ostream
* (*__thiscall p_ostream_print_double
)(ostream
*, double);
319 static ostream
* (*__thiscall p_ostream_print_ptr
)(ostream
*, const void*);
320 static ostream
* (*__thiscall p_ostream_print_streambuf
)(ostream
*, streambuf
*);
322 /* ostream_withassign */
323 static ostream
* (*__thiscall p_ostream_withassign_sb_ctor
)(ostream
*, streambuf
*, BOOL
);
324 static ostream
* (*__thiscall p_ostream_withassign_copy_ctor
)(ostream
*, const ostream
*, BOOL
);
325 static ostream
* (*__thiscall p_ostream_withassign_ctor
)(ostream
*, BOOL
);
326 static void (*__thiscall p_ostream_withassign_dtor
)(ios
*);
327 static void (*__thiscall p_ostream_withassign_vbase_dtor
)(ostream
*);
328 static ostream
* (*__thiscall p_ostream_withassign_assign_sb
)(ostream
*, streambuf
*);
329 static ostream
* (*__thiscall p_ostream_withassign_assign_os
)(ostream
*, const ostream
*);
330 static ostream
* (*__thiscall p_ostream_withassign_assign
)(ostream
*, const ostream
*);
333 static istream
* (*__thiscall p_istream_copy_ctor
)(istream
*, const istream
*, BOOL
);
334 static istream
* (*__thiscall p_istream_ctor
)(istream
*, BOOL
);
335 static istream
* (*__thiscall p_istream_sb_ctor
)(istream
*, streambuf
*, BOOL
);
336 static void (*__thiscall p_istream_dtor
)(ios
*);
337 static istream
* (*__thiscall p_istream_assign_sb
)(istream
*, streambuf
*);
338 static istream
* (*__thiscall p_istream_assign
)(istream
*, const istream
*);
339 static void (*__thiscall p_istream_vbase_dtor
)(istream
*);
340 static void (*__thiscall p_istream_eatwhite
)(istream
*);
341 static int (*__thiscall p_istream_ipfx
)(istream
*, int);
342 static istream
* (*__thiscall p_istream_get_str_delim
)(istream
*, char*, int, int);
343 static istream
* (*__thiscall p_istream_get_str
)(istream
*, char*, int, char);
344 static int (*__thiscall p_istream_get
)(istream
*);
345 static istream
* (*__thiscall p_istream_get_char
)(istream
*, char*);
346 static istream
* (*__thiscall p_istream_get_sb
)(istream
*, streambuf
*, char);
347 static istream
* (*__thiscall p_istream_getline
)(istream
*, char*, int, char);
348 static istream
* (*__thiscall p_istream_ignore
)(istream
*, int, int);
349 static int (*__thiscall p_istream_peek
)(istream
*);
350 static istream
* (*__thiscall p_istream_putback
)(istream
*, char);
351 static istream
* (*__thiscall p_istream_read
)(istream
*, char*, int);
352 static istream
* (*__thiscall p_istream_seekg
)(istream
*, streampos
);
353 static istream
* (*__thiscall p_istream_seekg_offset
)(istream
*, streamoff
, ios_seek_dir
);
354 static int (*__thiscall p_istream_sync
)(istream
*);
355 static streampos (*__thiscall p_istream_tellg
)(istream
*);
356 static int (*__thiscall p_istream_getint
)(istream
*, char*);
357 static int (*__thiscall p_istream_getdouble
)(istream
*, char*, int);
358 static istream
* (*__thiscall p_istream_read_char
)(istream
*, char*);
359 static istream
* (*__thiscall p_istream_read_str
)(istream
*, char*);
360 static istream
* (*__thiscall p_istream_read_short
)(istream
*, short*);
361 static istream
* (*__thiscall p_istream_read_unsigned_short
)(istream
*, unsigned short*);
362 static istream
* (*__thiscall p_istream_read_int
)(istream
*, int*);
363 static istream
* (*__thiscall p_istream_read_unsigned_int
)(istream
*, unsigned int*);
364 static istream
* (*__thiscall p_istream_read_long
)(istream
*, LONG
*);
365 static istream
* (*__thiscall p_istream_read_unsigned_long
)(istream
*, ULONG
*);
366 static istream
* (*__thiscall p_istream_read_float
)(istream
*, float*);
367 static istream
* (*__thiscall p_istream_read_double
)(istream
*, double*);
368 static istream
* (*__thiscall p_istream_read_long_double
)(istream
*, double*);
369 static istream
* (*__thiscall p_istream_read_streambuf
)(istream
*, streambuf
*);
371 /* istream_withassign */
372 static istream
* (*__thiscall p_istream_withassign_sb_ctor
)(istream
*, streambuf
*, BOOL
);
373 static istream
* (*__thiscall p_istream_withassign_copy_ctor
)(istream
*, const istream
*, BOOL
);
374 static istream
* (*__thiscall p_istream_withassign_ctor
)(istream
*, BOOL
);
375 static void (*__thiscall p_istream_withassign_dtor
)(ios
*);
376 static void (*__thiscall p_istream_withassign_vbase_dtor
)(istream
*);
377 static istream
* (*__thiscall p_istream_withassign_assign_sb
)(istream
*, streambuf
*);
378 static istream
* (*__thiscall p_istream_withassign_assign_is
)(istream
*, const istream
*);
379 static istream
* (*__thiscall p_istream_withassign_assign
)(istream
*, const istream
*);
382 static iostream
* (*__thiscall p_iostream_copy_ctor
)(iostream
*, const iostream
*, BOOL
);
383 static iostream
* (*__thiscall p_iostream_sb_ctor
)(iostream
*, streambuf
*, BOOL
);
384 static iostream
* (*__thiscall p_iostream_ctor
)(iostream
*, BOOL
);
385 static void (*__thiscall p_iostream_dtor
)(ios
*);
386 static void (*__thiscall p_iostream_vbase_dtor
)(iostream
*);
387 static iostream
* (*__thiscall p_iostream_assign_sb
)(iostream
*, streambuf
*);
388 static iostream
* (*__thiscall p_iostream_assign
)(iostream
*, const iostream
*);
391 static void* (*__thiscall p_Iostream_init_ios_ctor
)(void*, ios
*, int);
393 /* Predefined streams */
394 static istream
*p_cin
;
395 static ostream
*p_cout
, *p_cerr
, *p_clog
;
397 /* Emulate a __thiscall */
400 #include "pshpack1.h"
401 struct thiscall_thunk
403 BYTE pop_eax
; /* popl %eax (ret addr) */
404 BYTE pop_edx
; /* popl %edx (func) */
405 BYTE pop_ecx
; /* popl %ecx (this) */
406 BYTE push_eax
; /* pushl %eax */
407 WORD jmp_edx
; /* jmp *%edx */
411 static void * (WINAPI
*call_thiscall_func1
)( void *func
, void *this );
412 static void * (WINAPI
*call_thiscall_func2
)( void *func
, void *this, const void *a
);
413 static void * (WINAPI
*call_thiscall_func3
)( void *func
, void *this, const void *a
, const void *b
);
414 static void * (WINAPI
*call_thiscall_func4
)( void *func
, void *this, const void *a
, const void *b
,
416 static void * (WINAPI
*call_thiscall_func5
)( void *func
, void *this, const void *a
, const void *b
,
417 const void *c
, const void *d
);
418 static void * (WINAPI
*call_thiscall_func2_ptr_dbl
)( void *func
, void *this, double a
);
419 static void * (WINAPI
*call_thiscall_func2_ptr_flt
)( void *func
, void *this, float a
);
421 static void init_thiscall_thunk(void)
423 struct thiscall_thunk
*thunk
= VirtualAlloc( NULL
, sizeof(*thunk
),
424 MEM_COMMIT
, PAGE_EXECUTE_READWRITE
);
425 thunk
->pop_eax
= 0x58; /* popl %eax */
426 thunk
->pop_edx
= 0x5a; /* popl %edx */
427 thunk
->pop_ecx
= 0x59; /* popl %ecx */
428 thunk
->push_eax
= 0x50; /* pushl %eax */
429 thunk
->jmp_edx
= 0xe2ff; /* jmp *%edx */
430 call_thiscall_func1
= (void *)thunk
;
431 call_thiscall_func2
= (void *)thunk
;
432 call_thiscall_func3
= (void *)thunk
;
433 call_thiscall_func4
= (void *)thunk
;
434 call_thiscall_func5
= (void *)thunk
;
435 call_thiscall_func2_ptr_dbl
= (void *)thunk
;
436 call_thiscall_func2_ptr_flt
= (void *)thunk
;
439 #define call_func1(func,_this) call_thiscall_func1(func,_this)
440 #define call_func2(func,_this,a) call_thiscall_func2(func,_this,(const void*)(a))
441 #define call_func3(func,_this,a,b) call_thiscall_func3(func,_this,(const void*)(a),(const void*)(b))
442 #define call_func4(func,_this,a,b,c) call_thiscall_func4(func,_this,(const void*)(a),(const void*)(b), \
444 #define call_func5(func,_this,a,b,c,d) call_thiscall_func5(func,_this,(const void*)(a),(const void*)(b), \
445 (const void*)(c), (const void *)(d))
446 #define call_func2_ptr_dbl(func,_this,a) call_thiscall_func2_ptr_dbl(func,_this,a)
447 #define call_func2_ptr_flt(func,_this,a) call_thiscall_func2_ptr_flt(func,_this,a)
451 #define init_thiscall_thunk()
452 #define call_func1(func,_this) func(_this)
453 #define call_func2(func,_this,a) func(_this,a)
454 #define call_func3(func,_this,a,b) func(_this,a,b)
455 #define call_func4(func,_this,a,b,c) func(_this,a,b,c)
456 #define call_func5(func,_this,a,b,c,d) func(_this,a,b,c,d)
457 #define call_func2_ptr_dbl call_func2
458 #define call_func2_ptr_flt call_func2
460 #endif /* __i386__ */
462 static HMODULE msvcrt
, msvcirt
;
463 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcirt,y)
464 #define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
465 static BOOL
init(void)
467 msvcrt
= LoadLibraryA("msvcrt.dll");
468 msvcirt
= LoadLibraryA("msvcirt.dll");
470 win_skip("msvcirt.dll not installed\n");
474 if(sizeof(void*) == 8) { /* 64-bit initialization */
475 p_operator_new
= (void*)GetProcAddress(msvcrt
, "??2@YAPEAX_K@Z");
476 p_operator_delete
= (void*)GetProcAddress(msvcrt
, "??3@YAXPEAX@Z");
478 SET(p_streambuf_reserve_ctor
, "??0streambuf@@IEAA@PEADH@Z");
479 SET(p_streambuf_ctor
, "??0streambuf@@IEAA@XZ");
480 SET(p_streambuf_dtor
, "??1streambuf@@UEAA@XZ");
481 SET(p_streambuf_allocate
, "?allocate@streambuf@@IEAAHXZ");
482 SET(p_streambuf_clrclock
, "?clrlock@streambuf@@QEAAXXZ");
483 SET(p_streambuf_doallocate
, "?doallocate@streambuf@@MEAAHXZ");
484 SET(p_streambuf_gbump
, "?gbump@streambuf@@IEAAXH@Z");
485 SET(p_streambuf_in_avail
, "?in_avail@streambuf@@QEBAHXZ");
486 SET(p_streambuf_lock
, "?lock@streambuf@@QEAAXXZ");
487 SET(p_streambuf_out_waiting
, "?out_waiting@streambuf@@QEBAHXZ");
488 SET(p_streambuf_pbackfail
, "?pbackfail@streambuf@@UEAAHH@Z");
489 SET(p_streambuf_pbump
, "?pbump@streambuf@@IEAAXH@Z");
490 SET(p_streambuf_sbumpc
, "?sbumpc@streambuf@@QEAAHXZ");
491 SET(p_streambuf_setb
, "?setb@streambuf@@IEAAXPEAD0H@Z");
492 SET(p_streambuf_setbuf
, "?setbuf@streambuf@@UEAAPEAV1@PEADH@Z");
493 SET(p_streambuf_setlock
, "?setlock@streambuf@@QEAAXXZ");
494 SET(p_streambuf_sgetc
, "?sgetc@streambuf@@QEAAHXZ");
495 SET(p_streambuf_snextc
, "?snextc@streambuf@@QEAAHXZ");
496 SET(p_streambuf_sputc
, "?sputc@streambuf@@QEAAHH@Z");
497 SET(p_streambuf_stossc
, "?stossc@streambuf@@QEAAXXZ");
498 SET(p_streambuf_sync
, "?sync@streambuf@@UEAAHXZ");
499 SET(p_streambuf_unlock
, "?unlock@streambuf@@QEAAXXZ");
500 SET(p_streambuf_xsgetn
, "?xsgetn@streambuf@@UEAAHPEADH@Z");
501 SET(p_streambuf_xsputn
, "?xsputn@streambuf@@UEAAHPEBDH@Z");
503 SET(p_filebuf_fd_ctor
, "??0filebuf@@QEAA@H@Z");
504 SET(p_filebuf_fd_reserve_ctor
, "??0filebuf@@QEAA@HPEADH@Z");
505 SET(p_filebuf_ctor
, "??0filebuf@@QEAA@XZ");
506 SET(p_filebuf_dtor
, "??1filebuf@@UEAA@XZ");
507 SET(p_filebuf_attach
, "?attach@filebuf@@QEAAPEAV1@H@Z");
508 SET(p_filebuf_open
, "?open@filebuf@@QEAAPEAV1@PEBDHH@Z");
509 SET(p_filebuf_close
, "?close@filebuf@@QEAAPEAV1@XZ");
510 SET(p_filebuf_setmode
, "?setmode@filebuf@@QEAAHH@Z");
511 SET(p_filebuf_setbuf
, "?setbuf@filebuf@@UEAAPEAVstreambuf@@PEADH@Z");
512 SET(p_filebuf_sync
, "?sync@filebuf@@UEAAHXZ");
513 SET(p_filebuf_overflow
, "?overflow@filebuf@@UEAAHH@Z");
514 SET(p_filebuf_underflow
, "?underflow@filebuf@@UEAAHXZ");
515 SET(p_filebuf_seekoff
, "?seekoff@filebuf@@UEAAJJW4seek_dir@ios@@H@Z");
517 SET(p_strstreambuf_dynamic_ctor
, "??0strstreambuf@@QEAA@H@Z");
518 SET(p_strstreambuf_funcs_ctor
, "??0strstreambuf@@QEAA@P6APEAXJ@ZP6AXPEAX@Z@Z");
519 SET(p_strstreambuf_buffer_ctor
, "??0strstreambuf@@QEAA@PEADH0@Z");
520 SET(p_strstreambuf_ubuffer_ctor
, "??0strstreambuf@@QEAA@PEAEH0@Z");
521 SET(p_strstreambuf_ctor
, "??0strstreambuf@@QEAA@XZ");
522 SET(p_strstreambuf_dtor
, "??1strstreambuf@@UEAA@XZ");
523 SET(p_strstreambuf_doallocate
, "?doallocate@strstreambuf@@MEAAHXZ");
524 SET(p_strstreambuf_freeze
, "?freeze@strstreambuf@@QEAAXH@Z");
525 SET(p_strstreambuf_overflow
, "?overflow@strstreambuf@@UEAAHH@Z");
526 SET(p_strstreambuf_seekoff
, "?seekoff@strstreambuf@@UEAAJJW4seek_dir@ios@@H@Z");
527 SET(p_strstreambuf_setbuf
, "?setbuf@strstreambuf@@UEAAPEAVstreambuf@@PEADH@Z");
528 SET(p_strstreambuf_underflow
, "?underflow@strstreambuf@@UEAAHXZ");
530 SET(p_stdiobuf_file_ctor
, "??0stdiobuf@@QEAA@PEAU_iobuf@@@Z");
531 SET(p_stdiobuf_dtor
, "??1stdiobuf@@UEAA@XZ");
532 SET(p_stdiobuf_overflow
, "?overflow@stdiobuf@@UEAAHH@Z");
533 SET(p_stdiobuf_pbackfail
, "?pbackfail@stdiobuf@@UEAAHH@Z");
534 SET(p_stdiobuf_seekoff
, "?seekoff@stdiobuf@@UEAAJJW4seek_dir@ios@@H@Z");
535 SET(p_stdiobuf_setrwbuf
, "?setrwbuf@stdiobuf@@QEAAHHH@Z");
536 SET(p_stdiobuf_sync
, "?sync@stdiobuf@@UEAAHXZ");
537 SET(p_stdiobuf_underflow
, "?underflow@stdiobuf@@UEAAHXZ");
539 SET(p_ios_copy_ctor
, "??0ios@@IEAA@AEBV0@@Z");
540 SET(p_ios_ctor
, "??0ios@@IEAA@XZ");
541 SET(p_ios_sb_ctor
, "??0ios@@QEAA@PEAVstreambuf@@@Z");
542 SET(p_ios_assign
, "??4ios@@IEAAAEAV0@AEBV0@@Z");
543 SET(p_ios_init
, "?init@ios@@IEAAXPEAVstreambuf@@@Z");
544 SET(p_ios_dtor
, "??1ios@@UEAA@XZ");
545 SET(p_ios_clrlock
, "?clrlock@ios@@QEAAXXZ");
546 SET(p_ios_setlock
, "?setlock@ios@@QEAAXXZ");
547 SET(p_ios_lock
, "?lock@ios@@QEAAXXZ");
548 SET(p_ios_unlock
, "?unlock@ios@@QEAAXXZ");
549 SET(p_ios_lockbuf
, "?lockbuf@ios@@QEAAXXZ");
550 SET(p_ios_unlockbuf
, "?unlockbuf@ios@@QEAAXXZ");
551 SET(p_ios_flags_set
, "?flags@ios@@QEAAJJ@Z");
552 SET(p_ios_flags_get
, "?flags@ios@@QEBAJXZ");
553 SET(p_ios_setf
, "?setf@ios@@QEAAJJ@Z");
554 SET(p_ios_setf_mask
, "?setf@ios@@QEAAJJJ@Z");
555 SET(p_ios_unsetf
, "?unsetf@ios@@QEAAJJ@Z");
556 SET(p_ios_good
, "?good@ios@@QEBAHXZ");
557 SET(p_ios_bad
, "?bad@ios@@QEBAHXZ");
558 SET(p_ios_eof
, "?eof@ios@@QEBAHXZ");
559 SET(p_ios_fail
, "?fail@ios@@QEBAHXZ");
560 SET(p_ios_clear
, "?clear@ios@@QEAAXH@Z");
561 SET(p_ios_iword
, "?iword@ios@@QEBAAEAJH@Z");
562 SET(p_ios_pword
, "?pword@ios@@QEBAAEAPEAXH@Z");
564 SET(p_ostream_copy_ctor
, "??0ostream@@IEAA@AEBV0@@Z");
565 SET(p_ostream_sb_ctor
, "??0ostream@@QEAA@PEAVstreambuf@@@Z");
566 SET(p_ostream_ctor
, "??0ostream@@IEAA@XZ");
567 SET(p_ostream_dtor
, "??1ostream@@UEAA@XZ");
568 SET(p_ostream_assign
, "??4ostream@@IEAAAEAV0@AEBV0@@Z");
569 SET(p_ostream_assign_sb
, "??4ostream@@IEAAAEAV0@PEAVstreambuf@@@Z");
570 SET(p_ostream_vbase_dtor
, "??_Dostream@@QEAAXXZ");
571 SET(p_ostream_flush
, "?flush@ostream@@QEAAAEAV1@XZ");
572 SET(p_ostream_opfx
, "?opfx@ostream@@QEAAHXZ");
573 SET(p_ostream_osfx
, "?osfx@ostream@@QEAAXXZ");
574 SET(p_ostream_put_char
, "?put@ostream@@QEAAAEAV1@D@Z");
575 SET(p_ostream_write_char
, "?write@ostream@@QEAAAEAV1@PEBDH@Z");
576 SET(p_ostream_seekp_offset
, "?seekp@ostream@@QEAAAEAV1@JW4seek_dir@ios@@@Z");
577 SET(p_ostream_seekp
, "?seekp@ostream@@QEAAAEAV1@J@Z");
578 SET(p_ostream_tellp
, "?tellp@ostream@@QEAAJXZ");
579 SET(p_ostream_writepad
, "?writepad@ostream@@AEAAAEAV1@PEBD0@Z");
580 SET(p_ostream_print_char
, "??6ostream@@QEAAAEAV0@D@Z");
581 SET(p_ostream_print_str
, "??6ostream@@QEAAAEAV0@PEBD@Z");
582 SET(p_ostream_print_int
, "??6ostream@@QEAAAEAV0@H@Z");
583 SET(p_ostream_print_float
, "??6ostream@@QEAAAEAV0@M@Z");
584 SET(p_ostream_print_double
, "??6ostream@@QEAAAEAV0@N@Z");
585 SET(p_ostream_print_ptr
, "??6ostream@@QEAAAEAV0@PEBX@Z");
586 SET(p_ostream_print_streambuf
, "??6ostream@@QEAAAEAV0@PEAVstreambuf@@@Z");
588 SET(p_ostream_withassign_sb_ctor
, "??0ostream_withassign@@QEAA@PEAVstreambuf@@@Z");
589 SET(p_ostream_withassign_copy_ctor
, "??0ostream_withassign@@QEAA@AEBV0@@Z");
590 SET(p_ostream_withassign_ctor
, "??0ostream_withassign@@QEAA@XZ");
591 SET(p_ostream_withassign_dtor
, "??1ostream_withassign@@UEAA@XZ");
592 SET(p_ostream_withassign_vbase_dtor
, "??_Dostream_withassign@@QEAAXXZ");
593 SET(p_ostream_withassign_assign_sb
, "??4ostream_withassign@@QEAAAEAVostream@@PEAVstreambuf@@@Z");
594 SET(p_ostream_withassign_assign_os
, "??4ostream_withassign@@QEAAAEAVostream@@AEBV1@@Z");
595 SET(p_ostream_withassign_assign
, "??4ostream_withassign@@QEAAAEAV0@AEBV0@@Z");
597 SET(p_istream_copy_ctor
, "??0istream@@IEAA@AEBV0@@Z");
598 SET(p_istream_ctor
, "??0istream@@IEAA@XZ");
599 SET(p_istream_sb_ctor
, "??0istream@@QEAA@PEAVstreambuf@@@Z");
600 SET(p_istream_dtor
, "??1istream@@UEAA@XZ");
601 SET(p_istream_assign_sb
, "??4istream@@IEAAAEAV0@PEAVstreambuf@@@Z");
602 SET(p_istream_assign
, "??4istream@@IEAAAEAV0@AEBV0@@Z");
603 SET(p_istream_vbase_dtor
, "??_Distream@@QEAAXXZ");
604 SET(p_istream_eatwhite
, "?eatwhite@istream@@QEAAXXZ");
605 SET(p_istream_ipfx
, "?ipfx@istream@@QEAAHH@Z");
606 SET(p_istream_get_str_delim
, "?get@istream@@IEAAAEAV1@PEADHH@Z");
607 SET(p_istream_get_str
, "?get@istream@@QEAAAEAV1@PEADHD@Z");
608 SET(p_istream_get
, "?get@istream@@QEAAHXZ");
609 SET(p_istream_get_char
, "?get@istream@@QEAAAEAV1@AEAD@Z");
610 SET(p_istream_get_sb
, "?get@istream@@QEAAAEAV1@AEAVstreambuf@@D@Z");
611 SET(p_istream_getline
, "?getline@istream@@QEAAAEAV1@PEADHD@Z");
612 SET(p_istream_ignore
, "?ignore@istream@@QEAAAEAV1@HH@Z");
613 SET(p_istream_peek
, "?peek@istream@@QEAAHXZ");
614 SET(p_istream_putback
, "?putback@istream@@QEAAAEAV1@D@Z");
615 SET(p_istream_read
, "?read@istream@@QEAAAEAV1@PEADH@Z");
616 SET(p_istream_seekg
, "?seekg@istream@@QEAAAEAV1@J@Z");
617 SET(p_istream_seekg_offset
, "?seekg@istream@@QEAAAEAV1@JW4seek_dir@ios@@@Z");
618 SET(p_istream_sync
, "?sync@istream@@QEAAHXZ");
619 SET(p_istream_tellg
, "?tellg@istream@@QEAAJXZ");
620 SET(p_istream_getint
, "?getint@istream@@AEAAHPEAD@Z");
621 SET(p_istream_getdouble
, "?getdouble@istream@@AEAAHPEADH@Z");
622 SET(p_istream_read_char
, "??5istream@@QEAAAEAV0@AEAD@Z");
623 SET(p_istream_read_str
, "??5istream@@QEAAAEAV0@PEAD@Z");
624 SET(p_istream_read_short
, "??5istream@@QEAAAEAV0@AEAF@Z");
625 SET(p_istream_read_unsigned_short
, "??5istream@@QEAAAEAV0@AEAG@Z");
626 SET(p_istream_read_int
, "??5istream@@QEAAAEAV0@AEAH@Z");
627 SET(p_istream_read_unsigned_int
, "??5istream@@QEAAAEAV0@AEAI@Z");
628 SET(p_istream_read_long
, "??5istream@@QEAAAEAV0@AEAJ@Z");
629 SET(p_istream_read_unsigned_long
, "??5istream@@QEAAAEAV0@AEAK@Z");
630 SET(p_istream_read_float
, "??5istream@@QEAAAEAV0@AEAM@Z");
631 SET(p_istream_read_double
, "??5istream@@QEAAAEAV0@AEAN@Z");
632 SET(p_istream_read_long_double
, "??5istream@@QEAAAEAV0@AEAO@Z");
633 SET(p_istream_read_streambuf
, "??5istream@@QEAAAEAV0@PEAVstreambuf@@@Z");
635 SET(p_istream_withassign_sb_ctor
, "??0istream_withassign@@QEAA@PEAVstreambuf@@@Z");
636 SET(p_istream_withassign_copy_ctor
, "??0istream_withassign@@QEAA@AEBV0@@Z");
637 SET(p_istream_withassign_ctor
, "??0istream_withassign@@QEAA@XZ");
638 SET(p_istream_withassign_dtor
, "??1ostream_withassign@@UEAA@XZ");
639 SET(p_istream_withassign_vbase_dtor
, "??_Distream_withassign@@QEAAXXZ");
640 SET(p_istream_withassign_assign_sb
, "??4istream_withassign@@QEAAAEAVistream@@PEAVstreambuf@@@Z");
641 SET(p_istream_withassign_assign_is
, "??4istream_withassign@@QEAAAEAVistream@@AEBV1@@Z");
642 SET(p_istream_withassign_assign
, "??4istream_withassign@@QEAAAEAV0@AEBV0@@Z");
644 SET(p_iostream_copy_ctor
, "??0iostream@@IEAA@AEBV0@@Z");
645 SET(p_iostream_sb_ctor
, "??0iostream@@QEAA@PEAVstreambuf@@@Z");
646 SET(p_iostream_ctor
, "??0iostream@@IEAA@XZ");
647 SET(p_iostream_dtor
, "??1iostream@@UEAA@XZ");
648 SET(p_iostream_vbase_dtor
, "??_Diostream@@QEAAXXZ");
649 SET(p_iostream_assign_sb
, "??4iostream@@IEAAAEAV0@PEAVstreambuf@@@Z");
650 SET(p_iostream_assign
, "??4iostream@@IEAAAEAV0@AEAV0@@Z");
652 SET(p_Iostream_init_ios_ctor
, "??0Iostream_init@@QEAA@AEAVios@@H@Z");
654 p_operator_new
= (void*)GetProcAddress(msvcrt
, "??2@YAPAXI@Z");
655 p_operator_delete
= (void*)GetProcAddress(msvcrt
, "??3@YAXPAX@Z");
657 SET(p_streambuf_reserve_ctor
, "??0streambuf@@IAE@PADH@Z");
658 SET(p_streambuf_ctor
, "??0streambuf@@IAE@XZ");
659 SET(p_streambuf_dtor
, "??1streambuf@@UAE@XZ");
660 SET(p_streambuf_allocate
, "?allocate@streambuf@@IAEHXZ");
661 SET(p_streambuf_clrclock
, "?clrlock@streambuf@@QAEXXZ");
662 SET(p_streambuf_doallocate
, "?doallocate@streambuf@@MAEHXZ");
663 SET(p_streambuf_gbump
, "?gbump@streambuf@@IAEXH@Z");
664 SET(p_streambuf_in_avail
, "?in_avail@streambuf@@QBEHXZ");
665 SET(p_streambuf_lock
, "?lock@streambuf@@QAEXXZ");
666 SET(p_streambuf_out_waiting
, "?out_waiting@streambuf@@QBEHXZ");
667 SET(p_streambuf_pbackfail
, "?pbackfail@streambuf@@UAEHH@Z");
668 SET(p_streambuf_pbump
, "?pbump@streambuf@@IAEXH@Z");
669 SET(p_streambuf_sbumpc
, "?sbumpc@streambuf@@QAEHXZ");
670 SET(p_streambuf_setb
, "?setb@streambuf@@IAEXPAD0H@Z");
671 SET(p_streambuf_setbuf
, "?setbuf@streambuf@@UAEPAV1@PADH@Z");
672 SET(p_streambuf_setlock
, "?setlock@streambuf@@QAEXXZ");
673 SET(p_streambuf_sgetc
, "?sgetc@streambuf@@QAEHXZ");
674 SET(p_streambuf_snextc
, "?snextc@streambuf@@QAEHXZ");
675 SET(p_streambuf_sputc
, "?sputc@streambuf@@QAEHH@Z");
676 SET(p_streambuf_stossc
, "?stossc@streambuf@@QAEXXZ");
677 SET(p_streambuf_sync
, "?sync@streambuf@@UAEHXZ");
678 SET(p_streambuf_unlock
, "?unlock@streambuf@@QAEXXZ");
679 SET(p_streambuf_xsgetn
, "?xsgetn@streambuf@@UAEHPADH@Z");
680 SET(p_streambuf_xsputn
, "?xsputn@streambuf@@UAEHPBDH@Z");
682 SET(p_filebuf_fd_ctor
, "??0filebuf@@QAE@H@Z");
683 SET(p_filebuf_fd_reserve_ctor
, "??0filebuf@@QAE@HPADH@Z");
684 SET(p_filebuf_ctor
, "??0filebuf@@QAE@XZ");
685 SET(p_filebuf_dtor
, "??1filebuf@@UAE@XZ");
686 SET(p_filebuf_attach
, "?attach@filebuf@@QAEPAV1@H@Z");
687 SET(p_filebuf_open
, "?open@filebuf@@QAEPAV1@PBDHH@Z");
688 SET(p_filebuf_close
, "?close@filebuf@@QAEPAV1@XZ");
689 SET(p_filebuf_setmode
, "?setmode@filebuf@@QAEHH@Z");
690 SET(p_filebuf_setbuf
, "?setbuf@filebuf@@UAEPAVstreambuf@@PADH@Z");
691 SET(p_filebuf_sync
, "?sync@filebuf@@UAEHXZ");
692 SET(p_filebuf_overflow
, "?overflow@filebuf@@UAEHH@Z");
693 SET(p_filebuf_underflow
, "?underflow@filebuf@@UAEHXZ");
694 SET(p_filebuf_seekoff
, "?seekoff@filebuf@@UAEJJW4seek_dir@ios@@H@Z");
696 SET(p_strstreambuf_dynamic_ctor
, "??0strstreambuf@@QAE@H@Z");
697 SET(p_strstreambuf_funcs_ctor
, "??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z");
698 SET(p_strstreambuf_buffer_ctor
, "??0strstreambuf@@QAE@PADH0@Z");
699 SET(p_strstreambuf_ubuffer_ctor
, "??0strstreambuf@@QAE@PAEH0@Z");
700 SET(p_strstreambuf_ctor
, "??0strstreambuf@@QAE@XZ");
701 SET(p_strstreambuf_dtor
, "??1strstreambuf@@UAE@XZ");
702 SET(p_strstreambuf_doallocate
, "?doallocate@strstreambuf@@MAEHXZ");
703 SET(p_strstreambuf_freeze
, "?freeze@strstreambuf@@QAEXH@Z");
704 SET(p_strstreambuf_overflow
, "?overflow@strstreambuf@@UAEHH@Z");
705 SET(p_strstreambuf_seekoff
, "?seekoff@strstreambuf@@UAEJJW4seek_dir@ios@@H@Z");
706 SET(p_strstreambuf_setbuf
, "?setbuf@strstreambuf@@UAEPAVstreambuf@@PADH@Z");
707 SET(p_strstreambuf_underflow
, "?underflow@strstreambuf@@UAEHXZ");
709 SET(p_stdiobuf_file_ctor
, "??0stdiobuf@@QAE@PAU_iobuf@@@Z");
710 SET(p_stdiobuf_dtor
, "??1stdiobuf@@UAE@XZ");
711 SET(p_stdiobuf_overflow
, "?overflow@stdiobuf@@UAEHH@Z");
712 SET(p_stdiobuf_pbackfail
, "?pbackfail@stdiobuf@@UAEHH@Z");
713 SET(p_stdiobuf_seekoff
, "?seekoff@stdiobuf@@UAEJJW4seek_dir@ios@@H@Z");
714 SET(p_stdiobuf_setrwbuf
, "?setrwbuf@stdiobuf@@QAEHHH@Z");
715 SET(p_stdiobuf_sync
, "?sync@stdiobuf@@UAEHXZ");
716 SET(p_stdiobuf_underflow
, "?underflow@stdiobuf@@UAEHXZ");
718 SET(p_ios_copy_ctor
, "??0ios@@IAE@ABV0@@Z");
719 SET(p_ios_ctor
, "??0ios@@IAE@XZ");
720 SET(p_ios_sb_ctor
, "??0ios@@QAE@PAVstreambuf@@@Z");
721 SET(p_ios_assign
, "??4ios@@IAEAAV0@ABV0@@Z");
722 SET(p_ios_init
, "?init@ios@@IAEXPAVstreambuf@@@Z");
723 SET(p_ios_dtor
, "??1ios@@UAE@XZ");
724 SET(p_ios_clrlock
, "?clrlock@ios@@QAAXXZ");
725 SET(p_ios_setlock
, "?setlock@ios@@QAAXXZ");
726 SET(p_ios_lock
, "?lock@ios@@QAAXXZ");
727 SET(p_ios_unlock
, "?unlock@ios@@QAAXXZ");
728 SET(p_ios_lockbuf
, "?lockbuf@ios@@QAAXXZ");
729 SET(p_ios_unlockbuf
, "?unlockbuf@ios@@QAAXXZ");
730 SET(p_ios_flags_set
, "?flags@ios@@QAEJJ@Z");
731 SET(p_ios_flags_get
, "?flags@ios@@QBEJXZ");
732 SET(p_ios_setf
, "?setf@ios@@QAEJJ@Z");
733 SET(p_ios_setf_mask
, "?setf@ios@@QAEJJJ@Z");
734 SET(p_ios_unsetf
, "?unsetf@ios@@QAEJJ@Z");
735 SET(p_ios_good
, "?good@ios@@QBEHXZ");
736 SET(p_ios_bad
, "?bad@ios@@QBEHXZ");
737 SET(p_ios_eof
, "?eof@ios@@QBEHXZ");
738 SET(p_ios_fail
, "?fail@ios@@QBEHXZ");
739 SET(p_ios_clear
, "?clear@ios@@QAEXH@Z");
740 SET(p_ios_iword
, "?iword@ios@@QBEAAJH@Z");
741 SET(p_ios_pword
, "?pword@ios@@QBEAAPAXH@Z");
743 SET(p_ostream_copy_ctor
, "??0ostream@@IAE@ABV0@@Z");
744 SET(p_ostream_sb_ctor
, "??0ostream@@QAE@PAVstreambuf@@@Z");
745 SET(p_ostream_ctor
, "??0ostream@@IAE@XZ");
746 SET(p_ostream_dtor
, "??1ostream@@UAE@XZ");
747 SET(p_ostream_assign
, "??4ostream@@IAEAAV0@ABV0@@Z");
748 SET(p_ostream_assign_sb
, "??4ostream@@IAEAAV0@PAVstreambuf@@@Z");
749 SET(p_ostream_vbase_dtor
, "??_Dostream@@QAEXXZ");
750 SET(p_ostream_flush
, "?flush@ostream@@QAEAAV1@XZ");
751 SET(p_ostream_opfx
, "?opfx@ostream@@QAEHXZ");
752 SET(p_ostream_osfx
, "?osfx@ostream@@QAEXXZ");
753 SET(p_ostream_put_char
, "?put@ostream@@QAEAAV1@D@Z");
754 SET(p_ostream_write_char
, "?write@ostream@@QAEAAV1@PBDH@Z");
755 SET(p_ostream_seekp_offset
, "?seekp@ostream@@QAEAAV1@JW4seek_dir@ios@@@Z");
756 SET(p_ostream_seekp
, "?seekp@ostream@@QAEAAV1@J@Z");
757 SET(p_ostream_tellp
, "?tellp@ostream@@QAEJXZ");
758 SET(p_ostream_writepad
, "?writepad@ostream@@AAEAAV1@PBD0@Z");
759 SET(p_ostream_print_char
, "??6ostream@@QAEAAV0@D@Z");
760 SET(p_ostream_print_str
, "??6ostream@@QAEAAV0@PBD@Z");
761 SET(p_ostream_print_int
, "??6ostream@@QAEAAV0@H@Z");
762 SET(p_ostream_print_float
, "??6ostream@@QAEAAV0@M@Z");
763 SET(p_ostream_print_double
, "??6ostream@@QAEAAV0@N@Z");
764 SET(p_ostream_print_ptr
, "??6ostream@@QAEAAV0@PBX@Z");
765 SET(p_ostream_print_streambuf
, "??6ostream@@QAEAAV0@PAVstreambuf@@@Z");
767 SET(p_ostream_withassign_sb_ctor
, "??0ostream_withassign@@QAE@PAVstreambuf@@@Z");
768 SET(p_ostream_withassign_copy_ctor
, "??0ostream_withassign@@QAE@ABV0@@Z");
769 SET(p_ostream_withassign_ctor
, "??0ostream_withassign@@QAE@XZ");
770 SET(p_ostream_withassign_dtor
, "??1ostream_withassign@@UAE@XZ");
771 SET(p_ostream_withassign_vbase_dtor
, "??_Dostream_withassign@@QAEXXZ");
772 SET(p_ostream_withassign_assign_sb
, "??4ostream_withassign@@QAEAAVostream@@PAVstreambuf@@@Z");
773 SET(p_ostream_withassign_assign_os
, "??4ostream_withassign@@QAEAAVostream@@ABV1@@Z");
774 SET(p_ostream_withassign_assign
, "??4ostream_withassign@@QAEAAV0@ABV0@@Z");
776 SET(p_istream_copy_ctor
, "??0istream@@IAE@ABV0@@Z");
777 SET(p_istream_ctor
, "??0istream@@IAE@XZ");
778 SET(p_istream_sb_ctor
, "??0istream@@QAE@PAVstreambuf@@@Z");
779 SET(p_istream_dtor
, "??1istream@@UAE@XZ");
780 SET(p_istream_assign_sb
, "??4istream@@IAEAAV0@PAVstreambuf@@@Z");
781 SET(p_istream_assign
, "??4istream@@IAEAAV0@ABV0@@Z");
782 SET(p_istream_vbase_dtor
, "??_Distream@@QAEXXZ");
783 SET(p_istream_eatwhite
, "?eatwhite@istream@@QAEXXZ");
784 SET(p_istream_ipfx
, "?ipfx@istream@@QAEHH@Z");
785 SET(p_istream_get_str_delim
, "?get@istream@@IAEAAV1@PADHH@Z");
786 SET(p_istream_get_str
, "?get@istream@@QAEAAV1@PADHD@Z");
787 SET(p_istream_get
, "?get@istream@@QAEHXZ");
788 SET(p_istream_get_char
, "?get@istream@@QAEAAV1@AAD@Z");
789 SET(p_istream_get_sb
, "?get@istream@@QAEAAV1@AAVstreambuf@@D@Z");
790 SET(p_istream_getline
, "?getline@istream@@QAEAAV1@PADHD@Z");
791 SET(p_istream_ignore
, "?ignore@istream@@QAEAAV1@HH@Z");
792 SET(p_istream_peek
, "?peek@istream@@QAEHXZ");
793 SET(p_istream_putback
, "?putback@istream@@QAEAAV1@D@Z");
794 SET(p_istream_read
, "?read@istream@@QAEAAV1@PADH@Z");
795 SET(p_istream_seekg
, "?seekg@istream@@QAEAAV1@J@Z");
796 SET(p_istream_seekg_offset
, "?seekg@istream@@QAEAAV1@JW4seek_dir@ios@@@Z");
797 SET(p_istream_sync
, "?sync@istream@@QAEHXZ");
798 SET(p_istream_tellg
, "?tellg@istream@@QAEJXZ");
799 SET(p_istream_getint
, "?getint@istream@@AAEHPAD@Z");
800 SET(p_istream_getdouble
, "?getdouble@istream@@AAEHPADH@Z");
801 SET(p_istream_read_char
, "??5istream@@QAEAAV0@AAD@Z");
802 SET(p_istream_read_str
, "??5istream@@QAEAAV0@PAD@Z");
803 SET(p_istream_read_short
, "??5istream@@QAEAAV0@AAF@Z");
804 SET(p_istream_read_unsigned_short
, "??5istream@@QAEAAV0@AAG@Z");
805 SET(p_istream_read_int
, "??5istream@@QAEAAV0@AAH@Z");
806 SET(p_istream_read_unsigned_int
, "??5istream@@QAEAAV0@AAI@Z");
807 SET(p_istream_read_long
, "??5istream@@QAEAAV0@AAJ@Z");
808 SET(p_istream_read_unsigned_long
, "??5istream@@QAEAAV0@AAK@Z");
809 SET(p_istream_read_float
, "??5istream@@QAEAAV0@AAM@Z");
810 SET(p_istream_read_double
, "??5istream@@QAEAAV0@AAN@Z");
811 SET(p_istream_read_long_double
, "??5istream@@QAEAAV0@AAO@Z");
812 SET(p_istream_read_streambuf
, "??5istream@@QAEAAV0@PAVstreambuf@@@Z");
814 SET(p_istream_withassign_sb_ctor
, "??0istream_withassign@@QAE@PAVstreambuf@@@Z");
815 SET(p_istream_withassign_copy_ctor
, "??0istream_withassign@@QAE@ABV0@@Z");
816 SET(p_istream_withassign_ctor
, "??0istream_withassign@@QAE@XZ");
817 SET(p_istream_withassign_dtor
, "??1istream_withassign@@UAE@XZ");
818 SET(p_istream_withassign_vbase_dtor
, "??_Distream_withassign@@QAEXXZ");
819 SET(p_istream_withassign_assign_sb
, "??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z");
820 SET(p_istream_withassign_assign_is
, "??4istream_withassign@@QAEAAVistream@@ABV1@@Z");
821 SET(p_istream_withassign_assign
, "??4istream_withassign@@QAEAAV0@ABV0@@Z");
823 SET(p_iostream_copy_ctor
, "??0iostream@@IAE@ABV0@@Z");
824 SET(p_iostream_sb_ctor
, "??0iostream@@QAE@PAVstreambuf@@@Z");
825 SET(p_iostream_ctor
, "??0iostream@@IAE@XZ");
826 SET(p_iostream_dtor
, "??1iostream@@UAE@XZ");
827 SET(p_iostream_vbase_dtor
, "??_Diostream@@QAEXXZ");
828 SET(p_iostream_assign_sb
, "??4iostream@@IAEAAV0@PAVstreambuf@@@Z");
829 SET(p_iostream_assign
, "??4iostream@@IAEAAV0@AAV0@@Z");
831 SET(p_Iostream_init_ios_ctor
, "??0Iostream_init@@QAE@AAVios@@H@Z");
833 SET(p_ios_static_lock
, "?x_lockc@ios@@0U_CRT_CRITICAL_SECTION@@A");
834 SET(p_ios_lockc
, "?lockc@ios@@KAXXZ");
835 SET(p_ios_unlockc
, "?unlockc@ios@@KAXXZ");
836 SET(p_ios_maxbit
, "?x_maxbit@ios@@0JA");
837 SET(p_ios_bitalloc
, "?bitalloc@ios@@SAJXZ");
838 SET(p_ios_curindex
, "?x_curindex@ios@@0HA");
839 SET(p_ios_statebuf
, "?x_statebuf@ios@@0PAJA");
840 SET(p_ios_xalloc
, "?xalloc@ios@@SAHXZ");
841 SET(p_ios_sync_with_stdio
, "?sync_with_stdio@ios@@SAXXZ");
842 SET(p_ios_sunk_with_stdio
, "?sunk_with_stdio@ios@@0HA");
843 SET(p_ios_fLockcInit
, "?fLockcInit@ios@@0HA");
844 SET(p_cin
, "?cin@@3Vistream_withassign@@A");
845 SET(p_cout
, "?cout@@3Vostream_withassign@@A");
846 SET(p_cerr
, "?cerr@@3Vostream_withassign@@A");
847 SET(p_clog
, "?clog@@3Vostream_withassign@@A");
849 init_thiscall_thunk();
853 static int overflow_count
, underflow_count
;
854 static streambuf
*test_this
;
855 static char test_get_buffer
[24];
856 static int buffer_pos
, get_end
;
859 static int __thiscall
test_streambuf_overflow(int ch
)
861 static int __thiscall
test_streambuf_overflow(streambuf
*this, int ch
)
865 if (ch
== 'L') /* simulate a failure */
867 if (!test_this
->unbuffered
)
868 test_this
->pptr
= test_this
->pbase
+ 5;
873 static int __thiscall
test_streambuf_underflow(void)
875 static int __thiscall
test_streambuf_underflow(streambuf
*this)
879 if (test_this
->unbuffered
) {
880 return (buffer_pos
< 23) ? test_get_buffer
[buffer_pos
++] : EOF
;
881 } else if (test_this
->gptr
< test_this
->egptr
) {
882 return *test_this
->gptr
;
884 return get_end
? EOF
: *(test_this
->gptr
= test_this
->eback
);
888 struct streambuf_lock_arg
895 static DWORD WINAPI
lock_streambuf(void *arg
)
897 struct streambuf_lock_arg
*lock_arg
= arg
;
898 call_func1(p_streambuf_lock
, lock_arg
->sb
);
899 SetEvent(lock_arg
->lock
[0]);
900 WaitForSingleObject(lock_arg
->test
[0], INFINITE
);
901 call_func1(p_streambuf_lock
, lock_arg
->sb
);
902 SetEvent(lock_arg
->lock
[1]);
903 WaitForSingleObject(lock_arg
->test
[1], INFINITE
);
904 call_func1(p_streambuf_lock
, lock_arg
->sb
);
905 SetEvent(lock_arg
->lock
[2]);
906 WaitForSingleObject(lock_arg
->test
[2], INFINITE
);
907 call_func1(p_streambuf_unlock
, lock_arg
->sb
);
908 SetEvent(lock_arg
->lock
[3]);
909 WaitForSingleObject(lock_arg
->test
[3], INFINITE
);
910 call_func1(p_streambuf_unlock
, lock_arg
->sb
);
914 static void test_streambuf(void)
916 streambuf sb
, sb2
, sb3
, *psb
;
917 vtable_ptr test_streambuf_vtbl
[11];
918 struct streambuf_lock_arg lock_arg
;
924 memset(&sb
, 0xab, sizeof(streambuf
));
925 memset(&sb2
, 0xab, sizeof(streambuf
));
926 memset(&sb3
, 0xab, sizeof(streambuf
));
929 call_func1(p_streambuf_ctor
, &sb
);
930 ok(sb
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", sb
.allocated
);
931 ok(sb
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb
.unbuffered
);
932 ok(sb
.base
== NULL
, "wrong base pointer, expected %p got %p\n", NULL
, sb
.base
);
933 ok(sb
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, sb
.ebuf
);
934 ok(sb
.lock
.LockCount
== -1, "wrong critical section state, expected -1 got %d\n", sb
.lock
.LockCount
);
935 call_func3(p_streambuf_reserve_ctor
, &sb2
, reserve
, 16);
936 ok(sb2
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", sb2
.allocated
);
937 ok(sb2
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb2
.unbuffered
);
938 ok(sb2
.base
== reserve
, "wrong base pointer, expected %p got %p\n", reserve
, sb2
.base
);
939 ok(sb2
.ebuf
== reserve
+16, "wrong ebuf pointer, expected %p got %p\n", reserve
+16, sb2
.ebuf
);
940 ok(sb
.lock
.LockCount
== -1, "wrong critical section state, expected -1 got %d\n", sb
.lock
.LockCount
);
941 call_func1(p_streambuf_ctor
, &sb3
);
942 ok(sb3
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", sb3
.allocated
);
943 ok(sb3
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb3
.unbuffered
);
944 ok(sb3
.base
== NULL
, "wrong base pointer, expected %p got %p\n", NULL
, sb3
.base
);
945 ok(sb3
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, sb3
.ebuf
);
947 memcpy(test_streambuf_vtbl
, sb
.vtable
, sizeof(test_streambuf_vtbl
));
948 test_streambuf_vtbl
[7] = (vtable_ptr
)&test_streambuf_overflow
;
949 test_streambuf_vtbl
[8] = (vtable_ptr
)&test_streambuf_underflow
;
950 sb2
.vtable
= test_streambuf_vtbl
;
951 sb3
.vtable
= test_streambuf_vtbl
;
952 overflow_count
= underflow_count
= 0;
953 strcpy(test_get_buffer
, "CompuGlobalHyperMegaNet");
954 buffer_pos
= get_end
= 0;
957 ok(sb
.do_lock
== -1, "expected do_lock value -1, got %d\n", sb
.do_lock
);
958 call_func1(p_streambuf_setlock
, &sb
);
959 ok(sb
.do_lock
== -2, "expected do_lock value -2, got %d\n", sb
.do_lock
);
960 call_func1(p_streambuf_setlock
, &sb
);
961 ok(sb
.do_lock
== -3, "expected do_lock value -3, got %d\n", sb
.do_lock
);
963 call_func1(p_streambuf_setlock
, &sb
);
964 ok(sb
.do_lock
== 2, "expected do_lock value 2, got %d\n", sb
.do_lock
);
968 call_func1(p_streambuf_clrclock
, &sb
);
969 ok(sb
.do_lock
== -1, "expected do_lock value -1, got %d\n", sb
.do_lock
);
970 call_func1(p_streambuf_clrclock
, &sb
);
971 ok(sb
.do_lock
== 0, "expected do_lock value 0, got %d\n", sb
.do_lock
);
972 call_func1(p_streambuf_clrclock
, &sb
);
973 ok(sb
.do_lock
== 1, "expected do_lock value 1, got %d\n", sb
.do_lock
);
974 call_func1(p_streambuf_clrclock
, &sb
);
975 ok(sb
.do_lock
== 1, "expected do_lock value 1, got %d\n", sb
.do_lock
);
979 for (i
= 0; i
< 4; i
++) {
980 lock_arg
.lock
[i
] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
981 ok(lock_arg
.lock
[i
] != NULL
, "CreateEventW failed\n");
982 lock_arg
.test
[i
] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
983 ok(lock_arg
.test
[i
] != NULL
, "CreateEventW failed\n");
987 thread
= CreateThread(NULL
, 0, lock_streambuf
, (void*)&lock_arg
, 0, NULL
);
988 ok(thread
!= NULL
, "CreateThread failed\n");
989 WaitForSingleObject(lock_arg
.lock
[0], INFINITE
);
990 locked
= TryEnterCriticalSection(&sb
.lock
);
991 ok(locked
!= 0, "could not lock the streambuf\n");
992 LeaveCriticalSection(&sb
.lock
);
995 SetEvent(lock_arg
.test
[0]);
996 WaitForSingleObject(lock_arg
.lock
[1], INFINITE
);
997 locked
= TryEnterCriticalSection(&sb
.lock
);
998 ok(locked
!= 0, "could not lock the streambuf\n");
999 LeaveCriticalSection(&sb
.lock
);
1002 SetEvent(lock_arg
.test
[1]);
1003 WaitForSingleObject(lock_arg
.lock
[2], INFINITE
);
1004 locked
= TryEnterCriticalSection(&sb
.lock
);
1005 ok(locked
== 0, "the streambuf was not locked before\n");
1008 SetEvent(lock_arg
.test
[2]);
1009 WaitForSingleObject(lock_arg
.lock
[3], INFINITE
);
1010 locked
= TryEnterCriticalSection(&sb
.lock
);
1011 ok(locked
== 0, "the streambuf was not locked before\n");
1015 call_func4(p_streambuf_setb
, &sb
, reserve
, reserve
+16, 0);
1016 ok(sb
.base
== reserve
, "wrong base pointer, expected %p got %p\n", reserve
, sb
.base
);
1017 ok(sb
.ebuf
== reserve
+16, "wrong ebuf pointer, expected %p got %p\n", reserve
+16, sb
.ebuf
);
1018 call_func4(p_streambuf_setb
, &sb
, reserve
, reserve
+16, 4);
1019 ok(sb
.allocated
== 4, "wrong allocate value, expected 4 got %d\n", sb
.allocated
);
1021 call_func4(p_streambuf_setb
, &sb
, NULL
, NULL
, 3);
1022 ok(sb
.allocated
== 3, "wrong allocate value, expected 3 got %d\n", sb
.allocated
);
1025 psb
= call_func3(p_streambuf_setbuf
, &sb
, NULL
, 5);
1026 ok(psb
== &sb
, "wrong return value, expected %p got %p\n", &sb
, psb
);
1027 ok(sb
.allocated
== 3, "wrong allocate value, expected 3 got %d\n", sb
.allocated
);
1028 ok(sb
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", sb
.unbuffered
);
1029 ok(sb
.base
== NULL
, "wrong base pointer, expected %p got %p\n", NULL
, sb
.base
);
1030 ok(sb
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, sb
.ebuf
);
1031 psb
= call_func3(p_streambuf_setbuf
, &sb
, reserve
, 0);
1032 ok(psb
== &sb
, "wrong return value, expected %p got %p\n", &sb
, psb
);
1033 ok(sb
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", sb
.unbuffered
);
1034 ok(sb
.base
== NULL
, "wrong base pointer, expected %p got %p\n", NULL
, sb
.base
);
1035 ok(sb
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, sb
.ebuf
);
1036 psb
= call_func3(p_streambuf_setbuf
, &sb
, reserve
, 16);
1037 ok(psb
== &sb
, "wrong return value, expected %p got %p\n", &sb
, psb
);
1038 ok(sb
.allocated
== 3, "wrong allocate value, expected 3 got %d\n", sb
.allocated
);
1039 ok(sb
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb
.unbuffered
);
1040 ok(sb
.base
== reserve
, "wrong base pointer, expected %p got %p\n", reserve
, sb
.base
);
1041 ok(sb
.ebuf
== reserve
+16, "wrong ebuf pointer, expected %p got %p\n", reserve
+16, sb
.ebuf
);
1042 psb
= call_func3(p_streambuf_setbuf
, &sb
, NULL
, 8);
1043 ok(psb
== NULL
, "wrong return value, expected %p got %p\n", NULL
, psb
);
1044 ok(sb
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb
.unbuffered
);
1045 ok(sb
.base
== reserve
, "wrong base pointer, expected %p got %p\n", reserve
, sb
.base
);
1046 ok(sb
.ebuf
== reserve
+16, "wrong ebuf pointer, expected %p got %p\n", reserve
+16, sb
.ebuf
);
1049 ret
= (int) call_func1(p_streambuf_allocate
, &sb
);
1050 ok(ret
== 0, "wrong return value, expected 0 got %d\n", ret
);
1052 ret
= (int) call_func1(p_streambuf_allocate
, &sb
);
1053 ok(ret
== 1, "wrong return value, expected 1 got %d\n", ret
);
1054 ok(sb
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", sb
.allocated
);
1055 ok(sb
.ebuf
- sb
.base
== 512 , "wrong reserve area size, expected 512 got %p-%p\n", sb
.ebuf
, sb
.base
);
1058 ret
= (int) call_func1(p_streambuf_doallocate
, &sb2
);
1059 ok(ret
== 1, "doallocate failed, got %d\n", ret
);
1060 ok(sb2
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", sb2
.allocated
);
1061 ok(sb2
.ebuf
- sb2
.base
== 512 , "wrong reserve area size, expected 512 got %p-%p\n", sb2
.ebuf
, sb2
.base
);
1062 ret
= (int) call_func1(p_streambuf_doallocate
, &sb3
);
1063 ok(ret
== 1, "doallocate failed, got %d\n", ret
);
1064 ok(sb3
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", sb3
.allocated
);
1065 ok(sb3
.ebuf
- sb3
.base
== 512 , "wrong reserve area size, expected 512 got %p-%p\n", sb3
.ebuf
, sb3
.base
);
1067 /* sb: buffered, space available */
1068 sb
.eback
= sb
.gptr
= sb
.base
;
1069 sb
.egptr
= sb
.base
+ 256;
1070 sb
.pbase
= sb
.pptr
= sb
.base
+ 256;
1071 sb
.epptr
= sb
.base
+ 512;
1072 /* sb2: buffered, no space available */
1073 sb2
.eback
= sb2
.base
;
1074 sb2
.gptr
= sb2
.egptr
= sb2
.base
+ 256;
1075 sb2
.pbase
= sb2
.base
+ 256;
1076 sb2
.pptr
= sb2
.epptr
= sb2
.base
+ 512;
1077 /* sb3: unbuffered */
1081 call_func2(p_streambuf_gbump
, &sb
, 10);
1082 ok(sb
.gptr
== sb
.eback
+ 10, "advance get pointer failed, expected %p got %p\n", sb
.eback
+ 10, sb
.gptr
);
1083 call_func2(p_streambuf_gbump
, &sb
, -15);
1084 ok(sb
.gptr
== sb
.eback
- 5, "advance get pointer failed, expected %p got %p\n", sb
.eback
- 5, sb
.gptr
);
1088 call_func2(p_streambuf_pbump
, &sb
, -2);
1089 ok(sb
.pptr
== sb
.pbase
- 2, "advance put pointer failed, expected %p got %p\n", sb
.pbase
- 2, sb
.pptr
);
1090 call_func2(p_streambuf_pbump
, &sb
, 20);
1091 ok(sb
.pptr
== sb
.pbase
+ 18, "advance put pointer failed, expected %p got %p\n", sb
.pbase
+ 18, sb
.pptr
);
1095 ret
= (int) call_func1(p_streambuf_sync
, &sb
);
1096 ok(ret
== EOF
, "sync failed, expected EOF got %d\n", ret
);
1098 ret
= (int) call_func1(p_streambuf_sync
, &sb
);
1099 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1100 sb
.gptr
= sb
.egptr
+ 1;
1101 ret
= (int) call_func1(p_streambuf_sync
, &sb
);
1102 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1104 ret
= (int) call_func1(p_streambuf_sync
, &sb2
);
1105 ok(ret
== EOF
, "sync failed, expected EOF got %d\n", ret
);
1106 sb2
.pptr
= sb2
.pbase
;
1107 ret
= (int) call_func1(p_streambuf_sync
, &sb2
);
1108 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1109 sb2
.pptr
= sb2
.pbase
- 1;
1110 ret
= (int) call_func1(p_streambuf_sync
, &sb2
);
1111 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1112 sb2
.pptr
= sb2
.epptr
;
1113 ret
= (int) call_func1(p_streambuf_sync
, &sb3
);
1114 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1117 strcpy(sb2
.eback
, "WorstTestEver");
1119 ret
= (int) call_func1(p_streambuf_sgetc
, &sb2
);
1120 ok(ret
== 'W', "expected 'W' got '%c'\n", ret
);
1121 ok(underflow_count
== 1, "expected call to underflow\n");
1122 ok(sb2
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb2
.stored_char
);
1124 ret
= (int) call_func1(p_streambuf_sgetc
, &sb2
);
1125 ok(ret
== 'o', "expected 'o' got '%c'\n", ret
);
1126 ok(underflow_count
== 2, "expected call to underflow\n");
1127 ok(sb2
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb2
.stored_char
);
1128 sb2
.gptr
= sb2
.egptr
;
1130 ret
= (int) call_func1(p_streambuf_sgetc
, &sb3
);
1131 ok(ret
== 'C', "expected 'C' got '%c'\n", ret
);
1132 ok(underflow_count
== 3, "expected call to underflow\n");
1133 ok(sb3
.stored_char
== 'C', "wrong stored character, expected 'C' got %c\n", sb3
.stored_char
);
1134 sb3
.stored_char
= 'b';
1135 ret
= (int) call_func1(p_streambuf_sgetc
, &sb3
);
1136 ok(ret
== 'b', "expected 'b' got '%c'\n", ret
);
1137 ok(underflow_count
== 3, "no call to underflow expected\n");
1138 ok(sb3
.stored_char
== 'b', "wrong stored character, expected 'b' got %c\n", sb3
.stored_char
);
1142 ret
= (int) call_func2(p_streambuf_sputc
, &sb
, 'c');
1143 ok(ret
== 'c', "wrong return value, expected 'c' got %d\n", ret
);
1144 ok(overflow_count
== 0, "no call to overflow expected\n");
1145 ok(*sb
.pbase
== 'c', "expected 'c' in the put area, got %c\n", *sb
.pbase
);
1146 ok(sb
.pptr
== sb
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", sb
.pbase
+ 1, sb
.pptr
);
1148 ret
= (int) call_func2(p_streambuf_sputc
, &sb
, 150);
1149 ok(ret
== 150, "wrong return value, expected 150 got %d\n", ret
);
1150 ok(overflow_count
== 0, "no call to overflow expected\n");
1151 ok(*sb
.pbase
== -106, "expected -106 in the put area, got %d\n", *sb
.pbase
);
1152 ok(sb
.pptr
== sb
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", sb
.pbase
+ 1, sb
.pptr
);
1154 ret
= (int) call_func2(p_streambuf_sputc
, &sb
, -50);
1155 ok(ret
== 206, "wrong return value, expected 206 got %d\n", ret
);
1156 ok(overflow_count
== 0, "no call to overflow expected\n");
1157 ok(*sb
.pbase
== -50, "expected -50 in the put area, got %d\n", *sb
.pbase
);
1158 ok(sb
.pptr
== sb
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", sb
.pbase
+ 1, sb
.pptr
);
1160 ret
= (int) call_func2(p_streambuf_sputc
, &sb2
, 'c');
1161 ok(ret
== 'c', "wrong return value, expected 'c' got %d\n", ret
);
1162 ok(overflow_count
== 1, "expected call to overflow\n");
1163 ok(sb2
.pptr
== sb2
.pbase
+ 5, "wrong put pointer, expected %p got %p\n", sb2
.pbase
+ 5, sb2
.pptr
);
1165 ret
= (int) call_func2(p_streambuf_sputc
, &sb3
, 'c');
1166 ok(ret
== 'c', "wrong return value, expected 'c' got %d\n", ret
);
1167 ok(overflow_count
== 2, "expected call to overflow\n");
1168 sb3
.pbase
= sb3
.pptr
= sb3
.base
;
1169 sb3
.epptr
= sb3
.ebuf
;
1170 ret
= (int) call_func2(p_streambuf_sputc
, &sb3
, 'c');
1171 ok(ret
== 'c', "wrong return value, expected 'c' got %d\n", ret
);
1172 ok(overflow_count
== 2, "no call to overflow expected\n");
1173 ok(*sb3
.pbase
== 'c', "expected 'c' in the put area, got %c\n", *sb3
.pbase
);
1174 sb3
.pbase
= sb3
.pptr
= sb3
.epptr
= NULL
;
1177 sb2
.gptr
= sb2
.egptr
= sb2
.eback
+ 13;
1179 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb2
, reserve
, 5);
1180 ok(ret
== 5, "wrong return value, expected 5 got %d\n", ret
);
1181 ok(!strncmp(reserve
, "Worst", 5), "expected 'Worst' got %s\n", reserve
);
1182 ok(sb2
.gptr
== sb2
.eback
+ 5, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 5, sb2
.gptr
);
1183 ok(underflow_count
== 4, "expected call to underflow\n");
1184 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb2
, reserve
, 4);
1185 ok(ret
== 4, "wrong return value, expected 4 got %d\n", ret
);
1186 ok(!strncmp(reserve
, "Test", 4), "expected 'Test' got %s\n", reserve
);
1187 ok(sb2
.gptr
== sb2
.eback
+ 9, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 9, sb2
.gptr
);
1188 ok(underflow_count
== 5, "expected call to underflow\n");
1190 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb2
, reserve
, 16);
1191 ok(ret
== 4, "wrong return value, expected 4 got %d\n", ret
);
1192 ok(!strncmp(reserve
, "Ever", 4), "expected 'Ever' got %s\n", reserve
);
1193 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1194 ok(underflow_count
== 7, "expected 2 calls to underflow, got %d\n", underflow_count
- 5);
1196 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb3
, reserve
, 11);
1197 ok(ret
== 11, "wrong return value, expected 11 got %d\n", ret
);
1198 ok(!strncmp(reserve
, "bompuGlobal", 11), "expected 'bompuGlobal' got %s\n", reserve
);
1199 ok(sb3
.stored_char
== 'H', "wrong stored character, expected 'H' got %c\n", sb3
.stored_char
);
1200 ok(underflow_count
== 18, "expected 11 calls to underflow, got %d\n", underflow_count
- 7);
1201 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb3
, reserve
, 16);
1202 ok(ret
== 12, "wrong return value, expected 12 got %d\n", ret
);
1203 ok(!strncmp(reserve
, "HyperMegaNet", 12), "expected 'HyperMegaNet' got %s\n", reserve
);
1204 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1205 ok(underflow_count
== 30, "expected 12 calls to underflow, got %d\n", underflow_count
- 18);
1206 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb3
, reserve
, 3);
1207 ok(ret
== 0, "wrong return value, expected 0 got %d\n", ret
);
1208 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1209 ok(underflow_count
== 31, "expected call to underflow\n");
1211 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb3
, reserve
, 5);
1212 ok(ret
== 5, "wrong return value, expected 5 got %d\n", ret
);
1213 ok(!strncmp(reserve
, "Compu", 5), "expected 'Compu' got %s\n", reserve
);
1214 ok(sb3
.stored_char
== 'G', "wrong stored character, expected 'G' got %c\n", sb3
.stored_char
);
1215 ok(underflow_count
== 37, "expected 6 calls to underflow, got %d\n", underflow_count
- 31);
1218 ret
= (int) call_func3(p_streambuf_xsputn
, &sb
, "Test\0ing", 8);
1219 ok(ret
== 8, "wrong return value, expected 8 got %d\n", ret
);
1220 ok(sb
.pptr
== sb
.pbase
+ 9, "wrong put pointer, expected %p got %p\n", sb
.pbase
+ 9, sb
.pptr
);
1222 sb2
.pptr
= sb2
.epptr
- 7;
1223 ret
= (int) call_func3(p_streambuf_xsputn
, &sb2
, "Testing", 7);
1224 ok(ret
== 7, "wrong return value, expected 7 got %d\n", ret
);
1225 ok(sb2
.pptr
== sb2
.epptr
, "wrong put pointer, expected %p got %p\n", sb2
.epptr
, sb2
.pptr
);
1226 ok(overflow_count
== 2, "no call to overflow expected\n");
1227 sb2
.pptr
= sb2
.epptr
- 5;
1229 ret
= (int) call_func3(p_streambuf_xsputn
, &sb2
, "Testing", 7);
1230 ok(ret
== 7, "wrong return value, expected 7 got %d\n", ret
);
1231 ok(sb2
.pbase
[5] == 'g', "expected 'g' got %c\n", sb2
.pbase
[5]);
1232 ok(sb2
.pptr
== sb2
.pbase
+ 6, "wrong put pointer, expected %p got %p\n", sb2
.pbase
+ 6, sb2
.pptr
);
1233 ok(overflow_count
== 3, "expected call to overflow\n");
1234 sb2
.pptr
= sb2
.epptr
- 4;
1235 ret
= (int) call_func3(p_streambuf_xsputn
, &sb2
, "TestLing", 8);
1236 ok(ret
== 4, "wrong return value, expected 4 got %d\n", ret
);
1237 ok(sb2
.pptr
== sb2
.epptr
, "wrong put pointer, expected %p got %p\n", sb2
.epptr
, sb2
.pptr
);
1238 ok(overflow_count
== 4, "expected call to overflow\n");
1240 ret
= (int) call_func3(p_streambuf_xsputn
, &sb3
, "Testing", 7);
1241 ok(ret
== 7, "wrong return value, expected 7 got %d\n", ret
);
1242 ok(sb3
.stored_char
== 'G', "wrong stored character, expected 'G' got %c\n", sb3
.stored_char
);
1243 ok(overflow_count
== 11, "expected 7 calls to overflow, got %d\n", overflow_count
- 4);
1244 ret
= (int) call_func3(p_streambuf_xsputn
, &sb3
, "TeLephone", 9);
1245 ok(ret
== 2, "wrong return value, expected 2 got %d\n", ret
);
1246 ok(sb3
.stored_char
== 'G', "wrong stored character, expected 'G' got %c\n", sb3
.stored_char
);
1247 ok(overflow_count
== 14, "expected 3 calls to overflow, got %d\n", overflow_count
- 11);
1250 strcpy(sb
.eback
, "Test");
1251 ret
= (int) call_func1(p_streambuf_snextc
, &sb
);
1252 ok(ret
== 'e', "expected 'e' got '%c'\n", ret
);
1253 ok(sb
.gptr
== sb
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 1, sb
.gptr
);
1255 ret
= (int) call_func1(p_streambuf_snextc
, &sb
);
1256 ok(ret
== 206, "expected 206 got %d\n", ret
);
1257 ok(sb
.gptr
== sb
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 1, sb
.gptr
);
1259 ret
= (int) call_func1(p_streambuf_snextc
, &sb2
);
1260 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1261 ok(sb2
.gptr
== sb2
.egptr
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.egptr
+ 1, sb2
.gptr
);
1262 ok(underflow_count
== 39, "expected 2 calls to underflow, got %d\n", underflow_count
- 37);
1263 sb2
.gptr
= sb2
.egptr
- 1;
1264 ret
= (int) call_func1(p_streambuf_snextc
, &sb2
);
1265 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1266 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1267 ok(underflow_count
== 40, "expected call to underflow\n");
1269 ret
= (int) call_func1(p_streambuf_snextc
, &sb2
);
1270 ok(ret
== 'o', "expected 'o' got '%c'\n", ret
);
1271 ok(sb2
.gptr
== sb2
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 1, sb2
.gptr
);
1272 ok(underflow_count
== 41, "expected call to underflow\n");
1273 sb2
.gptr
= sb2
.egptr
- 1;
1274 ret
= (int) call_func1(p_streambuf_snextc
, &sb2
);
1275 ok(ret
== 'W', "expected 'W' got '%c'\n", ret
);
1276 ok(sb2
.gptr
== sb2
.eback
, "wrong get pointer, expected %p got %p\n", sb2
.eback
, sb2
.gptr
);
1277 ok(underflow_count
== 42, "expected call to underflow\n");
1278 sb2
.gptr
= sb2
.egptr
;
1280 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1281 ok(ret
== 'l', "expected 'l' got '%c'\n", ret
);
1282 ok(sb3
.stored_char
== 'l', "wrong stored character, expected 'l' got %c\n", sb3
.stored_char
);
1283 ok(underflow_count
== 43, "expected call to underflow\n");
1285 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1286 ok(ret
== 't', "expected 't' got '%c'\n", ret
);
1287 ok(sb3
.stored_char
== 't', "wrong stored character, expected 't' got %c\n", sb3
.stored_char
);
1288 ok(underflow_count
== 44, "expected call to underflow\n");
1289 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1290 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1291 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1292 ok(underflow_count
== 45, "expected call to underflow\n");
1294 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1295 ok(ret
== 'o', "expected 'o' got '%c'\n", ret
);
1296 ok(sb3
.stored_char
== 'o', "wrong stored character, expected 'o' got %c\n", sb3
.stored_char
);
1297 ok(underflow_count
== 47, "expected 2 calls to underflow, got %d\n", underflow_count
- 45);
1298 sb3
.stored_char
= EOF
;
1299 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1300 ok(ret
== 'p', "expected 'p' got '%c'\n", ret
);
1301 ok(sb3
.stored_char
== 'p', "wrong stored character, expected 'p' got %c\n", sb3
.stored_char
);
1302 ok(underflow_count
== 49, "expected 2 calls to underflow, got %d\n", underflow_count
- 47);
1306 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb
);
1307 ok(ret
== 'T', "expected 'T' got '%c'\n", ret
);
1308 ok(sb
.gptr
== sb
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 1, sb
.gptr
);
1309 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb
);
1310 ok(ret
== 206, "expected 206 got %d\n", ret
);
1311 ok(sb
.gptr
== sb
.eback
+ 2, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 2, sb
.gptr
);
1313 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb2
);
1314 ok(ret
== 'W', "expected 'W' got '%c'\n", ret
);
1315 ok(sb2
.gptr
== sb2
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 1, sb2
.gptr
);
1316 ok(underflow_count
== 50, "expected call to underflow\n");
1317 sb2
.gptr
= sb2
.egptr
- 1;
1319 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb2
);
1320 ok(ret
== 't', "expected 't' got '%c'\n", ret
);
1321 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1322 ok(underflow_count
== 50, "no call to underflow expected\n");
1324 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb2
);
1325 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1326 ok(sb2
.gptr
== sb2
.egptr
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.egptr
+ 1, sb2
.gptr
);
1327 ok(underflow_count
== 51, "expected call to underflow\n");
1328 sb2
.gptr
= sb2
.egptr
;
1330 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb3
);
1331 ok(ret
== 'p', "expected 'p' got '%c'\n", ret
);
1332 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1333 ok(underflow_count
== 51, "no call to underflow expected\n");
1334 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb3
);
1335 ok(ret
== 'u', "expected 'u' got '%c'\n", ret
);
1336 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1337 ok(underflow_count
== 52, "expected call to underflow\n");
1339 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb3
);
1340 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1341 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1342 ok(underflow_count
== 53, "expected call to underflow\n");
1344 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb3
);
1345 ok(ret
== 'C', "expected 'C' got '%c'\n", ret
);
1346 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1347 ok(underflow_count
== 54, "expected call to underflow\n");
1350 call_func1(p_streambuf_stossc
, &sb
);
1351 ok(sb
.gptr
== sb
.eback
+ 3, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 3, sb
.gptr
);
1353 call_func1(p_streambuf_stossc
, &sb2
);
1354 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1355 ok(underflow_count
== 55, "expected call to underflow\n");
1357 call_func1(p_streambuf_stossc
, &sb2
);
1358 ok(sb2
.gptr
== sb2
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 1, sb2
.gptr
);
1359 ok(underflow_count
== 56, "expected call to underflow\n");
1360 sb2
.gptr
= sb2
.egptr
- 1;
1361 call_func1(p_streambuf_stossc
, &sb2
);
1362 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1363 ok(underflow_count
== 56, "no call to underflow expected\n");
1365 call_func1(p_streambuf_stossc
, &sb3
);
1366 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1367 ok(underflow_count
== 57, "expected call to underflow\n");
1368 sb3
.stored_char
= 'a';
1369 call_func1(p_streambuf_stossc
, &sb3
);
1370 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1371 ok(underflow_count
== 57, "no call to underflow expected\n");
1374 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb
, 'A');
1375 ok(ret
== 'A', "expected 'A' got '%c'\n", ret
);
1376 ok(sb
.gptr
== sb
.eback
+ 2, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 2, sb
.gptr
);
1377 ok(*sb
.gptr
== 'A', "expected 'A' in the get area, got %c\n", *sb
.gptr
);
1378 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb
, EOF
);
1379 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1380 ok(sb
.gptr
== sb
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 1, sb
.gptr
);
1381 ok((signed char)*sb
.gptr
== EOF
, "expected EOF in the get area, got %c\n", *sb
.gptr
);
1383 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb
, 'Z');
1384 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1385 ok(sb
.gptr
== sb
.eback
, "wrong get pointer, expected %p got %p\n", sb
.eback
, sb
.gptr
);
1386 ok(*sb
.gptr
== 'T', "expected 'T' in the get area, got %c\n", *sb
.gptr
);
1387 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb
, EOF
);
1388 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1389 ok(sb
.gptr
== sb
.eback
, "wrong get pointer, expected %p got %p\n", sb
.eback
, sb
.gptr
);
1390 ok(*sb
.gptr
== 'T', "expected 'T' in the get area, got %c\n", *sb
.gptr
);
1391 sb2
.gptr
= sb2
.egptr
+ 1;
1392 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb2
, 'X');
1393 ok(ret
== 'X', "expected 'X' got '%c'\n", ret
);
1394 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1395 ok(*sb2
.gptr
== 'X', "expected 'X' in the get area, got %c\n", *sb2
.gptr
);
1398 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1399 ok(ret
== 9, "expected 9 got %d\n", ret
);
1401 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1402 ok(ret
== 0, "expected 0 got %d\n", ret
);
1403 sb
.pptr
= sb
.pbase
- 1;
1404 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1405 ok(ret
== 0, "expected 0 got %d\n", ret
);
1407 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1408 ok(ret
== 0, "expected 0 got %d\n", ret
);
1411 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1412 ok(ret
== (int)(sb
.pptr
- sb
.pbase
), "expected %d got %d\n", (int)(sb
.pptr
- sb
.pbase
), ret
);
1415 ret
= (int) call_func1(p_streambuf_in_avail
, &sb
);
1416 ok(ret
== 256, "expected 256 got %d\n", ret
);
1418 ret
= (int) call_func1(p_streambuf_in_avail
, &sb
);
1419 ok(ret
== 0, "expected 0 got %d\n", ret
);
1420 sb
.gptr
= sb
.egptr
+ 1;
1421 ret
= (int) call_func1(p_streambuf_in_avail
, &sb
);
1422 ok(ret
== 0, "expected 0 got %d\n", ret
);
1424 ret
= (int) call_func1(p_streambuf_in_avail
, &sb
);
1425 ok(ret
== 0, "expected 0 got %d\n", ret
);
1427 SetEvent(lock_arg
.test
[3]);
1428 WaitForSingleObject(thread
, INFINITE
);
1430 call_func1(p_streambuf_dtor
, &sb
);
1431 call_func1(p_streambuf_dtor
, &sb2
);
1432 call_func1(p_streambuf_dtor
, &sb3
);
1433 for (i
= 0; i
< 4; i
++) {
1434 CloseHandle(lock_arg
.lock
[i
]);
1435 CloseHandle(lock_arg
.test
[i
]);
1437 CloseHandle(thread
);
1440 struct filebuf_lock_arg
1442 filebuf
*fb1
, *fb2
, *fb3
;
1447 static DWORD WINAPI
lock_filebuf(void *arg
)
1449 struct filebuf_lock_arg
*lock_arg
= arg
;
1450 call_func1(p_streambuf_lock
, &lock_arg
->fb1
->base
);
1451 call_func1(p_streambuf_lock
, &lock_arg
->fb2
->base
);
1452 call_func1(p_streambuf_lock
, &lock_arg
->fb3
->base
);
1453 SetEvent(lock_arg
->lock
);
1454 WaitForSingleObject(lock_arg
->test
, INFINITE
);
1455 call_func1(p_streambuf_unlock
, &lock_arg
->fb1
->base
);
1456 call_func1(p_streambuf_unlock
, &lock_arg
->fb2
->base
);
1457 call_func1(p_streambuf_unlock
, &lock_arg
->fb3
->base
);
1461 static void test_filebuf(void)
1463 filebuf fb1
, fb2
, fb3
, *pret
;
1464 struct filebuf_lock_arg lock_arg
;
1466 const char filename1
[] = "test1";
1467 const char filename2
[] = "test2";
1468 const char filename3
[] = "test3";
1469 char read_buffer
[16];
1472 memset(&fb1
, 0xab, sizeof(filebuf
));
1473 memset(&fb2
, 0xab, sizeof(filebuf
));
1474 memset(&fb3
, 0xab, sizeof(filebuf
));
1477 call_func2(p_filebuf_fd_ctor
, &fb1
, 1);
1478 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1479 ok(fb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", fb1
.base
.unbuffered
);
1480 ok(fb1
.fd
== 1, "wrong fd, expected 1 got %d\n", fb1
.fd
);
1481 ok(fb1
.close
== 0, "wrong value, expected 0 got %d\n", fb1
.close
);
1482 call_func4(p_filebuf_fd_reserve_ctor
, &fb2
, 4, NULL
, 0);
1483 ok(fb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb2
.base
.allocated
);
1484 ok(fb2
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb2
.base
.unbuffered
);
1485 ok(fb2
.fd
== 4, "wrong fd, expected 4 got %d\n", fb2
.fd
);
1486 ok(fb2
.close
== 0, "wrong value, expected 0 got %d\n", fb2
.close
);
1487 call_func1(p_filebuf_ctor
, &fb3
);
1488 ok(fb3
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb3
.base
.allocated
);
1489 ok(fb3
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", fb3
.base
.unbuffered
);
1490 ok(fb3
.fd
== -1, "wrong fd, expected -1 got %d\n", fb3
.fd
);
1491 ok(fb3
.close
== 0, "wrong value, expected 0 got %d\n", fb3
.close
);
1493 lock_arg
.fb1
= &fb1
;
1494 lock_arg
.fb2
= &fb2
;
1495 lock_arg
.fb3
= &fb3
;
1496 lock_arg
.lock
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
1497 ok(lock_arg
.lock
!= NULL
, "CreateEventW failed\n");
1498 lock_arg
.test
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
1499 ok(lock_arg
.test
!= NULL
, "CreateEventW failed\n");
1500 thread
= CreateThread(NULL
, 0, lock_filebuf
, (void*)&lock_arg
, 0, NULL
);
1501 ok(thread
!= NULL
, "CreateThread failed\n");
1502 WaitForSingleObject(lock_arg
.lock
, INFINITE
);
1505 fb1
.base
.do_lock
= 0;
1506 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
, 16);
1507 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1508 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1509 ok(fb1
.base
.base
== read_buffer
, "wrong buffer, expected %p got %p\n", read_buffer
, fb1
.base
.base
);
1510 ok(fb1
.base
.pbase
== NULL
, "wrong put area, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1511 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
;
1512 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1513 fb1
.base
.do_lock
= -1;
1514 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
, 16);
1515 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1516 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1517 ok(fb1
.base
.base
== read_buffer
, "wrong buffer, expected %p got %p\n", read_buffer
, fb1
.base
.base
);
1518 ok(fb1
.base
.pbase
== read_buffer
, "wrong put area, expected %p got %p\n", read_buffer
, fb1
.base
.pbase
);
1519 fb1
.base
.base
= fb1
.base
.ebuf
= NULL
;
1520 fb1
.base
.do_lock
= 0;
1521 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
, 0);
1522 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1523 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1524 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1525 ok(fb1
.base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, fb1
.base
.base
);
1526 ok(fb1
.base
.pbase
== read_buffer
, "wrong put area, expected %p got %p\n", read_buffer
, fb1
.base
.pbase
);
1527 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.epptr
= NULL
;
1528 fb1
.base
.unbuffered
= 0;
1529 fb1
.base
.do_lock
= -1;
1532 pret
= call_func2(p_filebuf_attach
, &fb1
, 2);
1533 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1534 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1535 ok(fb1
.fd
== 1, "wrong fd, expected 1 got %d\n", fb1
.fd
);
1537 fb2
.base
.do_lock
= 0;
1538 pret
= call_func2(p_filebuf_attach
, &fb2
, 3);
1539 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1540 ok(fb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb2
.base
.allocated
);
1541 ok(fb2
.fd
== 3, "wrong fd, expected 3 got %d\n", fb2
.fd
);
1542 fb2
.base
.do_lock
= -1;
1543 fb3
.base
.do_lock
= 0;
1544 pret
= call_func2(p_filebuf_attach
, &fb3
, 2);
1545 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
1546 ok(fb3
.base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", fb3
.base
.allocated
);
1547 ok(fb3
.fd
== 2, "wrong fd, expected 2 got %d\n", fb3
.fd
);
1548 fb3
.base
.do_lock
= -1;
1551 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
, filebuf_openprot
);
1552 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1554 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
,
1555 OPENMODE_ate
|OPENMODE_nocreate
|OPENMODE_noreplace
|OPENMODE_binary
, filebuf_openprot
);
1556 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1557 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1558 fb1
.base
.do_lock
= 0;
1559 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
, filebuf_openprot
);
1560 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1561 ok(fb1
.base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", fb1
.base
.allocated
);
1562 ok(_write(fb1
.fd
, "testing", 7) == 7, "_write failed\n");
1563 pret
= call_func1(p_filebuf_close
, &fb1
);
1564 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1565 ok(fb1
.fd
== -1, "wrong fd, expected -1 got %d\n", fb1
.fd
);
1566 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
, filebuf_openprot
);
1567 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1568 ok(_read(fb1
.fd
, read_buffer
, 1) == -1, "file should not be open for reading\n");
1569 pret
= call_func1(p_filebuf_close
, &fb1
);
1570 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1571 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_app
, filebuf_openprot
);
1572 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1573 ok(_read(fb1
.fd
, read_buffer
, 1) == -1, "file should not be open for reading\n");
1574 ok(_write(fb1
.fd
, "testing", 7) == 7, "_write failed\n");
1575 ok(_lseek(fb1
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1576 ok(_write(fb1
.fd
, "append", 6) == 6, "_write failed\n");
1577 pret
= call_func1(p_filebuf_close
, &fb1
);
1578 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1579 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
|OPENMODE_ate
, filebuf_openprot
);
1580 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1581 ok(_read(fb1
.fd
, read_buffer
, 1) == -1, "file should not be open for reading\n");
1582 ok(_lseek(fb1
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1583 ok(_write(fb1
.fd
, "ate", 3) == 3, "_write failed\n");
1584 pret
= call_func1(p_filebuf_close
, &fb1
);
1585 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1586 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_in
, filebuf_openprot
);
1587 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1588 ok(_read(fb1
.fd
, read_buffer
, 13) == 13, "read failed\n");
1589 read_buffer
[13] = 0;
1590 ok(!strncmp(read_buffer
, "atetingappend", 13), "wrong contents, expected 'atetingappend' got '%s'\n", read_buffer
);
1591 pret
= call_func1(p_filebuf_close
, &fb1
);
1592 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1593 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_in
|OPENMODE_trunc
, filebuf_openprot
);
1594 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1595 ok(_read(fb1
.fd
, read_buffer
, 1) == 0, "read failed\n");
1596 ok(_write(fb1
.fd
, "file1", 5) == 5, "_write failed\n");
1597 pret
= call_func1(p_filebuf_close
, &fb1
);
1598 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1599 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_in
|OPENMODE_app
, filebuf_openprot
);
1600 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1601 ok(_write(fb1
.fd
, "app", 3) == 3, "_write failed\n");
1602 ok(_read(fb1
.fd
, read_buffer
, 1) == 0, "read failed\n");
1603 ok(_lseek(fb1
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1604 ok(_read(fb1
.fd
, read_buffer
, 8) == 8, "read failed\n");
1606 ok(!strncmp(read_buffer
, "file1app", 8), "wrong contents, expected 'file1app' got '%s'\n", read_buffer
);
1607 fb1
.base
.do_lock
= -1;
1610 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_out
|OPENMODE_nocreate
, filebuf_openprot
);
1611 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1612 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
|OPENMODE_nocreate
, filebuf_openprot
);
1613 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1614 fb2
.base
.do_lock
= 0;
1615 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
, filebuf_openprot
);
1616 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1617 ok(_read(fb1
.fd
, read_buffer
, 1) == 0, "read failed\n");
1618 pret
= call_func1(p_filebuf_close
, &fb2
);
1619 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1620 fb2
.base
.do_lock
= -1;
1621 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
|OPENMODE_noreplace
, filebuf_openprot
);
1622 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1623 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_trunc
|OPENMODE_noreplace
, filebuf_openprot
);
1624 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1625 pret
= call_func4(p_filebuf_open
, &fb2
, filename3
, OPENMODE_out
|OPENMODE_nocreate
|OPENMODE_noreplace
, filebuf_openprot
);
1626 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1628 /* open protection*/
1630 fb3
.base
.do_lock
= 0;
1631 pret
= call_func4(p_filebuf_open
, &fb3
, filename3
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
1632 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
1633 ok(_write(fb3
.fd
, "You wouldn't\nget this from\nany other guy", 40) == 40, "_write failed\n");
1634 fb2
.base
.do_lock
= 0;
1635 pret
= call_func4(p_filebuf_open
, &fb2
, filename3
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
1636 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1637 pret
= call_func1(p_filebuf_close
, &fb2
);
1638 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1639 fb2
.base
.do_lock
= -1;
1640 pret
= call_func1(p_filebuf_close
, &fb3
);
1641 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
1642 pret
= call_func4(p_filebuf_open
, &fb3
, filename3
, OPENMODE_in
, filebuf_sh_none
);
1643 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
1644 pret
= call_func4(p_filebuf_open
, &fb2
, filename3
, OPENMODE_in
, filebuf_openprot
);
1645 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1646 fb3
.base
.do_lock
= -1;
1649 fb1
.base
.do_lock
= 0;
1650 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
;
1651 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1652 ret
= (int) call_func2(p_filebuf_setmode
, &fb1
, filebuf_binary
);
1653 ok(ret
== filebuf_text
, "wrong return, expected %d got %d\n", filebuf_text
, ret
);
1654 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1655 ret
= (int) call_func2(p_filebuf_setmode
, &fb1
, filebuf_binary
);
1656 ok(ret
== filebuf_binary
, "wrong return, expected %d got %d\n", filebuf_binary
, ret
);
1657 fb1
.base
.do_lock
= -1;
1658 ret
= (int) call_func2(p_filebuf_setmode
, &fb1
, 0x9000);
1659 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
1660 fb2
.base
.do_lock
= 0;
1661 ret
= (int) call_func2(p_filebuf_setmode
, &fb2
, filebuf_text
);
1662 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
1663 fb2
.base
.do_lock
= -1;
1666 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1667 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1668 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
1669 fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
1670 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1671 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "We're no strangers to love\n", 27);
1672 ok(ret
== 27, "wrong return, expected 27 got %d\n", ret
);
1673 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1674 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
1675 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
1676 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1677 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.egptr
= NULL
;
1678 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
;
1679 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1680 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "You know the rules and so do I\n", 31);
1681 ok(ret
== 31, "wrong return, expected 31 got %d\n", ret
);
1682 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1683 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1684 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1685 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1686 fb1
.base
.eback
= fb1
.base
.base
;
1687 fb1
.base
.gptr
= fb1
.base
.base
+ 190;
1688 fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
1689 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1690 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1691 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1692 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1693 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1694 ok(_tell(fb1
.fd
) == 0, "_tell failed\n");
1695 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
;
1696 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1697 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1698 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1699 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1700 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1701 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1702 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1703 ok(fb1
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb1
.base
.epptr
);
1704 fb1
.base
.pbase
= fb1
.base
.base
;
1705 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1706 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1707 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1708 fb1
.base
.pbase
= fb1
.base
.base
;
1709 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1710 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1711 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1712 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1713 ok(fb1
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb1
.base
.epptr
);
1714 fb1
.base
.eback
= fb1
.base
.base
;
1715 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1716 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1717 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
1718 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
1719 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1720 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1721 ok(fb1
.base
.gptr
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1722 fb1
.base
.gptr
= fb1
.base
.base
;
1723 fb1
.base
.egptr
= fb1
.base
.base
+ 100;
1724 fb1
.base
.pbase
= fb1
.base
.base
;
1725 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1726 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
1727 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
1728 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 100, "wrong get base, expected %p got %p\n", fb1
.base
.base
+ 100, fb1
.base
.egptr
);
1729 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1730 fb1
.base
.egptr
= NULL
;
1731 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1732 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1733 ok(fb1
.base
.gptr
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1734 ok(fb1
.base
.egptr
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
1735 ret
= (int) call_func1(p_filebuf_sync
, &fb2
);
1736 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
1737 fb3
.base
.eback
= fb3
.base
.base
;
1738 fb3
.base
.gptr
= fb3
.base
.egptr
= fb3
.base
.pbase
= fb3
.base
.pptr
= fb3
.base
.base
+ 256;
1739 fb3
.base
.epptr
= fb3
.base
.ebuf
;
1740 ret
= (int) call_func3(p_streambuf_xsputn
, &fb3
.base
, "A full commitment's what I'm thinking of\n", 41);
1741 ok(ret
== 41, "wrong return, expected 41 got %d\n", ret
);
1742 ret
= (int) call_func1(p_filebuf_sync
, &fb3
);
1743 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
1744 ok(fb3
.base
.gptr
== fb3
.base
.base
+ 256, "wrong get pointer, expected %p got %p\n", fb3
.base
.base
+ 256, fb3
.base
.gptr
);
1745 ok(fb3
.base
.pptr
== fb3
.base
.base
+ 297, "wrong put pointer, expected %p got %p\n", fb3
.base
.base
+ 297, fb3
.base
.pptr
);
1746 fb3
.base
.eback
= fb3
.base
.base
;
1747 fb3
.base
.gptr
= fb3
.base
.egptr
= fb3
.base
.pbase
= fb3
.base
.pptr
= fb3
.base
.base
+ 256;
1748 fb3
.base
.epptr
= fb3
.base
.ebuf
;
1749 ret
= (int) call_func1(p_filebuf_sync
, &fb3
);
1750 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1751 ok(fb3
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb3
.base
.gptr
);
1752 ok(fb3
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb3
.base
.pptr
);
1753 fb3
.base
.eback
= fb3
.base
.base
;
1754 fb3
.base
.gptr
= fb3
.base
.base
+ 216;
1755 fb3
.base
.egptr
= fb3
.base
.pbase
= fb3
.base
.pptr
= fb3
.base
.base
+ 256;
1756 fb3
.base
.epptr
= fb3
.base
.ebuf
;
1757 ok(_read(fb3
.fd
, fb3
.base
.gptr
, 42) == 40, "read failed\n");
1758 ret
= (int) call_func1(p_filebuf_sync
, &fb3
);
1759 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1760 ok(fb3
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb3
.base
.gptr
);
1761 ok(fb3
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb3
.base
.pptr
);
1762 ok(_tell(fb3
.fd
) == 0, "_tell failed\n");
1763 fb3
.base
.eback
= fb3
.base
.gptr
= fb3
.base
.egptr
= NULL
;
1764 fb3
.base
.pbase
= fb3
.base
.pptr
= fb3
.base
.epptr
= NULL
;
1767 ret
= (int) call_func2(p_filebuf_overflow
, &fb1
, EOF
);
1768 ok(ret
== 1, "wrong return, expected 1 got %d\n", ret
);
1769 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.epptr
= NULL
;
1770 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
1771 fb1
.base
.egptr
= fb1
.base
.ebuf
;
1772 ret
= (int) call_func2(p_filebuf_overflow
, &fb1
, 'a');
1773 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1774 fb1
.base
.gptr
= fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
1775 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1776 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "I just want to tell you how I'm feeling", 39);
1777 ok(ret
== 39, "wrong return, expected 39 got %d\n", ret
);
1778 ret
= (int) call_func2(p_filebuf_overflow
, &fb1
, '\n');
1779 ok(ret
== 1, "wrong return, expected 1 got %d\n", ret
);
1780 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1781 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
1782 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 1, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.pptr
);
1783 ok(fb1
.base
.epptr
== fb1
.base
.ebuf
, "wrong put end pointer, expected %p got %p\n", fb1
.base
.ebuf
, fb1
.base
.epptr
);
1784 ok(*fb1
.base
.pbase
== '\n', "wrong character, expected '\\n' got '%c'\n", *fb1
.base
.pbase
);
1785 ret
= (int) call_func2(p_filebuf_overflow
, &fb1
, EOF
);
1786 ok(ret
== 1, "wrong return, expected 1 got %d\n", ret
);
1787 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1788 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
1789 ok(fb1
.base
.pptr
== fb1
.base
.base
, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pptr
);
1790 ok(fb1
.base
.epptr
== fb1
.base
.ebuf
, "wrong put end pointer, expected %p got %p\n", fb1
.base
.ebuf
, fb1
.base
.epptr
);
1791 ret
= (int) call_func2(p_filebuf_overflow
, &fb2
, EOF
);
1792 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1793 fb2
.base
.do_lock
= 0;
1794 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
1795 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1796 fb2
.base
.do_lock
= -1;
1797 ret
= (int) call_func2(p_filebuf_overflow
, &fb2
, EOF
);
1798 ok(ret
== 1, "wrong return, expected 1 got %d\n", ret
);
1801 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
1802 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1803 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1804 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1805 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
1806 fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
1807 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1808 *fb1
.base
.gptr
= 'A';
1809 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
1810 ok(ret
== 'A', "wrong return, expected 'A' got %d\n", ret
);
1811 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
1812 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 256, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 256, fb1
.base
.pptr
);
1813 *fb1
.base
.gptr
= -50;
1814 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
1815 ok(ret
== 206, "wrong return, expected 206 got %d\n", ret
);
1816 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
1817 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 256, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 256, fb1
.base
.pptr
);
1818 fb1
.base
.gptr
= fb1
.base
.ebuf
;
1819 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
1820 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1821 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1822 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1823 ok(_lseek(fb1
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1824 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
1825 ok(ret
== 'f', "wrong return, expected 'f' got %d\n", ret
);
1826 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
1827 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
1828 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 106, "wrong get end pointer, expected %p got %p\n", fb1
.base
.base
+ 106, fb1
.base
.egptr
);
1829 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1830 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
1831 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1832 ok(_write(fb2
.fd
, "A\n", 2) == 2, "_write failed\n");
1833 ok(_lseek(fb2
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1834 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
1835 ok(ret
== 'A', "wrong return, expected 'A' got %d\n", ret
);
1836 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
1837 ok(ret
== '\n', "wrong return, expected '\\n' got %d\n", ret
);
1838 ok(_lseek(fb2
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1839 ok(_write(fb2
.fd
, "\xCE\n", 2) == 2, "_write failed\n");
1840 ok(_lseek(fb2
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1841 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
1842 ok(ret
== 206, "wrong return, expected 206 got %d\n", ret
);
1843 fb2
.base
.do_lock
= 0;
1844 pret
= call_func1(p_filebuf_close
, &fb2
);
1845 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1846 fb2
.base
.do_lock
= -1;
1847 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
1848 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1851 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 5, SEEKDIR_beg
, 0);
1852 ok(ret
== 5, "wrong return, expected 5 got %d\n", ret
);
1853 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1854 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1855 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
1856 fb1
.base
.egptr
= fb1
.base
.ebuf
;
1857 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 0, SEEKDIR_beg
, 0);
1858 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1859 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.egptr
= NULL
;
1860 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 10, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
1861 ok(ret
== 10, "wrong return, expected 10 got %d\n", ret
);
1862 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 0, SEEKDIR_cur
, 0);
1863 ok(ret
== 10, "wrong return, expected 10 got %d\n", ret
);
1864 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 200, SEEKDIR_cur
, OPENMODE_in
);
1865 ok(ret
== 210, "wrong return, expected 210 got %d\n", ret
);
1866 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, -60, SEEKDIR_cur
, 0);
1867 ok(ret
== 150, "wrong return, expected 150 got %d\n", ret
);
1868 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 0, SEEKDIR_end
, 0);
1869 ok(ret
== 106, "wrong return, expected 106 got %d\n", ret
);
1870 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 20, SEEKDIR_end
, OPENMODE_out
);
1871 ok(ret
== 126, "wrong return, expected 126 got %d\n", ret
);
1872 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, -150, SEEKDIR_end
, -1);
1873 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1874 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 10, 3, 0);
1875 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1876 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 16, SEEKDIR_beg
, 0);
1877 ok(ret
== 16, "wrong return, expected 16 got %d\n", ret
);
1880 ret
= (int) call_func2(p_streambuf_pbackfail
, &fb1
.base
, 'B');
1881 ok(ret
== 'B', "wrong return, expected 'B' got %d\n", ret
);
1882 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1883 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1884 ok(_tell(fb1
.fd
) == 15, "_tell failed\n");
1885 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
1886 fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
1887 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1888 ret
= (int) call_func2(p_streambuf_pbackfail
, &fb1
.base
, 'C');
1889 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
1890 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
1891 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1892 ok(_tell(fb1
.fd
) == 15, "_tell failed\n");
1893 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
1894 fb1
.base
.egptr
= fb1
.base
.base
+ 2;
1895 ret
= (int) call_func2(p_streambuf_pbackfail
, &fb1
.base
, 'C');
1896 ok(ret
== 'C', "wrong return, expected 'C' got %d\n", ret
);
1897 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1898 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1899 ok(_tell(fb1
.fd
) == 12, "_tell failed\n");
1900 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
1901 fb1
.base
.egptr
= fb1
.base
.ebuf
;
1902 *fb1
.base
.gptr
++ = 'D';
1903 ret
= (int) call_func2(p_streambuf_pbackfail
, &fb1
.base
, 'C');
1904 ok(ret
== 'C', "wrong return, expected 'C' got %d\n", ret
);
1905 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
1906 ok(*fb1
.base
.gptr
== 'C', "wrong character, expected 'C' got '%c'\n", *fb1
.base
.gptr
);
1907 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1908 ok(_tell(fb1
.fd
) == 12, "_tell failed\n");
1909 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.egptr
= NULL
;
1912 pret
= call_func1(p_filebuf_close
, &fb2
);
1913 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1914 fb3
.base
.do_lock
= 0;
1915 pret
= call_func1(p_filebuf_close
, &fb3
);
1916 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
1917 ok(fb3
.fd
== -1, "wrong fd, expected -1 got %d\n", fb3
.fd
);
1919 pret
= call_func1(p_filebuf_close
, &fb3
);
1920 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1921 ok(fb3
.fd
== 5, "wrong fd, expected 5 got %d\n", fb3
.fd
);
1922 fb3
.base
.do_lock
= -1;
1924 SetEvent(lock_arg
.test
);
1925 WaitForSingleObject(thread
, INFINITE
);
1928 call_func1(p_filebuf_dtor
, &fb1
);
1929 ok(fb1
.fd
== -1, "wrong fd, expected -1 got %d\n", fb1
.fd
);
1930 call_func1(p_filebuf_dtor
, &fb2
);
1931 call_func1(p_filebuf_dtor
, &fb3
);
1933 ok(_unlink(filename1
) == 0, "Couldn't unlink file named '%s'\n", filename1
);
1934 ok(_unlink(filename2
) == 0, "Couldn't unlink file named '%s'\n", filename2
);
1935 ok(_unlink(filename3
) == 0, "Couldn't unlink file named '%s'\n", filename3
);
1936 CloseHandle(lock_arg
.lock
);
1937 CloseHandle(lock_arg
.test
);
1938 CloseHandle(thread
);
1941 static void test_strstreambuf(void)
1943 strstreambuf ssb1
, ssb2
;
1945 char buffer
[64], *pbuffer
;
1948 memset(&ssb1
, 0xab, sizeof(strstreambuf
));
1949 memset(&ssb2
, 0xab, sizeof(strstreambuf
));
1951 /* constructors/destructor */
1952 call_func2(p_strstreambuf_dynamic_ctor
, &ssb1
, 64);
1953 ok(ssb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb1
.base
.allocated
);
1954 ok(ssb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb1
.base
.unbuffered
);
1955 ok(ssb1
.dynamic
== 1, "expected 1, got %d\n", ssb1
.dynamic
);
1956 ok(ssb1
.increase
== 64, "expected 64, got %d\n", ssb1
.increase
);
1957 ok(ssb1
.constant
== 0, "expected 0, got %d\n", ssb1
.constant
);
1958 ok(ssb1
.f_alloc
== NULL
, "expected %p, got %p\n", NULL
, ssb1
.f_alloc
);
1959 ok(ssb1
.f_free
== NULL
, "expected %p, got %p\n", NULL
, ssb1
.f_free
);
1960 call_func1(p_strstreambuf_dtor
, &ssb1
);
1961 call_func3(p_strstreambuf_funcs_ctor
, &ssb2
, (allocFunction
)p_operator_new
, p_operator_delete
);
1962 ok(ssb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb2
.base
.allocated
);
1963 ok(ssb2
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb2
.base
.unbuffered
);
1964 ok(ssb2
.dynamic
== 1, "expected 1, got %d\n", ssb2
.dynamic
);
1965 ok(ssb2
.increase
== 1, "expected 1, got %d\n", ssb2
.increase
);
1966 ok(ssb2
.constant
== 0, "expected 0, got %d\n", ssb2
.constant
);
1967 ok(ssb2
.f_alloc
== (allocFunction
)p_operator_new
, "expected %p, got %p\n", p_operator_new
, ssb2
.f_alloc
);
1968 ok(ssb2
.f_free
== p_operator_delete
, "expected %p, got %p\n", p_operator_delete
, ssb2
.f_free
);
1969 call_func1(p_strstreambuf_dtor
, &ssb2
);
1970 memset(&ssb1
, 0xab, sizeof(strstreambuf
));
1971 memset(&ssb2
, 0xab, sizeof(strstreambuf
));
1972 call_func4(p_strstreambuf_buffer_ctor
, &ssb1
, buffer
, 64, buffer
+ 20);
1973 ok(ssb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb1
.base
.allocated
);
1974 ok(ssb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb1
.base
.unbuffered
);
1975 ok(ssb1
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb1
.base
.base
);
1976 ok(ssb1
.base
.ebuf
== buffer
+ 64, "wrong buffer end, expected %p got %p\n", buffer
+ 64, ssb1
.base
.ebuf
);
1977 ok(ssb1
.base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, ssb1
.base
.eback
);
1978 ok(ssb1
.base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, ssb1
.base
.gptr
);
1979 ok(ssb1
.base
.egptr
== buffer
+ 20, "wrong get end, expected %p got %p\n", buffer
+ 20, ssb1
.base
.egptr
);
1980 ok(ssb1
.base
.pbase
== buffer
+ 20, "wrong put base, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pbase
);
1981 ok(ssb1
.base
.pptr
== buffer
+ 20, "wrong put pointer, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pptr
);
1982 ok(ssb1
.base
.epptr
== buffer
+ 64, "wrong put end, expected %p got %p\n", buffer
+ 64, ssb1
.base
.epptr
);
1983 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
1984 ok(ssb1
.constant
== 1, "expected 1, got %d\n", ssb1
.constant
);
1985 call_func1(p_strstreambuf_dtor
, &ssb1
);
1986 strcpy(buffer
, "Test");
1987 call_func4(p_strstreambuf_buffer_ctor
, &ssb2
, buffer
, 0, buffer
+ 20);
1988 ok(ssb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb2
.base
.allocated
);
1989 ok(ssb2
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb2
.base
.unbuffered
);
1990 ok(ssb2
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb2
.base
.base
);
1991 ok(ssb2
.base
.ebuf
== buffer
+ 4, "wrong buffer end, expected %p got %p\n", buffer
+ 4, ssb2
.base
.ebuf
);
1992 ok(ssb2
.base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, ssb2
.base
.eback
);
1993 ok(ssb2
.base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, ssb2
.base
.gptr
);
1994 ok(ssb2
.base
.egptr
== buffer
+ 20, "wrong get end, expected %p got %p\n", buffer
+ 20, ssb2
.base
.egptr
);
1995 ok(ssb2
.base
.pbase
== buffer
+ 20, "wrong put base, expected %p got %p\n", buffer
+ 20, ssb2
.base
.pbase
);
1996 ok(ssb2
.base
.pptr
== buffer
+ 20, "wrong put pointer, expected %p got %p\n", buffer
+ 20, ssb2
.base
.pptr
);
1997 ok(ssb2
.base
.epptr
== buffer
+ 4, "wrong put end, expected %p got %p\n", buffer
+ 4, ssb2
.base
.epptr
);
1998 ok(ssb2
.dynamic
== 0, "expected 0, got %d\n", ssb2
.dynamic
);
1999 ok(ssb2
.constant
== 1, "expected 1, got %d\n", ssb2
.constant
);
2000 call_func1(p_strstreambuf_dtor
, &ssb2
);
2001 memset(&ssb1
, 0xab, sizeof(strstreambuf
));
2002 memset(&ssb2
, 0xab, sizeof(strstreambuf
));
2003 call_func4(p_strstreambuf_buffer_ctor
, &ssb1
, NULL
, 16, buffer
+ 20);
2004 ok(ssb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb1
.base
.allocated
);
2005 ok(ssb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb1
.base
.unbuffered
);
2006 ok(ssb1
.base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, ssb1
.base
.base
);
2007 ok(ssb1
.base
.ebuf
== (char*)16, "wrong buffer end, expected %p got %p\n", (char*)16, ssb1
.base
.ebuf
);
2008 ok(ssb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, ssb1
.base
.eback
);
2009 ok(ssb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, ssb1
.base
.gptr
);
2010 ok(ssb1
.base
.egptr
== buffer
+ 20, "wrong get end, expected %p got %p\n", buffer
+ 20, ssb1
.base
.egptr
);
2011 ok(ssb1
.base
.pbase
== buffer
+ 20, "wrong put base, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pbase
);
2012 ok(ssb1
.base
.pptr
== buffer
+ 20, "wrong put pointer, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pptr
);
2013 ok(ssb1
.base
.epptr
== (char*)16, "wrong put end, expected %p got %p\n", (char*)16, ssb1
.base
.epptr
);
2014 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
2015 ok(ssb1
.constant
== 1, "expected 1, got %d\n", ssb1
.constant
);
2016 call_func1(p_strstreambuf_dtor
, &ssb1
);
2017 call_func4(p_strstreambuf_buffer_ctor
, &ssb2
, buffer
, 0, NULL
);
2018 ok(ssb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb2
.base
.allocated
);
2019 ok(ssb2
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb2
.base
.unbuffered
);
2020 ok(ssb2
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb2
.base
.base
);
2021 ok(ssb2
.base
.ebuf
== buffer
+ 4, "wrong buffer end, expected %p got %p\n", buffer
+ 4, ssb2
.base
.ebuf
);
2022 ok(ssb2
.base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, ssb2
.base
.eback
);
2023 ok(ssb2
.base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, ssb2
.base
.gptr
);
2024 ok(ssb2
.base
.egptr
== buffer
+ 4, "wrong get end, expected %p got %p\n", buffer
+ 4, ssb2
.base
.egptr
);
2025 ok(ssb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, ssb2
.base
.pbase
);
2026 ok(ssb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, ssb2
.base
.pptr
);
2027 ok(ssb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, ssb2
.base
.epptr
);
2028 ok(ssb2
.dynamic
== 0, "expected 0, got %d\n", ssb2
.dynamic
);
2029 ok(ssb2
.constant
== 1, "expected 1, got %d\n", ssb2
.constant
);
2030 call_func1(p_strstreambuf_dtor
, &ssb2
);
2031 memset(&ssb1
, 0xab, sizeof(strstreambuf
));
2032 memset(&ssb2
, 0xab, sizeof(strstreambuf
));
2033 call_func4(p_strstreambuf_buffer_ctor
, &ssb1
, buffer
, -5, buffer
+ 20);
2034 ok(ssb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb1
.base
.allocated
);
2035 ok(ssb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb1
.base
.unbuffered
);
2036 ok(ssb1
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb1
.base
.base
);
2037 ok(ssb1
.base
.ebuf
== buffer
+ 0x7fffffff || ssb1
.base
.ebuf
== (char*)-1,
2038 "wrong buffer end, expected %p + 0x7fffffff or -1, got %p\n", buffer
, ssb1
.base
.ebuf
);
2039 ok(ssb1
.base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, ssb1
.base
.eback
);
2040 ok(ssb1
.base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, ssb1
.base
.gptr
);
2041 ok(ssb1
.base
.egptr
== buffer
+ 20, "wrong get end, expected %p got %p\n", buffer
+ 20, ssb1
.base
.egptr
);
2042 ok(ssb1
.base
.pbase
== buffer
+ 20, "wrong put base, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pbase
);
2043 ok(ssb1
.base
.pptr
== buffer
+ 20, "wrong put pointer, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pptr
);
2044 ok(ssb1
.base
.epptr
== buffer
+ 0x7fffffff || ssb1
.base
.epptr
== (char*)-1,
2045 "wrong put end, expected %p + 0x7fffffff or -1, got %p\n", buffer
, ssb1
.base
.epptr
);
2046 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
2047 ok(ssb1
.constant
== 1, "expected 1, got %d\n", ssb1
.constant
);
2048 call_func1(p_strstreambuf_ctor
, &ssb2
);
2049 ok(ssb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb2
.base
.allocated
);
2050 ok(ssb2
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb2
.base
.unbuffered
);
2051 ok(ssb2
.dynamic
== 1, "expected 1, got %d\n", ssb2
.dynamic
);
2052 ok(ssb2
.increase
== 1, "expected 1, got %d\n", ssb2
.increase
);
2053 ok(ssb2
.constant
== 0, "expected 0, got %d\n", ssb2
.constant
);
2054 ok(ssb2
.f_alloc
== NULL
, "expected %p, got %p\n", NULL
, ssb2
.f_alloc
);
2055 ok(ssb2
.f_free
== NULL
, "expected %p, got %p\n", NULL
, ssb2
.f_free
);
2058 call_func2(p_strstreambuf_freeze
, &ssb1
, 0);
2059 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
2061 call_func2(p_strstreambuf_freeze
, &ssb1
, 0);
2062 ok(ssb1
.dynamic
== 1, "expected 1, got %d\n", ssb1
.dynamic
);
2063 call_func2(p_strstreambuf_freeze
, &ssb1
, 3);
2064 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
2066 call_func2(p_strstreambuf_freeze
, &ssb2
, 5);
2067 ok(ssb2
.dynamic
== 0, "expected 0, got %d\n", ssb2
.dynamic
);
2068 call_func2(p_strstreambuf_freeze
, &ssb2
, 0);
2069 ok(ssb2
.dynamic
== 1, "expected 1, got %d\n", ssb2
.dynamic
);
2074 ret
= (int) call_func1(p_strstreambuf_doallocate
, &ssb2
);
2075 ok(ret
== 1, "return value %d\n", ret
);
2076 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 5, "expected %p, got %p\n", ssb2
.base
.base
+ 5, ssb2
.base
.ebuf
);
2077 ssb2
.base
.eback
= ssb2
.base
.base
;
2078 ssb2
.base
.gptr
= ssb2
.base
.base
+ 2;
2079 ssb2
.base
.egptr
= ssb2
.base
.base
+ 4;
2080 strcpy(ssb2
.base
.base
, "Check");
2081 ret
= (int) call_func1(p_strstreambuf_doallocate
, &ssb2
);
2082 ok(ret
== 1, "return value %d\n", ret
);
2083 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 10, "expected %p, got %p\n", ssb2
.base
.base
+ 10, ssb2
.base
.ebuf
);
2084 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2085 ok(ssb2
.base
.gptr
== ssb2
.base
.base
+ 2, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
+ 2, ssb2
.base
.gptr
);
2086 ok(ssb2
.base
.egptr
== ssb2
.base
.base
+ 4, "wrong get end, expected %p got %p\n", ssb2
.base
.base
+ 4, ssb2
.base
.egptr
);
2087 ok(!strncmp(ssb2
.base
.base
, "Check", 5), "strings are not equal\n");
2088 ssb2
.base
.pbase
= ssb2
.base
.pptr
= ssb2
.base
.base
+ 4;
2089 ssb2
.base
.epptr
= ssb2
.base
.ebuf
;
2091 ret
= (int) call_func1(p_strstreambuf_doallocate
, &ssb2
);
2092 ok(ret
== 1, "return value %d\n", ret
);
2093 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 11, "expected %p, got %p\n", ssb2
.base
.base
+ 11, ssb2
.base
.ebuf
);
2094 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 4, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 4, ssb2
.base
.pbase
);
2095 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 4, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 4, ssb2
.base
.pptr
);
2096 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 10, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 10, ssb2
.base
.epptr
);
2097 ok(!strncmp(ssb2
.base
.base
, "Check", 5), "strings are not equal\n");
2101 pret
= call_func3(p_strstreambuf_setbuf
, &ssb1
, buffer
+ 16, 16);
2102 ok(pret
== &ssb1
.base
, "expected %p got %p\n", &ssb1
.base
, pret
);
2103 ok(ssb1
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb1
.base
.base
);
2104 ok(ssb1
.increase
== 16, "expected 16, got %d\n", ssb1
.increase
);
2105 pret
= call_func3(p_strstreambuf_setbuf
, &ssb2
, NULL
, 2);
2106 ok(pret
== &ssb2
.base
, "expected %p got %p\n", &ssb2
.base
, pret
);
2107 ok(ssb2
.increase
== 2, "expected 2, got %d\n", ssb2
.increase
);
2108 pret
= call_func3(p_strstreambuf_setbuf
, &ssb2
, buffer
, 0);
2109 ok(pret
== &ssb2
.base
, "expected %p got %p\n", &ssb2
.base
, pret
);
2110 ok(ssb2
.increase
== 2, "expected 2, got %d\n", ssb2
.increase
);
2111 pret
= call_func3(p_strstreambuf_setbuf
, &ssb2
, NULL
, -2);
2112 ok(pret
== &ssb2
.base
, "expected %p got %p\n", &ssb2
.base
, pret
);
2113 ok(ssb2
.increase
== -2, "expected -2, got %d\n", ssb2
.increase
);
2116 ssb1
.base
.epptr
= ssb1
.base
.ebuf
= ssb1
.base
.base
+ 64;
2117 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2118 ok(ret
== 'T', "expected 'T' got %d\n", ret
);
2119 ssb1
.base
.gptr
= ssb1
.base
.egptr
;
2120 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2121 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2122 ret
= (int) call_func3(p_streambuf_xsputn
, &ssb1
.base
, "Gotta make you understand", 5);
2123 ok(ret
== 5, "expected 5 got %d\n", ret
);
2124 ok(ssb1
.base
.pptr
== buffer
+ 25, "wrong put pointer, expected %p got %p\n", buffer
+ 25, ssb1
.base
.pptr
);
2125 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2126 ok(ret
== 'G', "expected 'G' got %d\n", ret
);
2127 ok(ssb1
.base
.egptr
== buffer
+ 25, "wrong get end, expected %p got %p\n", buffer
+ 25, ssb1
.base
.egptr
);
2128 *ssb1
.base
.gptr
= -50;
2129 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2130 ok(ret
== 206, "expected 206 got %d\n", ret
);
2131 ok(ssb1
.base
.egptr
== buffer
+ 25, "wrong get end, expected %p got %p\n", buffer
+ 25, ssb1
.base
.egptr
);
2132 ssb1
.base
.gptr
= ssb1
.base
.egptr
= ssb1
.base
.pptr
= ssb1
.base
.epptr
;
2133 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2134 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2135 ssb2
.base
.eback
= ssb2
.base
.gptr
= ssb2
.base
.egptr
= NULL
;
2136 ssb2
.base
.pbase
= ssb2
.base
.pptr
= ssb2
.base
.epptr
= NULL
;
2137 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2138 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2139 ssb2
.base
.pbase
= ssb2
.base
.pptr
= ssb2
.base
.base
;
2140 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2141 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2142 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2143 ok(ssb2
.base
.gptr
== ssb2
.base
.base
, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2144 ok(ssb2
.base
.egptr
== ssb2
.base
.base
, "wrong get end, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.egptr
);
2145 ssb2
.base
.pptr
= ssb2
.base
.base
+ 3;
2146 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2147 ok(ret
== 'C', "expected 'C' got %d\n", ret
);
2148 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2149 ok(ssb2
.base
.gptr
== ssb2
.base
.base
, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2150 ok(ssb2
.base
.egptr
== ssb2
.base
.base
+ 3, "wrong get end, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.egptr
);
2151 ssb2
.base
.gptr
= ssb2
.base
.base
+ 2;
2152 ssb2
.base
.egptr
= NULL
;
2153 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2154 ok(ret
== 'e', "expected 'e' got %d\n", ret
);
2155 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2156 ok(ssb2
.base
.gptr
== ssb2
.base
.base
+ 2, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2157 ok(ssb2
.base
.egptr
== ssb2
.base
.base
+ 3, "wrong get end, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.egptr
);
2158 ssb2
.base
.eback
= ssb2
.base
.egptr
= ssb2
.base
.base
+ 1;
2159 ssb2
.base
.gptr
= ssb2
.base
.base
+ 3;
2160 ssb2
.base
.pptr
= ssb2
.base
.base
+ 5;
2161 *(ssb2
.base
.base
+ 2) = -50;
2162 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2163 ok(ret
== 206, "expected 206 got %d\n", ret
);
2164 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2165 ok(ssb2
.base
.gptr
== ssb2
.base
.base
+ 2, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2166 ok(ssb2
.base
.egptr
== ssb2
.base
.base
+ 5, "wrong get end, expected %p got %p\n", ssb2
.base
.base
+ 5, ssb2
.base
.egptr
);
2167 ssb2
.base
.eback
= ssb2
.base
.base
;
2168 ssb2
.base
.gptr
= ssb2
.base
.egptr
= ssb2
.base
.ebuf
;
2169 ssb2
.base
.pbase
= ssb2
.base
.pptr
= NULL
;
2170 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2171 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2174 ssb1
.base
.pptr
= ssb1
.base
.epptr
- 1;
2175 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb1
, EOF
);
2176 ok(ret
== 1, "expected 1 got %d\n", ret
);
2177 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb1
, 'A');
2178 ok(ret
== 1, "expected 1 got %d\n", ret
);
2179 ok(ssb1
.base
.pptr
== ssb1
.base
.epptr
, "wrong put pointer, expected %p got %p\n", ssb1
.base
.epptr
, ssb1
.base
.pptr
);
2180 ok(*(ssb1
.base
.pptr
- 1) == 'A', "expected 'A' got %d\n", *(ssb1
.base
.pptr
- 1));
2181 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb1
, 'B');
2182 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2183 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb1
, EOF
);
2184 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2186 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'C');
2187 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2189 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'C');
2190 ok(ret
== 1, "expected 1 got %d\n", ret
);
2191 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 12, "expected %p got %p\n", ssb2
.base
.base
+ 12, ssb2
.base
.ebuf
);
2192 ok(ssb2
.base
.gptr
== ssb2
.base
.base
+ 11, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
+ 11, ssb2
.base
.gptr
);
2193 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 11, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 11, ssb2
.base
.pbase
);
2194 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 12, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 12, ssb2
.base
.pptr
);
2195 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 12, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 12, ssb2
.base
.epptr
);
2196 ok(*(ssb2
.base
.pptr
- 1) == 'C', "expected 'C' got %d\n", *(ssb2
.base
.pptr
- 1));
2198 ssb2
.base
.eback
= ssb2
.base
.gptr
= ssb2
.base
.egptr
= NULL
;
2199 ssb2
.base
.pbase
= ssb2
.base
.pptr
= ssb2
.base
.epptr
= NULL
;
2200 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'D');
2201 ok(ret
== 1, "expected 1 got %d\n", ret
);
2202 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 16, "expected %p got %p\n", ssb2
.base
.base
+ 16, ssb2
.base
.ebuf
);
2203 ok(ssb2
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, ssb2
.base
.gptr
);
2204 ok(ssb2
.base
.pbase
== ssb2
.base
.base
, "wrong put base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.pbase
);
2205 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 1, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 1, ssb2
.base
.pptr
);
2206 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 16, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 16, ssb2
.base
.epptr
);
2207 ok(*(ssb2
.base
.pptr
- 1) == 'D', "expected 'D' got %d\n", *(ssb2
.base
.pptr
- 1));
2208 ssb2
.base
.pbase
= ssb2
.base
.base
+ 3;
2209 ssb2
.base
.pptr
= ssb2
.base
.epptr
+ 5;
2210 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'E');
2211 ok(ret
== 1, "expected 1 got %d\n", ret
);
2212 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 20, "expected %p got %p\n", ssb2
.base
.base
+ 20, ssb2
.base
.ebuf
);
2213 ok(ssb2
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, ssb2
.base
.gptr
);
2214 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 3, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.pbase
);
2215 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 22, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 22, ssb2
.base
.pptr
);
2216 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 20, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 20, ssb2
.base
.epptr
);
2217 ok(*(ssb2
.base
.pptr
- 1) == 'E', "expected 'E' got %d\n", *(ssb2
.base
.pptr
- 1));
2218 ssb2
.base
.egptr
= ssb2
.base
.base
+ 2;
2219 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'F');
2220 ok(ret
== 1, "expected 1 got %d\n", ret
);
2221 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 24, "expected %p got %p\n", ssb2
.base
.base
+ 24, ssb2
.base
.ebuf
);
2222 ok(ssb2
.base
.gptr
!= NULL
, "wrong get pointer, expected != NULL\n");
2223 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 3, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.pbase
);
2224 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 23, ssb2
.base
.pptr
);
2225 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 24, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 24, ssb2
.base
.epptr
);
2226 ok(*(ssb2
.base
.pptr
- 1) == 'F', "expected 'F' got %d\n", *(ssb2
.base
.pptr
- 1));
2227 ssb2
.base
.eback
= ssb2
.base
.gptr
= ssb2
.base
.base
;
2228 ssb2
.base
.epptr
= NULL
;
2229 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'G');
2230 ok(ret
== 1, "expected 1 got %d\n", ret
);
2231 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 28, "expected %p got %p\n", ssb2
.base
.base
+ 28, ssb2
.base
.ebuf
);
2232 ok(ssb2
.base
.gptr
== ssb2
.base
.base
, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2233 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 2, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 2, ssb2
.base
.pbase
);
2234 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 3, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.pptr
);
2235 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 28, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 28, ssb2
.base
.epptr
);
2236 ok(*(ssb2
.base
.pptr
- 1) == 'G', "expected 'G' got %d\n", *(ssb2
.base
.pptr
- 1));
2239 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 0, SEEKDIR_beg
, OPENMODE_in
);
2240 ok(ret
== 0, "expected 0 got %d\n", ret
);
2241 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
, ssb1
.base
.gptr
);
2242 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 3, SEEKDIR_beg
, OPENMODE_in
);
2243 ok(ret
== 3, "expected 3 got %d\n", ret
);
2244 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 3, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 3, ssb1
.base
.gptr
);
2245 ssb1
.base
.egptr
= ssb1
.base
.pbase
;
2246 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 25, SEEKDIR_beg
, OPENMODE_in
);
2247 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2248 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 3, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 3, ssb1
.base
.gptr
);
2249 ssb1
.base
.gptr
= ssb1
.base
.egptr
;
2250 ssb1
.base
.pptr
= ssb1
.base
.pbase
+ 10;
2251 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 25, SEEKDIR_beg
, OPENMODE_in
);
2252 ok(ret
== 25, "expected 25 got %d\n", ret
);
2253 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 25, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 25, ssb1
.base
.gptr
);
2254 ok(ssb1
.base
.egptr
== ssb1
.base
.pptr
, "wrong get end, expected %p got %p\n", ssb1
.base
.pptr
, ssb1
.base
.egptr
);
2255 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -24, SEEKDIR_cur
, OPENMODE_in
);
2256 ok(ret
== 1, "expected 1 got %d\n", ret
);
2257 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 1, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 1, ssb1
.base
.gptr
);
2258 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -5, SEEKDIR_cur
, OPENMODE_in
);
2259 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2260 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 1, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 1, ssb1
.base
.gptr
);
2261 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 0, SEEKDIR_end
, OPENMODE_in
);
2262 ok(ret
== 30, "expected 30 got %d\n", ret
);
2263 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
, ssb1
.base
.gptr
);
2264 ssb1
.base
.gptr
= ssb1
.base
.eback
;
2265 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -2, SEEKDIR_end
, OPENMODE_in
);
2266 ok(ret
== 28, "expected 28 got %d\n", ret
);
2267 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
- 2, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
- 2, ssb1
.base
.gptr
);
2268 ssb1
.base
.gptr
= ssb1
.base
.egptr
;
2269 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -5, SEEKDIR_end
, OPENMODE_in
);
2270 ok(ret
== 25, "expected 25 got %d\n", ret
);
2271 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
- 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
- 5, ssb1
.base
.gptr
);
2272 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 1, SEEKDIR_end
, OPENMODE_in
);
2273 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2274 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
- 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
- 5, ssb1
.base
.gptr
);
2275 ssb1
.base
.gptr
= ssb1
.base
.egptr
;
2276 ssb1
.base
.pptr
= ssb1
.base
.egptr
+ 5;
2277 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 1, SEEKDIR_end
, OPENMODE_in
);
2278 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2279 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
- 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
- 5, ssb1
.base
.gptr
);
2280 ok(ssb1
.base
.egptr
== ssb1
.base
.pptr
, "wrong get end, expected %p got %p\n", ssb1
.base
.pptr
, ssb1
.base
.egptr
);
2281 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 3, SEEKDIR_beg
, OPENMODE_out
);
2282 ok(ret
== 3, "expected 3 got %d\n", ret
);
2283 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 3, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 3, ssb1
.base
.pptr
);
2284 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -2, SEEKDIR_beg
, OPENMODE_out
);
2285 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2286 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 3, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 3, ssb1
.base
.pptr
);
2287 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 50, SEEKDIR_beg
, OPENMODE_out
);
2288 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2289 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 3, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 3, ssb1
.base
.pptr
);
2290 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 5, SEEKDIR_cur
, OPENMODE_out
);
2291 ok(ret
== 8, "expected 8 got %d\n", ret
);
2292 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 8, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 8, ssb1
.base
.pptr
);
2293 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -2, SEEKDIR_end
, OPENMODE_out
);
2294 ok(ret
== 42, "expected 42 got %d\n", ret
);
2295 ok(ssb1
.base
.pptr
== ssb1
.base
.epptr
- 2, "wrong put pointer, expected %p got %p\n", ssb1
.base
.epptr
- 2, ssb1
.base
.pptr
);
2296 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 0, SEEKDIR_end
, OPENMODE_out
);
2297 ok(ret
== 44, "expected 44 got %d\n", ret
);
2298 ok(ssb1
.base
.pptr
== ssb1
.base
.epptr
, "wrong put pointer, expected %p got %p\n", ssb1
.base
.epptr
, ssb1
.base
.pptr
);
2299 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 5, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
2300 ok(ret
== 5, "expected 5 got %d\n", ret
);
2301 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 5, ssb1
.base
.gptr
);
2302 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 5, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 5, ssb1
.base
.pptr
);
2303 ssb1
.base
.egptr
= ssb1
.base
.pbase
;
2304 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 21, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
2305 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2306 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 5, ssb1
.base
.gptr
);
2307 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 5, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 5, ssb1
.base
.pptr
);
2308 ssb1
.base
.egptr
= ssb1
.base
.epptr
;
2309 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 50, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
2310 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2311 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 50, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 50, ssb1
.base
.gptr
);
2312 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 5, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 5, ssb1
.base
.pptr
);
2313 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 2, SEEKDIR_cur
, OPENMODE_in
|OPENMODE_out
);
2314 ok(ret
== 7, "expected 7 got %d\n", ret
);
2315 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 52, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 52, ssb1
.base
.gptr
);
2316 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 7, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 7, ssb1
.base
.pptr
);
2317 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, 0, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
2318 ok(ret
== 0, "expected 0 got %d\n", ret
);
2319 ok(ssb2
.base
.gptr
== ssb2
.base
.eback
, "wrong get pointer, expected %p got %p\n", ssb2
.base
.eback
, ssb2
.base
.gptr
);
2320 ok(ssb2
.base
.pptr
== ssb2
.base
.pbase
, "wrong put pointer, expected %p got %p\n", ssb2
.base
.pbase
, ssb2
.base
.pptr
);
2321 ssb2
.base
.gptr
= ssb2
.base
.egptr
;
2322 ssb2
.base
.pptr
+= 10;
2323 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, 5, SEEKDIR_cur
, OPENMODE_in
|OPENMODE_out
);
2324 ok(ret
== 15, "expected 15 got %d\n", ret
);
2325 ok(ssb2
.base
.gptr
== ssb2
.base
.eback
+ 7, "wrong get pointer, expected %p got %p\n", ssb2
.base
.eback
+ 7, ssb2
.base
.gptr
);
2326 ok(ssb2
.base
.egptr
== ssb2
.base
.eback
+ 12, "wrong get end, expected %p got %p\n", ssb2
.base
.eback
+ 12, ssb2
.base
.egptr
);
2327 ok(ssb2
.base
.pptr
== ssb2
.base
.pbase
+ 15, "wrong put pointer, expected %p got %p\n", ssb2
.base
.pbase
+ 15, ssb2
.base
.pptr
);
2328 ssb2
.base
.pptr
= ssb2
.base
.epptr
;
2329 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, -1, SEEKDIR_cur
, OPENMODE_in
|OPENMODE_out
);
2330 ok(ret
== 25, "expected 25 got %d\n", ret
);
2331 ok(ssb2
.base
.gptr
== ssb2
.base
.eback
+ 6, "wrong get pointer, expected %p got %p\n", ssb2
.base
.eback
+ 6, ssb2
.base
.gptr
);
2332 ok(ssb2
.base
.pptr
== ssb2
.base
.pbase
+ 25, "wrong put pointer, expected %p got %p\n", ssb2
.base
.pbase
+ 25, ssb2
.base
.pptr
);
2333 pbuffer
= ssb2
.base
.pbase
;
2334 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, 50, SEEKDIR_beg
, OPENMODE_out
);
2335 ok(ret
== 50, "expected 50 got %d\n", ret
);
2336 ok(ssb2
.base
.gptr
== ssb2
.base
.eback
+ 6, "wrong get pointer, expected %p got %p\n", ssb2
.base
.eback
+ 6, ssb2
.base
.gptr
);
2337 ok(ssb2
.base
.pptr
== pbuffer
+ 50, "wrong put pointer, expected %p got %p\n", pbuffer
+ 50, ssb2
.base
.pptr
);
2338 ok(ssb2
.increase
== 50, "expected 50 got %d\n", ssb2
.increase
);
2339 ssb2
.base
.epptr
= NULL
;
2341 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, 0, SEEKDIR_end
, OPENMODE_out
);
2342 ok(ret
== 74, "expected 74 got %d\n", ret
);
2343 ok(ssb2
.base
.pptr
== ssb2
.base
.epptr
, "wrong put pointer, expected %p got %p\n", ssb2
.base
.epptr
, ssb2
.base
.pptr
);
2346 *(ssb1
.base
.gptr
-1) = 'A';
2347 ret
= (int) call_func2(p_streambuf_pbackfail
, &ssb1
.base
, 'X');
2348 ok(ret
== 'X', "wrong return, expected 'X' got %d\n", ret
);
2349 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 51, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 51, ssb1
.base
.gptr
);
2350 ok(*ssb1
.base
.gptr
== 'X', "expected 'X' got '%c'\n", *ssb1
.base
.gptr
);
2351 ssb1
.base
.gptr
= ssb1
.base
.eback
;
2352 ret
= (int) call_func2(p_streambuf_pbackfail
, &ssb1
.base
, 'Y');
2353 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2354 ssb1
.base
.gptr
= ssb1
.base
.eback
+ 1;
2355 ret
= (int) call_func2(p_streambuf_pbackfail
, &ssb1
.base
, EOF
);
2356 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2357 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
, ssb1
.base
.gptr
);
2358 ok((signed char)*ssb1
.base
.gptr
== EOF
, "expected EOF got '%c'\n", *ssb1
.base
.gptr
);
2360 call_func1(p_strstreambuf_dtor
, &ssb1
);
2361 call_func1(p_strstreambuf_dtor
, &ssb2
);
2364 static void test_stdiobuf(void)
2366 stdiobuf stb1
, stb2
;
2367 FILE *file1
, *file2
;
2368 const char filename1
[] = "stdiobuf_test1";
2369 const char filename2
[] = "stdiobuf_test2";
2373 memset(&stb1
, 0xab, sizeof(stdiobuf
));
2374 memset(&stb2
, 0xab, sizeof(stdiobuf
));
2376 file1
= fopen(filename1
, "w");
2377 fputs("Never gonna give you up, never gonna let you down", file1
);
2379 file1
= fopen(filename1
, "r");
2380 ok(file1
!= NULL
, "Couldn't open the file named '%s'\n", filename1
);
2381 file2
= fopen(filename2
, "w+");
2382 ok(file2
!= NULL
, "Couldn't open the file named '%s'\n", filename2
);
2384 /* constructors/destructor */
2385 call_func2(p_stdiobuf_file_ctor
, &stb1
, NULL
);
2386 ok(stb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", stb1
.base
.allocated
);
2387 ok(stb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", stb1
.base
.unbuffered
);
2388 ok(stb1
.file
== NULL
, "wrong file pointer, expected %p got %p\n", NULL
, stb1
.file
);
2389 call_func1(p_stdiobuf_dtor
, &stb1
);
2390 call_func2(p_stdiobuf_file_ctor
, &stb1
, file1
);
2391 ok(stb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", stb1
.base
.allocated
);
2392 ok(stb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", stb1
.base
.unbuffered
);
2393 ok(stb1
.file
== file1
, "wrong file pointer, expected %p got %p\n", file1
, stb1
.file
);
2394 call_func2(p_stdiobuf_file_ctor
, &stb2
, file2
);
2395 ok(stb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", stb2
.base
.allocated
);
2396 ok(stb2
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", stb2
.base
.unbuffered
);
2397 ok(stb2
.file
== file2
, "wrong file pointer, expected %p got %p\n", file2
, stb2
.file
);
2400 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, EOF
);
2401 ok(ret
== 1, "expected 1 got %d\n", ret
);
2402 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, 'a');
2403 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2404 stb1
.base
.unbuffered
= 0;
2405 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, 'a');
2406 ok(ret
== 1, "expected 1 got %d\n", ret
);
2407 ok(stb1
.base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", stb1
.base
.allocated
);
2408 ok(stb1
.base
.ebuf
== stb1
.base
.base
+ 512, "expected %p got %p\n", stb1
.base
.base
+ 512, stb1
.base
.ebuf
);
2409 ok(stb1
.base
.pbase
== stb1
.base
.base
+ 256, "wrong put base, expected %p got %p\n", stb1
.base
.base
+ 256, stb1
.base
.pbase
);
2410 ok(stb1
.base
.pptr
== stb1
.base
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
+ 1, stb1
.base
.pptr
);
2411 ok(stb1
.base
.epptr
== stb1
.base
.ebuf
, "wrong put end, expected %p got %p\n", stb1
.base
.ebuf
, stb1
.base
.epptr
);
2412 ok(*(stb1
.base
.pptr
-1) == 'a', "expected 'a', got '%c'\n", *(stb1
.base
.pptr
-1));
2413 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, EOF
);
2414 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2415 ok(stb1
.base
.pptr
== stb1
.base
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
+ 1, stb1
.base
.pptr
);
2416 stb1
.base
.pptr
= stb1
.base
.pbase
;
2417 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, EOF
);
2418 ok(ret
== 1, "expected 1 got %d\n", ret
);
2419 ok(stb1
.base
.pptr
== stb1
.base
.pbase
, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
, stb1
.base
.pptr
);
2420 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, 'b');
2421 ok(ret
== 1, "expected 1 got %d\n", ret
);
2422 ok(stb1
.base
.pptr
== stb1
.base
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
+ 1, stb1
.base
.pptr
);
2423 ok(*(stb1
.base
.pptr
-1) == 'b', "expected 'b', got '%c'\n", *(stb1
.base
.pptr
-1));
2424 stb1
.base
.unbuffered
= 1;
2425 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, EOF
);
2426 ok(ret
== 1, "expected 1 got %d\n", ret
);
2427 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, 'a');
2428 ok(ret
== 'a', "expected 'a' got %d\n", ret
);
2429 stb2
.base
.unbuffered
= 0;
2430 stb2
.base
.base
= buffer
;
2431 stb2
.base
.pbase
= stb2
.base
.pptr
= buffer
+ 32;
2432 stb2
.base
.ebuf
= stb2
.base
.epptr
= buffer
+ 64;
2433 ret
= (int) call_func3(p_streambuf_xsputn
, &stb2
.base
, "Never gonna run around", 22);
2434 ok(ret
== 22, "expected 22 got %d\n", ret
);
2435 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, 'c');
2436 ok(ret
== 1, "expected 1 got %d\n", ret
);
2437 ok(stb2
.base
.pptr
== stb2
.base
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
+ 1, stb2
.base
.pptr
);
2438 ok(*(stb2
.base
.pptr
-1) == 'c', "expected 'c', got '%c'\n", *(stb2
.base
.pptr
-1));
2439 stb2
.base
.pbase
= stb2
.base
.pptr
+ 3;
2440 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, 'd');
2441 ok(ret
== 1, "expected 1 got %d\n", ret
);
2442 ok(stb2
.base
.pptr
== stb2
.base
.pbase
- 2, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
- 2, stb2
.base
.pptr
);
2443 ok(*(stb2
.base
.pptr
-1) == 'd', "expected 'd', got '%c'\n", *(stb2
.base
.pptr
-1));
2444 stb2
.base
.pbase
= stb2
.base
.pptr
= buffer
+ 32;
2445 stb2
.base
.epptr
= buffer
+ 30;
2446 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, 'd');
2447 ok(ret
== 'd', "expected 'd' got %d\n", ret
);
2448 ok(stb2
.base
.pptr
== stb2
.base
.pbase
, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
, stb2
.base
.pptr
);
2449 stb2
.base
.epptr
= buffer
+ 64;
2450 stb2
.base
.unbuffered
= 1;
2453 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2454 ok(ret
== 'N', "expected 'N' got %d\n", ret
);
2455 stb1
.base
.unbuffered
= 0;
2456 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2457 ok(ret
== 'e', "expected 'e' got %d\n", ret
);
2458 ok(stb1
.base
.eback
== stb1
.base
.base
, "wrong get base, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.eback
);
2459 ok(stb1
.base
.gptr
== stb1
.base
.egptr
- 47, "wrong get pointer, expected %p got %p\n", stb1
.base
.egptr
- 47, stb1
.base
.gptr
);
2460 ok(stb1
.base
.egptr
== stb1
.base
.base
+ 256, "wrong get end, expected %p got %p\n", stb1
.base
.base
+ 256, stb1
.base
.egptr
);
2461 ok(*stb1
.base
.gptr
== 'v', "expected 'v' got '%c'\n", *stb1
.base
.gptr
);
2462 stb1
.base
.pbase
= stb1
.base
.pptr
= stb1
.base
.epptr
= NULL
;
2463 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2464 ok(ret
== 'v', "expected 'v' got %d\n", ret
);
2465 ok(stb1
.base
.gptr
== stb1
.base
.egptr
- 46, "wrong get pointer, expected %p got %p\n", stb1
.base
.egptr
- 46, stb1
.base
.gptr
);
2466 *stb1
.base
.gptr
= -50;
2467 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2468 ok(ret
== 206, "expected 206 got %d\n", ret
);
2469 ok(stb1
.base
.gptr
== stb1
.base
.egptr
- 45, "wrong get pointer, expected %p got %p\n", stb1
.base
.egptr
- 45, stb1
.base
.gptr
);
2470 stb1
.base
.gptr
= stb1
.base
.egptr
;
2471 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2472 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2473 stb1
.base
.unbuffered
= 1;
2474 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2475 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2477 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2478 ok(ret
== 'a', "expected 'a' got %d\n", ret
);
2479 stb2
.base
.unbuffered
= 0;
2480 stb2
.base
.eback
= stb2
.base
.gptr
= buffer
+ 16;
2481 stb2
.base
.egptr
= buffer
+ 32;
2482 strcpy(buffer
+ 16, "and desert you");
2483 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2484 ok(ret
== 'a', "expected 'a' got %d\n", ret
);
2485 ok(stb2
.base
.gptr
== buffer
+ 17, "wrong get pointer, expected %p got %p\n", buffer
+ 17, stb2
.base
.gptr
);
2486 stb2
.base
.eback
= buffer
;
2487 stb2
.base
.gptr
= stb2
.base
.egptr
;
2488 stb2
.base
.pbase
= stb2
.base
.pptr
= stb2
.base
.epptr
= NULL
;
2489 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2490 ok(ret
== 'N', "expected 'N' got %d\n", ret
);
2491 ok(stb2
.base
.gptr
== stb2
.base
.egptr
- 22, "wrong get pointer, expected %p got %p\n", stb2
.base
.egptr
- 22, stb2
.base
.gptr
);
2492 ok(ftell(stb2
.file
) == 24, "ftell failed\n");
2493 stb2
.base
.gptr
= stb2
.base
.egptr
;
2494 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2495 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2496 stb2
.base
.unbuffered
= 1;
2497 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2498 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2501 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2502 ok(ret
== 0, "expected 0 got %d\n", ret
);
2503 stb1
.base
.gptr
= stb1
.base
.eback
;
2504 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2505 ok(ret
== 0, "expected 0 got %d\n", ret
);
2506 stb1
.base
.unbuffered
= 0;
2507 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2508 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2509 ok(stb1
.base
.pbase
== stb1
.base
.base
+ 256, "wrong put base, expected %p got %p\n", stb1
.base
.base
+ 256, stb1
.base
.pbase
);
2510 ok(stb1
.base
.pptr
== stb1
.base
.base
+ 256, "wrong put pointer, expected %p got %p\n", stb1
.base
.base
+ 256, stb1
.base
.pptr
);
2511 ok(stb1
.base
.epptr
== stb1
.base
.base
+ 512, "wrong put end, expected %p got %p\n", stb1
.base
.base
+ 512, stb1
.base
.epptr
);
2512 stb1
.base
.gptr
= stb1
.base
.egptr
;
2513 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2514 ok(ret
== 0, "expected 0 got %d\n", ret
);
2515 stb1
.base
.eback
= stb1
.base
.gptr
= stb1
.base
.egptr
= NULL
;
2516 stb1
.base
.pptr
= stb1
.base
.epptr
;
2517 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2518 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2519 ok(stb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, stb1
.base
.gptr
);
2520 stb1
.base
.pptr
= stb1
.base
.pbase
;
2521 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2522 ok(ret
== 0, "expected 0 got %d\n", ret
);
2523 ok(stb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, stb1
.base
.gptr
);
2524 stb1
.base
.unbuffered
= 1;
2525 stb2
.base
.unbuffered
= 0;
2526 stb2
.base
.egptr
= stb2
.base
.ebuf
;
2527 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2528 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2529 ok(stb2
.base
.pbase
== stb2
.base
.base
+ 32, "wrong put base, expected %p got %p\n", stb2
.base
.base
+ 32, stb2
.base
.pbase
);
2530 ok(stb2
.base
.pptr
== stb2
.base
.base
+ 32, "wrong put pointer, expected %p got %p\n", stb2
.base
.base
+ 32, stb2
.base
.pptr
);
2531 ok(stb2
.base
.epptr
== stb2
.base
.base
+ 64, "wrong put end, expected %p got %p\n", stb2
.base
.base
+ 64, stb2
.base
.epptr
);
2532 stb2
.base
.egptr
= stb2
.base
.pbase
;
2533 stb2
.base
.gptr
= stb2
.base
.egptr
- 25;
2534 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2535 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2536 ret
= (int) call_func3(p_streambuf_xsputn
, &stb2
.base
, "Never gonna make you cry", 24);
2537 ok(ret
== 24, "expected 24 got %d\n", ret
);
2538 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2539 ok(ret
== 0, "expected 0 got %d\n", ret
);
2540 ok(ftell(stb2
.file
) == 23, "ftell failed\n");
2541 ok(fseek(stb2
.file
, 3, SEEK_SET
) == 0, "fseek failed\n");
2542 stb2
.base
.gptr
= stb2
.base
.egptr
- 3;
2543 strcpy(stb2
.base
.gptr
, "a\nc");
2544 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2545 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2546 ok(stb2
.base
.gptr
== stb2
.base
.egptr
- 3, "wrong get pointer, expected %p got %p\n", stb2
.base
.egptr
- 3, stb2
.base
.gptr
);
2547 *(stb2
.base
.gptr
+1) = 'b';
2548 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2549 ok(ret
== 0, "expected 0 got %d\n", ret
);
2550 ok(stb2
.base
.gptr
== stb2
.base
.egptr
, "wrong get pointer, expected %p got %p\n", stb2
.base
.egptr
, stb2
.base
.gptr
);
2551 stb2
.base
.unbuffered
= 1;
2554 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, 100, 60);
2555 ok(ret
== 1, "expected 1 got %d\n", ret
);
2556 ok(stb1
.base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", stb1
.base
.allocated
);
2557 ok(stb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", stb1
.base
.unbuffered
);
2558 ok(stb1
.base
.ebuf
== stb1
.base
.base
+ 160, "expected %p got %p\n", stb1
.base
.base
+ 160, stb1
.base
.ebuf
);
2559 ok(stb1
.base
.eback
== stb1
.base
.base
, "wrong get base, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.eback
);
2560 ok(stb1
.base
.gptr
== stb1
.base
.base
+ 100, "wrong get pointer, expected %p got %p\n", stb1
.base
.base
+ 100, stb1
.base
.gptr
);
2561 ok(stb1
.base
.egptr
== stb1
.base
.base
+ 100, "wrong get end, expected %p got %p\n", stb1
.base
.base
+ 100, stb1
.base
.egptr
);
2562 ok(stb1
.base
.pbase
== stb1
.base
.base
+ 100, "wrong put base, expected %p got %p\n", stb1
.base
.base
+ 100, stb1
.base
.pbase
);
2563 ok(stb1
.base
.pptr
== stb1
.base
.base
+ 100, "wrong put pointer, expected %p got %p\n", stb1
.base
.base
+ 100, stb1
.base
.pptr
);
2564 ok(stb1
.base
.epptr
== stb1
.base
.base
+ 160, "wrong put end, expected %p got %p\n", stb1
.base
.base
+ 160, stb1
.base
.epptr
);
2565 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, -1, 64);
2566 ok(ret
== 0 || ret
== 1, "expected 0 or 1, got %d\n", ret
);
2567 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, 32, -8);
2568 ok(ret
== 0 || ret
== 1, "expected 0 or 1, got %d\n", ret
);
2569 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, 0, 64);
2570 ok(ret
== 1, "expected 1 got %d\n", ret
);
2571 ok(stb1
.base
.ebuf
== stb1
.base
.base
+ 64, "expected %p got %p\n", stb1
.base
.base
+ 64, stb1
.base
.ebuf
);
2572 ok(stb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, stb1
.base
.eback
);
2573 ok(stb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, stb1
.base
.gptr
);
2574 ok(stb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, stb1
.base
.egptr
);
2575 ok(stb1
.base
.pbase
== stb1
.base
.base
, "wrong put base, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.pbase
);
2576 ok(stb1
.base
.pptr
== stb1
.base
.base
, "wrong put pointer, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.pptr
);
2577 ok(stb1
.base
.epptr
== stb1
.base
.base
+ 64, "wrong put end, expected %p got %p\n", stb1
.base
.base
+ 64, stb1
.base
.epptr
);
2578 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, 0, 0);
2579 ok(ret
== 0, "expected 0 got %d\n", ret
);
2580 ok(stb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", stb1
.base
.unbuffered
);
2583 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 0, SEEKDIR_beg
, OPENMODE_in
);
2584 ok(ret
== 0, "expected 0 got %d\n", ret
);
2585 stb1
.base
.unbuffered
= 0;
2586 ret
= (int) call_func3(p_streambuf_xsputn
, &stb1
.base
, "Never gonna say goodbye", 22);
2587 ok(ret
== 22, "expected 22 got %d\n", ret
);
2588 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 5, SEEKDIR_beg
, OPENMODE_in
);
2589 ok(ret
== 5, "expected 5 got %d\n", ret
);
2590 ok(stb1
.base
.pptr
== stb1
.base
.pbase
+ 22, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
+ 22, stb1
.base
.pptr
);
2591 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 300, SEEKDIR_beg
, OPENMODE_in
);
2592 ok(ret
== 300, "expected 300 got %d\n", ret
);
2593 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, -310, SEEKDIR_cur
, OPENMODE_in
);
2594 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2595 stb1
.base
.eback
= stb1
.base
.base
;
2596 stb1
.base
.gptr
= stb1
.base
.egptr
= stb1
.base
.pbase
= stb1
.base
.base
+ 10;
2597 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, -280, SEEKDIR_cur
, OPENMODE_in
);
2598 ok(ret
== 20, "expected 20 got %d\n", ret
);
2599 stb1
.base
.gptr
= stb1
.base
.eback
;
2600 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 80, SEEKDIR_cur
, OPENMODE_in
);
2601 ok(ret
== 100, "expected 100 got %d\n", ret
);
2602 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 0, SEEKDIR_end
, OPENMODE_in
);
2603 ok(ret
== 49, "expected 49 got %d\n", ret
);
2604 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 1, SEEKDIR_end
, OPENMODE_in
);
2605 ok(ret
== 50, "expected 50 got %d\n", ret
);
2606 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, -60, SEEKDIR_end
, OPENMODE_in
);
2607 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2608 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, -20, SEEKDIR_end
, OPENMODE_out
);
2609 ok(ret
== 29, "expected 29 got %d\n", ret
);
2610 stb1
.base
.eback
= stb1
.base
.gptr
= stb1
.base
.egptr
= NULL
;
2611 stb1
.base
.pptr
= stb1
.base
.pbase
;
2612 stb1
.base
.unbuffered
= 1;
2613 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, 0, SEEKDIR_beg
, OPENMODE_in
);
2614 ok(ret
== 0, "expected 0 got %d\n", ret
);
2615 stb2
.base
.pptr
+= 10;
2616 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, 20, SEEKDIR_beg
, OPENMODE_in
);
2617 ok(ret
== 20, "expected 20 got %d\n", ret
);
2618 ok(stb2
.base
.pptr
== stb2
.base
.pbase
+ 10, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
+ 10, stb2
.base
.pptr
);
2619 stb2
.base
.unbuffered
= 0;
2620 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, 10, SEEKDIR_cur
, OPENMODE_in
);
2621 ok(ret
== 40, "expected 40 got %d\n", ret
);
2622 ok(stb2
.base
.pptr
== stb2
.base
.pbase
, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
, stb2
.base
.pptr
);
2623 stb2
.base
.gptr
= stb2
.base
.eback
;
2624 stb2
.base
.pptr
+= 5;
2625 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, -50, SEEKDIR_cur
, OPENMODE_in
|OPENMODE_out
);
2626 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2627 ok(stb2
.base
.pptr
== stb2
.base
.pbase
, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
, stb2
.base
.pptr
);
2628 stb2
.base
.pbase
= stb2
.base
.pptr
= stb2
.base
.epptr
= NULL
;
2629 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, 0, SEEKDIR_end
, OPENMODE_in
|OPENMODE_out
);
2630 ok(ret
== 48, "expected 48 got %d\n", ret
);
2631 ok(stb2
.base
.pbase
== stb2
.base
.base
+ 32, "wrong put pointer, expected %p got %p\n", stb2
.base
.base
+ 32, stb2
.base
.pbase
);
2632 ok(stb2
.base
.pptr
== stb2
.base
.base
+ 32, "wrong put pointer, expected %p got %p\n", stb2
.base
.base
+ 32, stb2
.base
.pptr
);
2633 ok(stb2
.base
.epptr
== stb2
.base
.ebuf
, "wrong put pointer, expected %p got %p\n", stb2
.base
.ebuf
, stb2
.base
.epptr
);
2634 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, -28, SEEKDIR_end
, -1);
2635 ok(ret
== 20, "expected 20 got %d\n", ret
);
2636 stb2
.base
.gptr
= stb2
.base
.egptr
;
2637 stb2
.base
.unbuffered
= 1;
2640 last
= fgetc(stb1
.file
);
2641 ok(last
== 'r', "expected 'r' got %d\n", last
);
2642 ok(ftell(stb1
.file
) == 30, "ftell failed\n");
2643 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'i');
2644 ok(ret
== 'i', "expected 'i' got %d\n", ret
);
2645 ok(ftell(stb1
.file
) == 29, "ftell failed\n");
2646 last
= fgetc(stb1
.file
);
2647 ok(last
== 'r', "expected 'r' got %d\n", last
);
2648 ok(ftell(stb1
.file
) == 30, "ftell failed\n");
2649 stb1
.base
.eback
= stb1
.base
.base
;
2650 stb1
.base
.gptr
= stb1
.base
.egptr
= stb1
.base
.base
+ 9;
2651 strcpy(stb1
.base
.eback
, "pbackfail");
2652 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'j');
2653 ok(ret
== 'j', "expected 'j' got %d\n", ret
);
2654 ok(stb1
.base
.gptr
== stb1
.base
.base
+ 8, "wrong get pointer, expected %p got %p\n", stb1
.base
.base
+ 8, stb1
.base
.gptr
);
2655 ok(strncmp(stb1
.base
.eback
, "pbackfaij", 9) == 0, "strncmp failed\n");
2656 ok(ftell(stb1
.file
) == 30, "ftell failed\n");
2657 stb1
.base
.gptr
= stb1
.base
.eback
;
2658 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'k');
2659 ok(ret
== 'k', "expected 'k' got %d\n", ret
);
2660 ok(stb1
.base
.gptr
== stb1
.base
.base
, "wrong get pointer, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.gptr
);
2661 ok(strncmp(stb1
.base
.eback
, "pbackfaij", 9) == 0, "strncmp failed\n");
2662 ok(ftell(stb1
.file
) == 29, "ftell failed\n");
2663 stb1
.base
.unbuffered
= 0;
2664 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'l');
2665 ok(ret
== 'l', "expected 'l' got %d\n", ret
);
2666 ok(strncmp(stb1
.base
.eback
, "lpbackfai", 9) == 0, "strncmp failed\n");
2667 ok(ftell(stb1
.file
) == 28, "ftell failed\n");
2668 stb1
.base
.egptr
= NULL
;
2669 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'm');
2670 ok(ret
== 'm', "expected 'm' got %d\n", ret
);
2671 ok(strncmp(stb1
.base
.eback
, "lpbackfai", 9) == 0, "strncmp failed\n");
2672 ok(ftell(stb1
.file
) == 27, "ftell failed\n");
2673 stb1
.base
.unbuffered
= 1;
2675 call_func1(p_stdiobuf_dtor
, &stb1
);
2676 call_func1(p_stdiobuf_dtor
, &stb2
);
2679 ok(_unlink(filename1
) == 0, "Couldn't unlink file named '%s'\n", filename1
);
2680 ok(_unlink(filename2
) == 0, "Couldn't unlink file named '%s'\n", filename2
);
2690 static DWORD WINAPI
lock_ios(void *arg
)
2692 struct ios_lock_arg
*lock_arg
= arg
;
2693 p_ios_lock(lock_arg
->ios_obj
);
2694 p_ios_lockbuf(lock_arg
->ios_obj
);
2696 SetEvent(lock_arg
->lock
);
2697 WaitForSingleObject(lock_arg
->release
[0], INFINITE
);
2699 WaitForSingleObject(lock_arg
->release
[1], INFINITE
);
2700 p_ios_unlockbuf(lock_arg
->ios_obj
);
2701 WaitForSingleObject(lock_arg
->release
[2], INFINITE
);
2702 p_ios_unlock(lock_arg
->ios_obj
);
2706 static void test_ios(void)
2708 ios ios_obj
, ios_obj2
;
2710 struct ios_lock_arg lock_arg
;
2713 LONG
*pret
, expected
, ret
;
2717 memset(&ios_obj
, 0xab, sizeof(ios
));
2718 memset(&ios_obj2
, 0xab, sizeof(ios
));
2719 psb
= p_operator_new(sizeof(streambuf
));
2720 ok(psb
!= NULL
, "failed to allocate streambuf object\n");
2721 call_func1(p_streambuf_ctor
, psb
);
2723 /* constructor/destructor */
2724 ok(*p_ios_fLockcInit
== 4, "expected 4 got %d\n", *p_ios_fLockcInit
);
2725 call_func2(p_ios_sb_ctor
, &ios_obj
, NULL
);
2726 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
2727 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
2728 ok(ios_obj
.special
[0] == 0, "expected 0 got %d\n", ios_obj
.special
[0]);
2729 ok(ios_obj
.special
[1] == 0, "expected 0 got %d\n", ios_obj
.special
[1]);
2730 ok(ios_obj
.delbuf
== 0, "expected 0 got %d\n", ios_obj
.delbuf
);
2731 ok(ios_obj
.tie
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.tie
);
2732 ok(ios_obj
.flags
== 0, "expected 0 got %x\n", ios_obj
.flags
);
2733 ok(ios_obj
.precision
== 6, "expected 6 got %d\n", ios_obj
.precision
);
2734 ok(ios_obj
.fill
== ' ', "expected ' ' got %d\n", ios_obj
.fill
);
2735 ok(ios_obj
.width
== 0, "expected 0 got %d\n", ios_obj
.width
);
2736 ok(ios_obj
.do_lock
== -1, "expected -1 got %d\n", ios_obj
.do_lock
);
2737 ok(ios_obj
.lock
.LockCount
== -1, "expected -1 got %d\n", ios_obj
.lock
.LockCount
);
2738 ok(*p_ios_fLockcInit
== 5, "expected 5 got %d\n", *p_ios_fLockcInit
);
2739 ios_obj
.state
= 0x8;
2740 call_func1(p_ios_dtor
, &ios_obj
);
2741 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
2742 ok(*p_ios_fLockcInit
== 4, "expected 4 got %d\n", *p_ios_fLockcInit
);
2743 memset(&ios_obj
, 0xab, sizeof(ios
));
2744 call_func2(p_ios_sb_ctor
, &ios_obj
, psb
);
2745 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
2746 ok(ios_obj
.state
== IOSTATE_goodbit
, "expected %x got %x\n", IOSTATE_goodbit
, ios_obj
.state
);
2747 ok(ios_obj
.special
[0] == 0, "expected 0 got %d\n", ios_obj
.special
[0]);
2748 ok(ios_obj
.special
[1] == 0, "expected 0 got %d\n", ios_obj
.special
[1]);
2749 ok(ios_obj
.delbuf
== 0, "expected 0 got %d\n", ios_obj
.delbuf
);
2750 ok(ios_obj
.tie
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.tie
);
2751 ok(ios_obj
.flags
== 0, "expected 0 got %x\n", ios_obj
.flags
);
2752 ok(ios_obj
.precision
== 6, "expected 6 got %d\n", ios_obj
.precision
);
2753 ok(ios_obj
.fill
== ' ', "expected ' ' got %d\n", ios_obj
.fill
);
2754 ok(ios_obj
.width
== 0, "expected 0 got %d\n", ios_obj
.width
);
2755 ok(ios_obj
.do_lock
== -1, "expected -1 got %d\n", ios_obj
.do_lock
);
2756 ok(*p_ios_fLockcInit
== 5, "expected 5 got %d\n", *p_ios_fLockcInit
);
2757 ios_obj
.state
= 0x8;
2758 call_func1(p_ios_dtor
, &ios_obj
);
2759 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
2760 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
2761 ok(*p_ios_fLockcInit
== 4, "expected 4 got %d\n", *p_ios_fLockcInit
);
2762 memset(&ios_obj
, 0xab, sizeof(ios
));
2763 call_func1(p_ios_ctor
, &ios_obj
);
2764 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
2765 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
2766 ok(ios_obj
.special
[0] == 0, "expected 0 got %d\n", ios_obj
.special
[0]);
2767 ok(ios_obj
.special
[1] == 0, "expected 0 got %d\n", ios_obj
.special
[1]);
2768 ok(ios_obj
.delbuf
== 0, "expected 0 got %d\n", ios_obj
.delbuf
);
2769 ok(ios_obj
.tie
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.tie
);
2770 ok(ios_obj
.flags
== 0, "expected 0 got %x\n", ios_obj
.flags
);
2771 ok(ios_obj
.precision
== 6, "expected 6 got %d\n", ios_obj
.precision
);
2772 ok(ios_obj
.fill
== ' ', "expected ' ' got %d\n", ios_obj
.fill
);
2773 ok(ios_obj
.width
== 0, "expected 0 got %d\n", ios_obj
.width
);
2774 ok(ios_obj
.do_lock
== -1, "expected -1 got %d\n", ios_obj
.do_lock
);
2775 ok(*p_ios_fLockcInit
== 5, "expected 5 got %d\n", *p_ios_fLockcInit
);
2778 ios_obj
.state
|= 0x8;
2779 call_func2(p_ios_init
, &ios_obj
, psb
);
2780 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
2781 ok(ios_obj
.state
== 0x8, "expected %x got %x\n", 0x8, ios_obj
.state
);
2782 call_func2(p_ios_init
, &ios_obj
, NULL
);
2783 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
2784 ok(ios_obj
.state
== (0x8|IOSTATE_badbit
), "expected %x got %x\n", (0x8|IOSTATE_badbit
), ios_obj
.state
);
2787 call_func2(p_ios_init
, &ios_obj
, psb
);
2788 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
2789 ok(ios_obj
.state
== 0x8, "expected %x got %x\n", 0x8, ios_obj
.state
);
2790 call_func1(p_ios_dtor
, &ios_obj
);
2792 /* copy constructor */
2793 memset(&ios_obj
, 0xcd, sizeof(ios
));
2794 call_func2(p_ios_copy_ctor
, &ios_obj
, &ios_obj2
);
2795 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
2796 ok(ios_obj
.state
== (ios_obj2
.state
|IOSTATE_badbit
), "expected %x got %x\n",
2797 ios_obj2
.state
|IOSTATE_badbit
, ios_obj
.state
);
2798 ok(ios_obj
.delbuf
== 0, "expected 0 got %d\n", ios_obj
.delbuf
);
2799 ok(ios_obj
.tie
== ios_obj2
.tie
, "expected %p got %p\n", ios_obj2
.tie
, ios_obj
.tie
);
2800 ok(ios_obj
.flags
== ios_obj2
.flags
, "expected %x got %x\n", ios_obj2
.flags
, ios_obj
.flags
);
2801 ok(ios_obj
.precision
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.precision
);
2802 ok(ios_obj
.fill
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.fill
);
2803 ok(ios_obj
.width
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.width
);
2804 ok(ios_obj
.do_lock
== -1, "expected -1 got %d\n", ios_obj
.do_lock
);
2805 ok(*p_ios_fLockcInit
== 5, "expected 5 got %d\n", *p_ios_fLockcInit
);
2808 ios_obj
.state
= 0xcdcdcdcd;
2809 ios_obj
.delbuf
= 0xcdcdcdcd;
2810 ios_obj
.tie
= (ostream
*) 0xcdcdcdcd;
2811 ios_obj
.flags
= 0xcdcdcdcd;
2812 ios_obj
.precision
= 0xcdcdcdcd;
2813 ios_obj
.fill
= 0xcd;
2814 ios_obj
.width
= 0xcdcdcdcd;
2815 ios_obj
.do_lock
= 0xcdcdcdcd;
2816 call_func2(p_ios_assign
, &ios_obj
, &ios_obj2
);
2817 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
2818 ok(ios_obj
.state
== (ios_obj2
.state
|IOSTATE_badbit
), "expected %x got %x\n",
2819 ios_obj2
.state
|IOSTATE_badbit
, ios_obj
.state
);
2820 ok(ios_obj
.delbuf
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios_obj
.delbuf
);
2821 ok(ios_obj
.tie
== ios_obj2
.tie
, "expected %p got %p\n", ios_obj2
.tie
, ios_obj
.tie
);
2822 ok(ios_obj
.flags
== ios_obj2
.flags
, "expected %x got %x\n", ios_obj2
.flags
, ios_obj
.flags
);
2823 ok(ios_obj
.precision
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.precision
);
2824 ok(ios_obj
.fill
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.fill
);
2825 ok(ios_obj
.width
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.width
);
2826 ok(ios_obj
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios_obj
.do_lock
);
2830 ios_obj
.do_lock
= 1;
2831 ios_obj
.sb
->do_lock
= 0;
2832 p_ios_clrlock(&ios_obj
);
2833 ok(ios_obj
.do_lock
== 1, "expected 1 got %d\n", ios_obj
.do_lock
);
2834 ok(ios_obj
.sb
->do_lock
== 1, "expected 1 got %d\n", ios_obj
.sb
->do_lock
);
2835 ios_obj
.do_lock
= 0;
2836 p_ios_clrlock(&ios_obj
);
2837 ok(ios_obj
.do_lock
== 1, "expected 1 got %d\n", ios_obj
.do_lock
);
2838 ok(ios_obj
.sb
->do_lock
== 1, "expected 1 got %d\n", ios_obj
.sb
->do_lock
);
2839 p_ios_setlock(&ios_obj
);
2840 ok(ios_obj
.do_lock
== 0, "expected 0 got %d\n", ios_obj
.do_lock
);
2841 ok(ios_obj
.sb
->do_lock
== 0, "expected 0 got %d\n", ios_obj
.sb
->do_lock
);
2842 ios_obj
.do_lock
= -1;
2843 p_ios_setlock(&ios_obj
);
2844 ok(ios_obj
.do_lock
== -2, "expected -2 got %d\n", ios_obj
.do_lock
);
2845 ok(ios_obj
.sb
->do_lock
== -1, "expected -1 got %d\n", ios_obj
.sb
->do_lock
);
2847 lock_arg
.ios_obj
= &ios_obj
;
2848 lock_arg
.lock
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
2849 ok(lock_arg
.lock
!= NULL
, "CreateEventW failed\n");
2850 lock_arg
.release
[0] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
2851 ok(lock_arg
.release
[0] != NULL
, "CreateEventW failed\n");
2852 lock_arg
.release
[1] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
2853 ok(lock_arg
.release
[1] != NULL
, "CreateEventW failed\n");
2854 lock_arg
.release
[2] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
2855 ok(lock_arg
.release
[2] != NULL
, "CreateEventW failed\n");
2856 thread
= CreateThread(NULL
, 0, lock_ios
, (void*)&lock_arg
, 0, NULL
);
2857 ok(thread
!= NULL
, "CreateThread failed\n");
2858 WaitForSingleObject(lock_arg
.lock
, INFINITE
);
2860 locked
= TryEnterCriticalSection(&ios_obj
.lock
);
2861 ok(locked
== 0, "the ios object was not locked before\n");
2862 locked
= TryEnterCriticalSection(&ios_obj
.sb
->lock
);
2863 ok(locked
== 0, "the streambuf was not locked before\n");
2864 locked
= TryEnterCriticalSection(p_ios_static_lock
);
2865 ok(locked
== 0, "the static critical section was not locked before\n");
2868 ios_obj
.flags
= 0x8000;
2869 ret
= (LONG
) call_func1(p_ios_flags_get
, &ios_obj
);
2870 ok(ret
== 0x8000, "expected %x got %x\n", 0x8000, ret
);
2871 ret
= (LONG
) call_func2(p_ios_flags_set
, &ios_obj
, 0x444);
2872 ok(ret
== 0x8000, "expected %x got %x\n", 0x8000, ret
);
2873 ok(ios_obj
.flags
== 0x444, "expected %x got %x\n", 0x444, ios_obj
.flags
);
2874 ret
= (LONG
) call_func2(p_ios_flags_set
, &ios_obj
, 0);
2875 ok(ret
== 0x444, "expected %x got %x\n", 0x444, ret
);
2876 ok(ios_obj
.flags
== 0, "expected %x got %x\n", 0, ios_obj
.flags
);
2879 ios_obj
.do_lock
= 0;
2880 ios_obj
.flags
= 0x8400;
2881 ret
= (LONG
) call_func2(p_ios_setf
, &ios_obj
, 0x444);
2882 ok(ret
== 0x8400, "expected %x got %x\n", 0x8400, ret
);
2883 ok(ios_obj
.flags
== 0x8444, "expected %x got %x\n", 0x8444, ios_obj
.flags
);
2884 ret
= (LONG
) call_func3(p_ios_setf_mask
, &ios_obj
, 0x111, 0);
2885 ok(ret
== 0x8444, "expected %x got %x\n", 0x8444, ret
);
2886 ok(ios_obj
.flags
== 0x8444, "expected %x got %x\n", 0x8444, ios_obj
.flags
);
2887 ret
= (LONG
) call_func3(p_ios_setf_mask
, &ios_obj
, 0x111, 0x105);
2888 ok(ret
== 0x8444, "expected %x got %x\n", 0x8444, ret
);
2889 ok(ios_obj
.flags
== 0x8541, "expected %x got %x\n", 0x8541, ios_obj
.flags
);
2892 ret
= (LONG
) call_func2(p_ios_unsetf
, &ios_obj
, 0x1111);
2893 ok(ret
== 0x8541, "expected %x got %x\n", 0x8541, ret
);
2894 ok(ios_obj
.flags
== 0x8440, "expected %x got %x\n", 0x8440, ios_obj
.flags
);
2895 ret
= (LONG
) call_func2(p_ios_unsetf
, &ios_obj
, 0x8008);
2896 ok(ret
== 0x8440, "expected %x got %x\n", 0x8440, ret
);
2897 ok(ios_obj
.flags
== 0x440, "expected %x got %x\n", 0x440, ios_obj
.flags
);
2898 ios_obj
.do_lock
= -1;
2901 ios_obj
.state
= 0x8;
2902 ret
= (LONG
) call_func1(p_ios_good
, &ios_obj
);
2903 ok(ret
== 0, "expected 0 got %d\n", ret
);
2904 ios_obj
.state
= IOSTATE_goodbit
;
2905 ret
= (LONG
) call_func1(p_ios_good
, &ios_obj
);
2906 ok(ret
== 1, "expected 1 got %d\n", ret
);
2907 ret
= (LONG
) call_func1(p_ios_bad
, &ios_obj
);
2908 ok(ret
== 0, "expected 0 got %d\n", ret
);
2909 ios_obj
.state
= (IOSTATE_eofbit
|IOSTATE_badbit
);
2910 ret
= (LONG
) call_func1(p_ios_bad
, &ios_obj
);
2911 ok(ret
== IOSTATE_badbit
, "expected 4 got %d\n", ret
);
2912 ret
= (LONG
) call_func1(p_ios_eof
, &ios_obj
);
2913 ok(ret
== IOSTATE_eofbit
, "expected 1 got %d\n", ret
);
2914 ios_obj
.state
= 0x8;
2915 ret
= (LONG
) call_func1(p_ios_eof
, &ios_obj
);
2916 ok(ret
== 0, "expected 0 got %d\n", ret
);
2917 ret
= (LONG
) call_func1(p_ios_fail
, &ios_obj
);
2918 ok(ret
== 0, "expected 0 got %d\n", ret
);
2919 ios_obj
.state
= IOSTATE_badbit
;
2920 ret
= (LONG
) call_func1(p_ios_fail
, &ios_obj
);
2921 ok(ret
== IOSTATE_badbit
, "expected 4 got %d\n", ret
);
2922 ios_obj
.state
= (IOSTATE_eofbit
|IOSTATE_failbit
);
2923 ret
= (LONG
) call_func1(p_ios_fail
, &ios_obj
);
2924 ok(ret
== IOSTATE_failbit
, "expected 2 got %d\n", ret
);
2925 ios_obj
.state
= (IOSTATE_eofbit
|IOSTATE_failbit
|IOSTATE_badbit
);
2926 ret
= (LONG
) call_func1(p_ios_fail
, &ios_obj
);
2927 ok(ret
== (IOSTATE_failbit
|IOSTATE_badbit
), "expected 6 got %d\n", ret
);
2928 ios_obj
.do_lock
= 0;
2929 call_func2(p_ios_clear
, &ios_obj
, 0);
2930 ok(ios_obj
.state
== IOSTATE_goodbit
, "expected 0 got %d\n", ios_obj
.state
);
2931 call_func2(p_ios_clear
, &ios_obj
, 0x8|IOSTATE_eofbit
);
2932 ok(ios_obj
.state
== (0x8|IOSTATE_eofbit
), "expected 9 got %d\n", ios_obj
.state
);
2933 ios_obj
.do_lock
= -1;
2935 SetEvent(lock_arg
.release
[0]);
2939 for (i
= 0; i
< 20; i
++) {
2940 ret
= p_ios_bitalloc();
2941 ok(ret
== expected
, "expected %x got %x\n", expected
, ret
);
2942 ok(*p_ios_maxbit
== expected
, "expected %x got %x\n", expected
, *p_ios_maxbit
);
2946 /* xalloc/pword/iword */
2947 ok(*p_ios_curindex
== -1, "expected -1 got %d\n", *p_ios_curindex
);
2949 for (i
= 0; i
< 8; i
++) {
2950 ret
= p_ios_xalloc();
2951 ok(ret
== expected
, "expected %d got %d\n", expected
, ret
);
2952 ok(*p_ios_curindex
== expected
, "expected %d got %d\n", expected
, *p_ios_curindex
);
2953 pret
= call_func2(p_ios_iword
, &ios_obj
, ret
);
2954 ok(pret
== &p_ios_statebuf
[ret
], "expected %p got %p\n", &p_ios_statebuf
[ret
], pret
);
2955 ok(*pret
== 0, "expected 0 got %d\n", *pret
);
2956 pret2
= call_func2(p_ios_pword
, &ios_obj
, ret
);
2957 ok(pret2
== (void**)&p_ios_statebuf
[ret
], "expected %p got %p\n", (void**)&p_ios_statebuf
[ret
], pret2
);
2960 ret
= p_ios_xalloc();
2961 ok(ret
== -1, "expected -1 got %d\n", ret
);
2962 ok(*p_ios_curindex
== 7, "expected 7 got %d\n", *p_ios_curindex
);
2964 SetEvent(lock_arg
.release
[1]);
2965 SetEvent(lock_arg
.release
[2]);
2966 WaitForSingleObject(thread
, INFINITE
);
2969 call_func1(p_ios_dtor
, &ios_obj
);
2970 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
2971 ok(*p_ios_fLockcInit
== 4, "expected 4 got %d\n", *p_ios_fLockcInit
);
2972 CloseHandle(lock_arg
.lock
);
2973 CloseHandle(lock_arg
.release
[0]);
2974 CloseHandle(lock_arg
.release
[1]);
2975 CloseHandle(lock_arg
.release
[2]);
2976 CloseHandle(thread
);
2979 static void test_ostream(void) {
2980 ostream os1
, os2
, *pos
;
2981 filebuf fb1
, fb2
, *pfb
;
2982 const char filename1
[] = "test1";
2983 const char filename2
[] = "test2";
2986 memset(&os1
, 0xab, sizeof(ostream
));
2987 memset(&os2
, 0xab, sizeof(ostream
));
2988 memset(&fb1
, 0xab, sizeof(filebuf
));
2989 memset(&fb2
, 0xab, sizeof(filebuf
));
2991 /* constructors/destructors */
2992 pos
= call_func2(p_ostream_ctor
, &os1
, TRUE
);
2993 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
2994 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
2995 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
2996 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
2997 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
2998 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
2999 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3000 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3001 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
3002 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3003 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
3004 call_func1(p_ostream_vbase_dtor
, &os1
);
3005 memset(&os1
, 0xab, sizeof(ostream
));
3006 pos
= call_func3(p_ostream_sb_ctor
, &os1
, &fb1
.base
, TRUE
);
3007 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3008 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
3009 ok(os1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, os1
.base_ios
.sb
);
3010 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3011 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3012 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
3013 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3014 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3015 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
3016 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3017 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
3018 ok(fb1
.base
.allocated
== 0xabababab, "expected %d got %d\n", 0xabababab, fb1
.base
.allocated
);
3019 call_func1(p_ostream_vbase_dtor
, &os1
);
3020 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
3021 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
3022 memset(&os1
.base_ios
, 0xab, sizeof(ios
));
3023 os1
.unknown
= 0xabababab;
3024 os1
.base_ios
.state
= 0xabababab | IOSTATE_badbit
;
3025 pos
= call_func2(p_ostream_ctor
, &os1
, FALSE
);
3026 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3027 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
3028 ok(os1
.base_ios
.sb
== os2
.base_ios
.sb
, "expected %p got %p\n", os2
.base_ios
.sb
, os1
.base_ios
.sb
);
3029 ok(os1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
3030 0xabababab|IOSTATE_badbit
, os1
.base_ios
.state
);
3031 ok(os1
.base_ios
.delbuf
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.delbuf
);
3032 ok(os1
.base_ios
.tie
== os2
.base_ios
.tie
, "expected %p got %p\n", os2
.base_ios
.tie
, os1
.base_ios
.tie
);
3033 ok(os1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, os1
.base_ios
.flags
);
3034 ok(os1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.precision
);
3035 ok(os1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", os1
.base_ios
.fill
);
3036 ok(os1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.width
);
3037 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
3038 call_func1(p_ostream_dtor
, &os1
.base_ios
);
3039 os1
.unknown
= 0xabababab;
3040 os1
.base_ios
.delbuf
= 0;
3041 call_func1(p_filebuf_ctor
, &fb1
);
3042 pfb
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
, filebuf_openprot
);
3043 ok(pfb
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pfb
);
3044 ok(fb1
.base
.allocated
== 1, "expected %d got %d\n", 1, fb1
.base
.allocated
);
3045 pos
= call_func3(p_ostream_sb_ctor
, &os1
, &fb1
.base
, FALSE
);
3046 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3047 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
3048 ok(os1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, os1
.base_ios
.sb
);
3049 ok(os1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.state
);
3050 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3051 ok(os1
.base_ios
.tie
== os2
.base_ios
.tie
, "expected %p got %p\n", os2
.base_ios
.tie
, os1
.base_ios
.tie
);
3052 ok(os1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, os1
.base_ios
.flags
);
3053 ok(os1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.precision
);
3054 ok(os1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", os1
.base_ios
.fill
);
3055 ok(os1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.width
);
3056 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
3057 call_func1(p_ostream_dtor
, &os1
.base_ios
);
3058 memset(&os1
, 0xab, sizeof(ostream
));
3059 pos
= call_func3(p_ostream_sb_ctor
, &os1
, NULL
, TRUE
);
3060 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3061 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
3062 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
3063 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
3064 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3065 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
3066 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3067 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3068 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
3069 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3070 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
3071 call_func1(p_ostream_vbase_dtor
, &os1
);
3072 memset(&os1
.base_ios
, 0xcd, sizeof(ios
));
3073 os1
.unknown
= 0xcdcdcdcd;
3074 pos
= call_func3(p_ostream_copy_ctor
, &os2
, &os1
, TRUE
);
3075 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
3076 ok(os2
.unknown
== 0, "expected 0 got %d\n", os2
.unknown
);
3077 ok(os2
.base_ios
.sb
== os1
.base_ios
.sb
, "expected %p got %p\n", os1
.base_ios
.sb
, os2
.base_ios
.sb
);
3078 ok(os2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os2
.base_ios
.state
);
3079 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
3080 ok(os2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.tie
);
3081 ok(os2
.base_ios
.flags
== 0, "expected 0 got %x\n", os2
.base_ios
.flags
);
3082 ok(os2
.base_ios
.precision
== 6, "expected 6 got %d\n", os2
.base_ios
.precision
);
3083 ok(os2
.base_ios
.fill
== ' ', "expected 32 got %d\n", os2
.base_ios
.fill
);
3084 ok(os2
.base_ios
.width
== 0, "expected 0 got %d\n", os2
.base_ios
.width
);
3085 ok(os2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os2
.base_ios
.do_lock
);
3086 call_func1(p_ostream_vbase_dtor
, &os2
);
3087 memset(&os2
.base_ios
, 0xab, sizeof(ios
));
3088 os2
.unknown
= 0xabababab;
3089 os2
.base_ios
.state
= 0xabababab | IOSTATE_badbit
;
3090 os2
.base_ios
.delbuf
= 0;
3091 os2
.base_ios
.tie
= &os2
;
3092 pos
= call_func3(p_ostream_copy_ctor
, &os2
, &os1
, FALSE
);
3093 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
3094 ok(os2
.unknown
== 0, "expected 0 got %d\n", os2
.unknown
);
3095 ok(os2
.base_ios
.sb
== os1
.base_ios
.sb
, "expected %p got %p\n", os1
.base_ios
.sb
, os2
.base_ios
.sb
);
3096 ok(os2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.state
);
3097 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
3098 ok(os2
.base_ios
.tie
== &os2
, "expected %p got %p\n", &os2
, os2
.base_ios
.tie
);
3099 ok(os2
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, os2
.base_ios
.flags
);
3100 ok(os2
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.precision
);
3101 ok(os2
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", os2
.base_ios
.fill
);
3102 ok(os2
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.width
);
3103 ok(os2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.do_lock
);
3104 call_func1(p_ostream_dtor
, &os2
.base_ios
);
3105 os1
.base_ios
.sb
= NULL
;
3106 pos
= call_func3(p_ostream_copy_ctor
, &os2
, &os1
, TRUE
);
3107 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
3108 ok(os2
.unknown
== 0, "expected 0 got %d\n", os2
.unknown
);
3109 ok(os2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.sb
);
3110 ok(os2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os2
.base_ios
.state
);
3111 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
3112 ok(os2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.tie
);
3113 ok(os2
.base_ios
.flags
== 0, "expected 0 got %x\n", os2
.base_ios
.flags
);
3114 ok(os2
.base_ios
.precision
== 6, "expected 6 got %d\n", os2
.base_ios
.precision
);
3115 ok(os2
.base_ios
.fill
== ' ', "expected 32 got %d\n", os2
.base_ios
.fill
);
3116 ok(os2
.base_ios
.width
== 0, "expected 0 got %d\n", os2
.base_ios
.width
);
3117 ok(os2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os2
.base_ios
.do_lock
);
3120 pos
= call_func2(p_ostream_ctor
, &os1
, TRUE
);
3121 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3122 os1
.unknown
= 0xabababab;
3123 os1
.base_ios
.state
= 0xabababab;
3124 os1
.base_ios
.special
[0] = 0xabababab;
3125 os1
.base_ios
.delbuf
= 0xabababab;
3126 os1
.base_ios
.tie
= (ostream
*) 0xabababab;
3127 os1
.base_ios
.flags
= 0xabababab;
3128 os1
.base_ios
.precision
= 0xabababab;
3129 os1
.base_ios
.width
= 0xabababab;
3130 os1
.base_ios
.do_lock
= 0xabababab;
3131 pos
= call_func2(p_ostream_assign_sb
, &os1
, &fb1
.base
);
3132 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3133 ok(os1
.unknown
== 0xabababab, "expected 0 got %d\n", os1
.unknown
);
3134 ok(os1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, os1
.base_ios
.sb
);
3135 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3136 ok(os1
.base_ios
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.fill
);
3137 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3138 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
3139 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3140 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3141 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3142 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
3143 os1
.base_ios
.state
= 0x8000;
3144 pos
= call_func2(p_ostream_assign_sb
, &os1
, NULL
);
3145 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3146 ok(os1
.unknown
== 0xabababab, "expected 0 got %d\n", os1
.unknown
);
3147 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
3148 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
3149 ok(os1
.base_ios
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.fill
);
3150 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3151 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
3152 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3153 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3154 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3155 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
3156 os2
.unknown
= 0xcdcdcdcd;
3157 os2
.base_ios
.state
= 0xcdcdcdcd;
3158 os2
.base_ios
.special
[0] = 0xcdcdcdcd;
3159 os2
.base_ios
.delbuf
= 0xcdcdcdcd;
3160 os2
.base_ios
.tie
= (ostream
*) 0xcdcdcdcd;
3161 os2
.base_ios
.flags
= 0xcdcdcdcd;
3162 os2
.base_ios
.precision
= 0xcdcdcdcd;
3163 os2
.base_ios
.width
= 0xcdcdcdcd;
3164 os2
.base_ios
.do_lock
= 0xcdcdcdcd;
3165 pos
= call_func2(p_ostream_assign
, &os2
, &os1
);
3166 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
3167 ok(os2
.unknown
== 0xcdcdcdcd, "expected 0 got %d\n", os2
.unknown
);
3168 ok(os2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.sb
);
3169 ok(os2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os2
.base_ios
.state
);
3170 ok(os2
.base_ios
.special
[0] == 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, os2
.base_ios
.fill
);
3171 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
3172 ok(os2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.tie
);
3173 ok(os2
.base_ios
.flags
== 0, "expected 0 got %x\n", os2
.base_ios
.flags
);
3174 ok(os2
.base_ios
.precision
== 6, "expected 6 got %d\n", os2
.base_ios
.precision
);
3175 ok(os2
.base_ios
.width
== 0, "expected 0 got %d\n", os2
.base_ios
.width
);
3176 ok(os2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, os2
.base_ios
.do_lock
);
3179 if (0) /* crashes on native */
3180 pos
= call_func1(p_ostream_flush
, &os1
);
3181 os1
.base_ios
.sb
= &fb2
.base
;
3182 call_func1(p_filebuf_ctor
, &fb2
);
3183 pos
= call_func1(p_ostream_flush
, &os1
);
3184 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3185 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3186 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3187 os1
.base_ios
.sb
= &fb1
.base
;
3188 os1
.base_ios
.state
= IOSTATE_eofbit
;
3189 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "Never gonna tell a lie", 22);
3190 ok(ret
== 22, "expected 22 got %d\n", ret
);
3191 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3192 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 22, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 22, fb1
.base
.pptr
);
3193 pos
= call_func1(p_ostream_flush
, &os1
);
3194 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3195 ok(os1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, os1
.base_ios
.state
);
3196 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3197 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3198 os1
.base_ios
.tie
= &os2
;
3199 os2
.base_ios
.sb
= &fb2
.base
;
3200 os2
.base_ios
.state
= IOSTATE_goodbit
;
3201 pfb
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_out
, filebuf_openprot
);
3202 ok(pfb
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pfb
);
3203 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "and hurt you", 12);
3204 ok(ret
== 12, "expected 12 got %d\n", ret
);
3205 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
3206 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 12, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 12, fb2
.base
.pptr
);
3207 pos
= call_func1(p_ostream_flush
, &os1
);
3208 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3209 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
3210 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 12, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 12, fb2
.base
.pptr
);
3213 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3214 ok(ret
== 0, "expected 0 got %d\n", ret
);
3215 ok(os1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
3216 IOSTATE_eofbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3217 os1
.base_ios
.state
= IOSTATE_badbit
;
3218 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3219 ok(ret
== 0, "expected 0 got %d\n", ret
);
3220 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3221 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3222 os1
.base_ios
.sb
= &fb1
.base
;
3223 os1
.base_ios
.state
= IOSTATE_badbit
;
3224 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3225 ok(ret
== 0, "expected 0 got %d\n", ret
);
3226 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3227 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3228 os1
.base_ios
.state
= IOSTATE_failbit
;
3229 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3230 ok(ret
== 0, "expected 0 got %d\n", ret
);
3231 ok(os1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, os1
.base_ios
.state
);
3232 os1
.base_ios
.state
= IOSTATE_goodbit
;
3233 os1
.base_ios
.tie
= &os2
;
3234 os2
.base_ios
.sb
= NULL
;
3235 if (0) /* crashes on native */
3236 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3237 os2
.base_ios
.sb
= &fb2
.base
;
3238 os2
.base_ios
.state
= IOSTATE_badbit
;
3239 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "We've known each other", 22);
3240 ok(ret
== 22, "expected 22 got %d\n", ret
);
3241 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3242 ok(ret
== 1, "expected 1 got %d\n", ret
);
3243 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3244 ok(os2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os2
.base_ios
.state
);
3245 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3246 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 22, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 22, fb1
.base
.pptr
);
3247 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
3248 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
3251 os1
.base_ios
.state
= IOSTATE_badbit
;
3252 os1
.base_ios
.width
= 0xab;
3253 call_func1(p_ostream_osfx
, &os1
);
3254 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
3255 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3256 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3257 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 22, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 22, fb1
.base
.pptr
);
3258 os1
.base_ios
.state
= IOSTATE_goodbit
;
3259 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3260 ok(ret
== 1, "expected 1 got %d\n", ret
);
3261 os1
.base_ios
.sb
= NULL
;
3262 if (0) /* crashes on native */
3263 call_func1(p_ostream_osfx
, &os1
);
3264 os1
.base_ios
.sb
= &fb1
.base
;
3265 os1
.base_ios
.flags
= FLAGS_unitbuf
;
3266 call_func1(p_ostream_osfx
, &os1
);
3267 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3268 ok(os1
.base_ios
.flags
== FLAGS_unitbuf
, "expected %d got %d\n", FLAGS_unitbuf
, os1
.base_ios
.flags
);
3269 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3270 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3273 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "for so long", 11);
3274 ok(ret
== 11, "expected 11 got %d\n", ret
);
3275 os1
.base_ios
.state
= IOSTATE_badbit
;
3276 os1
.base_ios
.width
= 2;
3277 pos
= call_func2(p_ostream_put_char
, &os1
, 'a');
3278 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3279 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3280 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3281 ok(os1
.base_ios
.width
== 2, "expected 2 got %d\n", os1
.base_ios
.width
);
3282 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3283 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3284 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
3285 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 11, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 11, fb2
.base
.pptr
);
3286 os1
.base_ios
.state
= IOSTATE_goodbit
;
3287 pos
= call_func2(p_ostream_put_char
, &os1
, 'a');
3288 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3289 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3290 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3291 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3292 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3293 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
3294 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
3295 os1
.base_ios
.flags
= 0;
3296 pos
= call_func2(p_ostream_put_char
, &os1
, 'b');
3297 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3298 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3299 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3300 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 1, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.pptr
);
3301 os1
.base_ios
.sb
= NULL
;
3302 if (0) /* crashes on native */
3303 pos
= call_func2(p_ostream_put_char
, &os1
, 'c');
3304 os1
.base_ios
.sb
= &fb1
.base
;
3305 os1
.base_ios
.width
= 5;
3306 call_func1(p_filebuf_sync
, &fb1
);
3309 pos
= call_func2(p_ostream_put_char
, &os1
, 'c');
3310 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3311 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3312 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3313 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3314 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3315 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3319 pos
= call_func3(p_ostream_write_char
, &os1
, "Your", 4);
3320 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3321 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3322 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3323 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3324 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3325 os1
.base_ios
.state
= IOSTATE_goodbit
;
3326 os1
.base_ios
.width
= 1;
3327 pos
= call_func3(p_ostream_write_char
, &os1
, "heart's", 7);
3328 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3329 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3330 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3331 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3332 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 7, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 7, fb1
.base
.pptr
);
3333 os1
.base_ios
.sb
= NULL
;
3334 if (0) /* crashes on native */
3335 pos
= call_func3(p_ostream_write_char
, &os1
, "been", 4);
3336 os1
.base_ios
.sb
= &fb1
.base
;
3337 os1
.base_ios
.width
= 5;
3338 call_func1(p_filebuf_sync
, &fb1
);
3341 pos
= call_func3(p_ostream_write_char
, &os1
, "aching,", 7);
3342 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3343 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3344 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3345 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3346 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3347 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3351 os1
.base_ios
.state
= IOSTATE_eofbit
;
3352 pos
= call_func3(p_ostream_seekp_offset
, &os1
, 0, SEEKDIR_beg
);
3353 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3354 ok(os1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, os1
.base_ios
.state
);
3355 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "but", 3);
3356 ok(ret
== 3, "expected 3 got %d\n", ret
);
3357 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3358 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 3, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 3, fb1
.base
.pptr
);
3359 pos
= call_func3(p_ostream_seekp_offset
, &os1
, 0, SEEKDIR_end
);
3360 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3361 ok(os1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, os1
.base_ios
.state
);
3362 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3363 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3364 pos
= call_func3(p_ostream_seekp_offset
, &os1
, -1, SEEKDIR_beg
);
3365 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3366 ok(os1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
3367 IOSTATE_eofbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3368 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "You're too shy", 14);
3369 ok(ret
== 14, "expected 14 got %d\n", ret
);
3370 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3371 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 14, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.pptr
);
3372 pos
= call_func2(p_ostream_seekp
, &os1
, 0);
3373 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3374 ok(os1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
3375 IOSTATE_eofbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3376 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3377 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3378 os1
.base_ios
.state
= IOSTATE_badbit
;
3379 pos
= call_func2(p_ostream_seekp
, &os1
, -1);
3380 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3381 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3382 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3385 ret
= (int) call_func1(p_ostream_tellp
, &os1
);
3386 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
3387 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3388 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3389 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "to say it", 9);
3390 ok(ret
== 9, "expected 9 got %d\n", ret
);
3391 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3392 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 9, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.pptr
);
3393 ret
= (int) call_func1(p_ostream_tellp
, &os1
);
3394 ok(ret
== 9, "wrong return, expected 9 got %d\n", ret
);
3395 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3396 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3397 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3398 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3399 os1
.base_ios
.state
= IOSTATE_eofbit
;
3402 ret
= (int) call_func1(p_ostream_tellp
, &os1
);
3403 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
3404 ok(os1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
3405 IOSTATE_eofbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3409 os1
.base_ios
.state
= IOSTATE_eofbit
;
3410 os1
.base_ios
.flags
=
3411 FLAGS_right
|FLAGS_hex
|FLAGS_showbase
|FLAGS_showpoint
|FLAGS_showpos
|FLAGS_uppercase
|FLAGS_fixed
;
3412 os1
.base_ios
.fill
= 'z';
3413 os1
.base_ios
.width
= 9;
3414 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "b");
3415 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3416 ok(!strncmp(fb1
.base
.pptr
- 9, "zzzzzzzab", 9), "expected 'zzzzzzzab' got '%s'\n", fb1
.base
.pptr
- 9);
3417 pos
= call_func3(p_ostream_writepad
, &os1
, "aa", "bb");
3418 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3419 ok(!strncmp(fb1
.base
.pptr
- 9, "zzzzzaabb", 9), "expected 'zzzzzaabb' got '%s'\n", fb1
.base
.pptr
- 9);
3420 pos
= call_func3(p_ostream_writepad
, &os1
, "aaaaa", "bbbbb");
3421 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3422 ok(!strncmp(fb1
.base
.pptr
- 10, "aaaaabbbbb", 10), "expected 'aaaaabbbbb' got '%s'\n", fb1
.base
.pptr
- 10);
3423 os1
.base_ios
.flags
|= FLAGS_internal
;
3424 pos
= call_func3(p_ostream_writepad
, &os1
, "aa", "bb");
3425 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3426 ok(!strncmp(fb1
.base
.pptr
- 9, "aazzzzzbb", 9), "expected 'aazzzzzbb' got '%s'\n", fb1
.base
.pptr
- 9);
3427 os1
.base_ios
.flags
&= ~FLAGS_right
;
3428 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "b");
3429 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3430 ok(!strncmp(fb1
.base
.pptr
- 9, "azzzzzzzb", 9), "expected 'azzzzzzzb' got '%s'\n", fb1
.base
.pptr
- 9);
3431 os1
.base_ios
.width
= 6;
3432 pos
= call_func3(p_ostream_writepad
, &os1
, "1", "2");
3433 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3434 ok(!strncmp(fb1
.base
.pptr
- 6, "1zzzz2", 6), "expected '1zzzz2' got '%s'\n", fb1
.base
.pptr
- 6);
3435 pos
= call_func3(p_ostream_writepad
, &os1
, "12345678", "");
3436 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3437 ok(!strncmp(fb1
.base
.pptr
- 8, "12345678", 8), "expected '12345678' got '%s'\n", fb1
.base
.pptr
- 8);
3438 os1
.base_ios
.flags
|= FLAGS_left
;
3439 pos
= call_func3(p_ostream_writepad
, &os1
, "z1", "2z");
3440 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3441 ok(!strncmp(fb1
.base
.pptr
- 6, "z1zz2z", 6), "expected 'z1zz2z' got '%s'\n", fb1
.base
.pptr
- 6);
3442 os1
.base_ios
.flags
&= ~FLAGS_internal
;
3443 pos
= call_func3(p_ostream_writepad
, &os1
, "hell", "o");
3444 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3445 ok(!strncmp(fb1
.base
.pptr
- 6, "helloz", 6), "expected 'helloz' got '%s'\n", fb1
.base
.pptr
- 6);
3446 os1
.base_ios
.flags
|= FLAGS_right
;
3447 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "b");
3448 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3449 ok(!strncmp(fb1
.base
.pptr
- 6, "abzzzz", 6), "expected 'abzzzz' got '%s'\n", fb1
.base
.pptr
- 6);
3450 if (0) /* crashes on native */
3451 pos
= call_func3(p_ostream_writepad
, &os1
, NULL
, "o");
3452 pos
= call_func3(p_ostream_writepad
, &os1
, "", "hello");
3453 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3454 ok(!strncmp(fb1
.base
.pptr
- 6, "helloz", 6), "expected 'helloz' got '%s'\n", fb1
.base
.pptr
- 6);
3455 os1
.base_ios
.fill
= '*';
3456 pos
= call_func3(p_ostream_writepad
, &os1
, "", "");
3457 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3458 ok(!strncmp(fb1
.base
.pptr
- 6, "******", 6), "expected '******' got '%s'\n", fb1
.base
.pptr
- 6);
3459 pos
= call_func3(p_ostream_writepad
, &os1
, "aa", "");
3460 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3461 ok(!strncmp(fb1
.base
.pptr
- 6, "aa****", 6), "expected 'aa****' got '%s'\n", fb1
.base
.pptr
- 6);
3462 os1
.base_ios
.flags
= 0;
3463 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "b");
3464 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3465 ok(!strncmp(fb1
.base
.pptr
- 6, "****ab", 6), "expected '****ab' got '%s'\n", fb1
.base
.pptr
- 6);
3466 call_func1(p_filebuf_sync
, &fb1
);
3468 pos
= call_func3(p_ostream_writepad
, &os1
, "aa", "bb");
3469 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3470 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
), "expected %d got %d\n",
3471 IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
, os1
.base_ios
.state
);
3472 os1
.base_ios
.state
= IOSTATE_goodbit
;
3473 pos
= call_func3(p_ostream_writepad
, &os1
, "", "");
3474 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3475 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3476 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3477 os1
.base_ios
.state
= IOSTATE_goodbit
;
3478 os1
.base_ios
.width
= 0;
3479 pos
= call_func3(p_ostream_writepad
, &os1
, "", "");
3480 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3481 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3482 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "");
3483 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3484 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3485 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3488 call_func1(p_ostream_vbase_dtor
, &os1
);
3489 call_func1(p_ostream_vbase_dtor
, &os2
);
3490 call_func1(p_filebuf_dtor
, &fb1
);
3491 call_func1(p_filebuf_dtor
, &fb2
);
3492 ok(_unlink(filename1
) == 0, "Couldn't unlink file named '%s'\n", filename1
);
3493 ok(_unlink(filename2
) == 0, "Couldn't unlink file named '%s'\n", filename2
);
3496 static void test_ostream_print(void)
3498 const BOOL is_64
= (sizeof(void*) == 8);
3500 strstreambuf ssb
, ssb_test1
, ssb_test2
, ssb_test3
, *pssb
;
3501 LONG length
, expected_length
;
3504 char param_char
[] = {'a', '9', 'e'};
3505 const char* param_str
[] = {"Test", "800", "3.14159", " Test"};
3506 int param_int
[] = {0, 7, 10, 24 ,55, 1024, 1023, 65536, 2147483647, 2147483648u, 4294967295u, -20};
3507 float param_float
[] = {1.0f
, 0.0f
, 4.25f
, 3.999f
, 12.0005f
, 15.33582f
, 15.0f
, 15.22f
, 21.123f
, 0.1f
,
3508 13.14159f
, 0.00013f
, 0.000013f
, INFINITY
, -INFINITY
, NAN
};
3509 double param_double
[] = {1.0, 3.141592653589793238, 314.1592653589793238, 314.159265358979,
3510 1231314.269811862199, 9.961472e6
, 8.98846567431e307
, DBL_MAX
};
3511 void* param_ptr
[] = {NULL
, (void*) 0xdeadbeef, (void*) 0x1234cdef, (void*) 0x1, (void*) 0xffffffff};
3512 streambuf
* param_streambuf
[] = {NULL
, &ssb_test1
.base
, &ssb_test2
.base
, &ssb_test3
.base
};
3513 struct ostream_print_test
{
3514 enum { type_chr
, type_str
, type_int
, type_flt
, type_dbl
, type_ptr
, type_sbf
} type
;
3521 const char *expected_text
;
3522 ios_io_state expected_flags
;
3525 {type_chr
, /* 'a' */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3526 {type_chr
, /* 'a' */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3527 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0, "a", IOSTATE_goodbit
},
3528 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, 0, 6, ' ', 4, " a", IOSTATE_goodbit
},
3529 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, 0, 6, 'x', 3, "xxa", IOSTATE_goodbit
},
3530 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, FLAGS_left
, 6, ' ', 4, "a ", IOSTATE_goodbit
},
3531 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, FLAGS_left
|FLAGS_internal
, 6, ' ', 4, " a", IOSTATE_goodbit
},
3532 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 4, " a", IOSTATE_goodbit
},
3533 {type_chr
, /* '9' */ 1, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_showbase
|FLAGS_uppercase
, 6, 'i', 2, "i9", IOSTATE_goodbit
},
3534 {type_chr
, /* '9' */ 1, IOSTATE_goodbit
, FLAGS_showpos
|FLAGS_scientific
, 0, 'i', 2, "i9", IOSTATE_goodbit
},
3535 {type_chr
, /* 'e' */ 2, IOSTATE_goodbit
, FLAGS_left
|FLAGS_right
|FLAGS_uppercase
, 0, '*', 8, "e*******", IOSTATE_goodbit
},
3537 {type_str
, /* "Test" */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3538 {type_str
, /* "Test" */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3539 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0, "Test", IOSTATE_goodbit
},
3540 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, 0, 6, ' ', 6, " Test", IOSTATE_goodbit
},
3541 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, FLAGS_internal
, 6, 'x', 6, "xxTest", IOSTATE_goodbit
},
3542 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, FLAGS_left
, 6, ' ', 5, "Test ", IOSTATE_goodbit
},
3543 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
|FLAGS_showpoint
, 6, '?', 6, "Test??", IOSTATE_goodbit
},
3544 {type_str
, /* "800" */ 1, IOSTATE_goodbit
, FLAGS_showbase
|FLAGS_showpos
, 6, ' ', 4, " 800", IOSTATE_goodbit
},
3545 {type_str
, /* "3.14159" */ 2, IOSTATE_goodbit
, FLAGS_scientific
, 2, 'x', 2, "3.14159", IOSTATE_goodbit
},
3546 {type_str
, /* " Test" */ 3, IOSTATE_goodbit
, FLAGS_skipws
, 6, 'x', 2, " Test", IOSTATE_goodbit
},
3548 {type_int
, /* 0 */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3549 {type_int
, /* 0 */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3550 {type_int
, /* 0 */ 0, IOSTATE_goodbit
, 0, 6, ' ', 4, " 0", IOSTATE_goodbit
},
3551 {type_int
, /* 7 */ 1, IOSTATE_goodbit
, 0, 6, '0', 3, "007", IOSTATE_goodbit
},
3552 {type_int
, /* 10 */ 2, IOSTATE_goodbit
, FLAGS_left
, 6, ' ', 5, "10 ", IOSTATE_goodbit
},
3553 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
, 6, ' ', 0, "18", IOSTATE_goodbit
},
3554 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 0, "0x18", IOSTATE_goodbit
},
3555 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_hex
|FLAGS_showbase
, 6, '*', 8, "0x****18", IOSTATE_goodbit
},
3556 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_showbase
, 6, '*', 4, "*030", IOSTATE_goodbit
},
3557 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_dec
|FLAGS_showbase
, 6, ' ', 0, "030", IOSTATE_goodbit
},
3558 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_dec
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 0, "0x18", IOSTATE_goodbit
},
3559 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_left
|FLAGS_oct
|FLAGS_hex
, 6, ' ', 5, "18 ", IOSTATE_goodbit
},
3560 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 0, "0x18", IOSTATE_goodbit
},
3561 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_showbase
, 6, ' ', 0, "24", IOSTATE_goodbit
},
3562 {type_int
, /* 55 */ 4, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_uppercase
, 6, ' ', 0, "0X37", IOSTATE_goodbit
},
3563 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_showpoint
|FLAGS_uppercase
, 6, ' ', 0, "0X400", IOSTATE_goodbit
},
3564 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_showpos
, 6, ' ', 0, "0x400", IOSTATE_goodbit
},
3565 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showpos
, 6, ' ', 0, "400", IOSTATE_goodbit
},
3566 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_showpos
, 6, ' ', 0, "2000", IOSTATE_goodbit
},
3567 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_oct
|FLAGS_showbase
, 6, 'x', 8, "0xxx2000", IOSTATE_goodbit
},
3568 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_showbase
|FLAGS_showpoint
|FLAGS_showpos
, 6, ' ', 0, "+1024", IOSTATE_goodbit
},
3569 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_showbase
|FLAGS_showpos
, 6, 'a', 6, "a+1024", IOSTATE_goodbit
},
3570 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_showbase
|FLAGS_showpos
, 6, ' ', 8, "+ 1024", IOSTATE_goodbit
},
3571 {type_int
, /* 1023 */ 6, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_uppercase
, 6, ' ', 0, "0X3FF", IOSTATE_goodbit
},
3572 {type_int
, /* 1023 */ 6, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_scientific
, 6, ' ', 0, "0x3ff", IOSTATE_goodbit
},
3573 {type_int
, /* 65536 */ 7, IOSTATE_goodbit
, FLAGS_right
|FLAGS_showpos
|FLAGS_fixed
, 6, ' ', 8, " +65536", IOSTATE_goodbit
},
3574 {type_int
, /* 2147483647 */ 8, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
, 6, ' ', 0, "0x7fffffff", IOSTATE_goodbit
},
3575 {type_int
, /* 2147483648 */ 9, IOSTATE_goodbit
, FLAGS_dec
, 6, ' ', 0, "-2147483648", IOSTATE_goodbit
},
3576 {type_int
, /* 4294967295 */ 10, IOSTATE_goodbit
, FLAGS_internal
, 6, ' ', 8, " -1", IOSTATE_goodbit
},
3577 {type_int
, /* -20 */ 11, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_oct
|FLAGS_showbase
, 6, ' ', 8, "037777777754", IOSTATE_goodbit
},
3578 {type_int
, /* -20 */ 11, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_showpos
, 6, ' ', 0, "-20", IOSTATE_goodbit
},
3579 {type_int
, /* 0 */ 0, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_showpos
, 6, ' ', 8, " 0", IOSTATE_goodbit
},
3581 {type_flt
, /* 1.0f */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3582 {type_flt
, /* 1.0f */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3583 {type_flt
, /* 1.0f */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0, "1", IOSTATE_goodbit
},
3584 {type_flt
, /* 0.0f */ 1, IOSTATE_goodbit
, 0, 6, ' ', 0, "0", IOSTATE_goodbit
},
3585 {type_flt
, /* 4.25f */ 2, IOSTATE_goodbit
, 0, 6, ' ', 0, "4.25", IOSTATE_goodbit
},
3586 {type_flt
, /* 3.999f */ 3, IOSTATE_goodbit
, 0, 6, ' ', 0, "3.999", IOSTATE_goodbit
},
3587 {type_flt
, /* 3.999f */ 3, IOSTATE_goodbit
, 0, 3, ' ', 0, "4", IOSTATE_goodbit
},
3588 {type_flt
, /* 12.0005f */ 4, IOSTATE_goodbit
, 0, 6, ' ', 0, "12.0005", IOSTATE_goodbit
},
3589 {type_flt
, /* 12.0005f */ 4, IOSTATE_goodbit
, 0, 5, ' ', 0, "12", IOSTATE_goodbit
},
3590 {type_flt
, /* 15.33582f */ 5, IOSTATE_goodbit
, 0, 4, ' ', 0, "15.34", IOSTATE_goodbit
},
3591 {type_flt
, /* 15.0f */ 6, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 4, " 15", IOSTATE_goodbit
},
3592 {type_flt
, /* 15.22f */ 7, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
|FLAGS_showbase
, 3, ' ', 6, "15.2 ", IOSTATE_goodbit
},
3593 {type_flt
, /* 15.22 */ 7, IOSTATE_goodbit
, FLAGS_internal
, 3, 'x', 6, "xx15.2", IOSTATE_goodbit
},
3594 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_showpoint
, 9, ' ', 0, "21.1230", IOSTATE_goodbit
},
3595 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_showpos
, 9, ' ', 0, "+21.123", IOSTATE_goodbit
},
3596 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_showpos
, 9, ' ', 8, "+ 21.123", IOSTATE_goodbit
},
3597 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_showpos
, 0, ' ', 0, "+2e+001", IOSTATE_goodbit
},
3598 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, 0, 1, ' ', 0, "2e+001", IOSTATE_goodbit
},
3599 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_showpos
, 2, ' ', 0, "+21", IOSTATE_goodbit
},
3600 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, 0, 4, ' ', 0, "21.12", IOSTATE_goodbit
},
3601 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
, 2, ' ', 0, "2.11e+001", IOSTATE_goodbit
},
3602 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
, 4, ' ', 0, "2.1123e+001", IOSTATE_goodbit
},
3603 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
, 6, ' ', 0, "2.112300e+001", IOSTATE_goodbit
},
3604 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
|FLAGS_uppercase
, 2, ' ', 0, "2.11E+001", IOSTATE_goodbit
},
3605 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
|FLAGS_uppercase
, 2, '*', 10, "*2.11E+001", IOSTATE_goodbit
},
3606 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_fixed
, 6, ' ', 0, "21.122999", IOSTATE_goodbit
},
3607 {type_flt
, /* 0.1f */ 9, IOSTATE_goodbit
, FLAGS_fixed
, 6, ' ', 0, "0.100000", IOSTATE_goodbit
},
3608 {type_flt
, /* 0.1f */ 9, IOSTATE_goodbit
, FLAGS_scientific
, 6, ' ', 0, "1.000000e-001", IOSTATE_goodbit
},
3609 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_fixed
, 3, ' ', 0, "13.142", IOSTATE_goodbit
},
3610 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_fixed
, 8, ' ', 0, "13.141590", IOSTATE_goodbit
},
3611 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_fixed
|FLAGS_showpoint
, 8, ' ', 0, "13.141590", IOSTATE_goodbit
},
3612 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_scientific
|FLAGS_fixed
, 8, ' ', 0, "13.1416", IOSTATE_goodbit
},
3613 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_scientific
|FLAGS_fixed
, 2, ' ', 0, "13", IOSTATE_goodbit
},
3614 {type_flt
, /* 0.00013f */ 11, IOSTATE_goodbit
, 0, -1, ' ', 0, "0.00013", IOSTATE_goodbit
},
3615 {type_flt
, /* 0.00013f */ 11, IOSTATE_goodbit
, 0, -1, ' ', 0, "0.00013", IOSTATE_goodbit
},
3616 {type_flt
, /* 0.00013f */ 11, IOSTATE_goodbit
, 0, -1, ' ', 0, "0.00013", IOSTATE_goodbit
},
3617 {type_flt
, /* 0.000013f */ 12, IOSTATE_goodbit
, 0, 4, ' ', 0, "1.3e-005", IOSTATE_goodbit
},
3618 {type_flt
, /* 0.000013f */ 12, IOSTATE_goodbit
, FLAGS_showpoint
, 4, ' ', 0, "1.300e-005", IOSTATE_goodbit
},
3619 {type_flt
, /* 0.000013f */ 12, IOSTATE_goodbit
, FLAGS_showpoint
, 6, ' ', 0, "1.30000e-005", IOSTATE_goodbit
},
3620 {type_flt
, /* INFINITY */ 13, IOSTATE_goodbit
, 0, 6, ' ', 0, "1.#INF", IOSTATE_goodbit
},
3621 {type_flt
, /* INFINITY */ 13, IOSTATE_goodbit
, 0, 4, ' ', 0, "1.#IO", IOSTATE_goodbit
},
3622 {type_flt
, /* -INFINITY */ 14, IOSTATE_goodbit
, 0, 6, ' ', 0, "-1.#INF", IOSTATE_goodbit
},
3623 {type_flt
, /* NAN */ 15, IOSTATE_goodbit
, 0, 6, ' ', 0, "1.#QNAN", IOSTATE_goodbit
},
3625 {type_dbl
, /* 1.0 */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0, "1", IOSTATE_goodbit
},
3626 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 6, ' ', 0, "3.14159", IOSTATE_goodbit
},
3627 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 9, ' ', 0, "3.14159265", IOSTATE_goodbit
},
3628 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 12, ' ', 0, "3.14159265359", IOSTATE_goodbit
},
3629 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 15, ' ', 0, "3.14159265358979", IOSTATE_goodbit
},
3630 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 16, ' ', 0, "3.14159265358979", IOSTATE_goodbit
},
3631 {type_dbl
, /* 314.1592653589793238 */ 2, IOSTATE_goodbit
, 0, 16, ' ', 0, "314.159265358979", IOSTATE_goodbit
},
3632 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, FLAGS_scientific
, 16, ' ', 0, "3.141592653589793e+000", IOSTATE_goodbit
},
3633 {type_dbl
, /* 314.1592653589793238 */ 2, IOSTATE_goodbit
, FLAGS_scientific
, 16, ' ', 0, "3.141592653589793e+002", IOSTATE_goodbit
},
3634 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, FLAGS_fixed
, -1, ' ', 0, "3.141592653589793", IOSTATE_goodbit
},
3635 {type_dbl
, /* 314.159265358979 */ 3, IOSTATE_goodbit
, FLAGS_fixed
, 12, ' ', 0, "314.159265358979", IOSTATE_goodbit
},
3636 {type_dbl
, /* 1231314.269811862199 */ 4, IOSTATE_goodbit
, FLAGS_fixed
, 10, ' ', 0, "1231314.2698118621", IOSTATE_goodbit
},
3637 {type_dbl
, /* 9.961472e6 */ 5, IOSTATE_goodbit
, FLAGS_fixed
, 500, ' ', 0, "9961472.000000000000000", IOSTATE_goodbit
},
3638 /* crashes on XP/2k3 {type_dbl, 8.98846567431e307 6, IOSTATE_goodbit, FLAGS_fixed, 500, ' ', 0, "", IOSTATE_goodbit}, */
3639 /* crashes on XP/2k3 {type_dbl, DBL_MAX 7, IOSTATE_goodbit, FLAGS_fixed|FLAGS_showpos, 500, ' ', 5, " ", IOSTATE_goodbit}, */
3640 {type_dbl
, /* DBL_MAX */ 7, IOSTATE_goodbit
, FLAGS_showpoint
, 500, ' ', 0, "1.79769313486232e+308", IOSTATE_goodbit
},
3642 {type_ptr
, /* NULL */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3643 {type_ptr
, /* NULL */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3644 {type_ptr
, /* NULL */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0,
3645 is_64
? "0x0000000000000000" : "0x00000000", IOSTATE_goodbit
},
3646 {type_ptr
, /* 0xdeadbeef */ 1, IOSTATE_goodbit
, 0, 6, ' ', 0,
3647 is_64
? "0x00000000DEADBEEF" : "0xDEADBEEF", IOSTATE_goodbit
},
3648 {type_ptr
, /* 0xdeadbeef */ 1, IOSTATE_goodbit
, 0, 6, '*', 12,
3649 is_64
? "0x00000000DEADBEEF" : "**0xDEADBEEF", IOSTATE_goodbit
},
3650 {type_ptr
, /* 0xdeadbeef */ 1, IOSTATE_goodbit
, FLAGS_internal
, 6, ' ', 14,
3651 is_64
? "0x00000000DEADBEEF" : "0x DEADBEEF", IOSTATE_goodbit
},
3652 {type_ptr
, /* 0xdeadbeef */ 1, IOSTATE_goodbit
, FLAGS_left
, 6, 'x', 11,
3653 is_64
? "0x00000000DEADBEEF" : "0xDEADBEEFx", IOSTATE_goodbit
},
3654 {type_ptr
, /* 0x1234cdef */ 2, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_showpos
, 6, ' ', 0,
3655 is_64
? "0x000000001234CDEF" : "0x1234CDEF", IOSTATE_goodbit
},
3656 {type_ptr
, /* 0x1 */ 3, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_showbase
, 6, ' ', 0,
3657 is_64
? "0x0000000000000001" : "0x00000001", IOSTATE_goodbit
},
3658 {type_ptr
, /* 0xffffffff */ 4, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showpoint
, 6, ' ', 0,
3659 is_64
? "0x00000000FFFFFFFF" : "0xFFFFFFFF", IOSTATE_goodbit
},
3660 {type_ptr
, /* 0xffffffff */ 4, IOSTATE_goodbit
, FLAGS_uppercase
|FLAGS_fixed
, 6, ' ', 0,
3661 is_64
? "0X00000000FFFFFFFF" : "0XFFFFFFFF", IOSTATE_goodbit
},
3662 {type_ptr
, /* 0x1 */ 3, IOSTATE_goodbit
, FLAGS_uppercase
, 6, ' ', 0,
3663 is_64
? "0X0000000000000001" : "0X00000001", IOSTATE_goodbit
},
3664 {type_ptr
, /* NULL */ 0, IOSTATE_goodbit
, FLAGS_uppercase
, 6, ' ', 0,
3665 is_64
? "0x0000000000000000" : "0x00000000", IOSTATE_goodbit
},
3666 {type_ptr
, /* NULL */ 0, IOSTATE_goodbit
, FLAGS_uppercase
|FLAGS_showbase
, 12, 'x', 12,
3667 is_64
? "0x0000000000000000" : "xx0x00000000", IOSTATE_goodbit
},
3668 {type_ptr
, /* NULL */ 0, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_uppercase
|FLAGS_showbase
, 6, '?', 20,
3669 is_64
? "0x??0000000000000000" : "0x??????????00000000", IOSTATE_goodbit
},
3671 {type_sbf
, /* NULL */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3672 {type_sbf
, /* NULL */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3673 /* crashes on native {STREAMBUF, NULL 0, IOSTATE_goodbit, 0, 6, ' ', 0, "", IOSTATE_goodbit}, */
3674 {type_sbf
, /* &ssb_test1.base */ 1, IOSTATE_goodbit
, FLAGS_skipws
|FLAGS_showpos
|FLAGS_uppercase
,
3675 6, ' ', 0, " we both know what's been going on ", IOSTATE_goodbit
},
3676 {type_sbf
, /* &ssb_test1.base */ 2, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
|FLAGS_showbase
,
3677 6, '*', 50, "123 We know the game and", IOSTATE_goodbit
},
3678 {type_sbf
, /* &ssb_test1.base */ 3, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_scientific
|FLAGS_showpoint
,
3679 6, '*', 50, "we're gonna play it 3.14159", IOSTATE_goodbit
}
3682 pssb
= call_func1(p_strstreambuf_ctor
, &ssb
);
3683 ok(pssb
== &ssb
, "wrong return, expected %p got %p\n", &ssb
, pssb
);
3684 pos
= call_func3(p_ostream_sb_ctor
, &os
, &ssb
.base
, TRUE
);
3685 ok(pos
== &os
, "wrong return, expected %p got %p\n", &os
, pos
);
3686 pssb
= call_func1(p_strstreambuf_ctor
, &ssb_test1
);
3687 ok(pssb
== &ssb_test1
, "wrong return, expected %p got %p\n", &ssb_test1
, pssb
);
3688 ret
= (int) call_func3(p_streambuf_xsputn
, &ssb_test1
.base
, " we both know what's been going on ", 36);
3689 ok(ret
== 36, "expected 36 got %d\n", ret
);
3690 pssb
= call_func1(p_strstreambuf_ctor
, &ssb_test2
);
3691 ok(pssb
== &ssb_test2
, "wrong return, expected %p got %p\n", &ssb_test2
, pssb
);
3692 ret
= (int) call_func3(p_streambuf_xsputn
, &ssb_test2
.base
, "123 We know the game and", 24);
3693 ok(ret
== 24, "expected 24 got %d\n", ret
);
3694 pssb
= call_func1(p_strstreambuf_ctor
, &ssb_test3
);
3695 ok(pssb
== &ssb_test3
, "wrong return, expected %p got %p\n", &ssb_test3
, pssb
);
3696 ret
= (int) call_func3(p_streambuf_xsputn
, &ssb_test3
.base
, "we're gonna play it 3.14159", 27);
3697 ok(ret
== 27, "expected 27 got %d\n", ret
);
3699 for (i
= 0; i
< sizeof(tests
) / sizeof(tests
[0]); i
++) {
3700 os
.base_ios
.state
= tests
[i
].state
;
3701 os
.base_ios
.flags
= tests
[i
].flags
;
3702 os
.base_ios
.precision
= tests
[i
].precision
;
3703 os
.base_ios
.fill
= tests
[i
].fill
;
3704 os
.base_ios
.width
= tests
[i
].width
;
3705 ssb
.base
.pptr
= ssb
.base
.pbase
;
3707 switch (tests
[i
].type
) {
3709 pos
= call_func2(p_ostream_print_char
, &os
, (int) param_char
[tests
[i
].param_index
]); break;
3711 pos
= call_func2(p_ostream_print_str
, &os
, param_str
[tests
[i
].param_index
]); break;
3713 pos
= call_func2(p_ostream_print_int
, &os
, param_int
[tests
[i
].param_index
]); break;
3715 pos
= call_func2_ptr_flt(p_ostream_print_float
, &os
, param_float
[tests
[i
].param_index
]); break;
3717 pos
= call_func2_ptr_dbl(p_ostream_print_double
, &os
, param_double
[tests
[i
].param_index
]); break;
3719 pos
= call_func2(p_ostream_print_ptr
, &os
, param_ptr
[tests
[i
].param_index
]); break;
3721 pos
= call_func2(p_ostream_print_streambuf
, &os
, param_streambuf
[tests
[i
].param_index
]); break;
3724 length
= ssb
.base
.pptr
- ssb
.base
.pbase
;
3725 expected_length
= strlen(tests
[i
].expected_text
);
3726 ok(pos
== &os
, "Test %d: wrong return, expected %p got %p\n", i
, &os
, pos
);
3727 ok(os
.base_ios
.state
== tests
[i
].expected_flags
, "Test %d: expected %d got %d\n", i
,
3728 tests
[i
].expected_flags
, os
.base_ios
.state
);
3729 ok(os
.base_ios
.width
== 0, "Test %d: expected 0 got %d\n", i
, os
.base_ios
.width
);
3730 ok(expected_length
== length
, "Test %d: wrong output length, expected %d got %d\n", i
, expected_length
, length
);
3731 ok(!strncmp(tests
[i
].expected_text
, ssb
.base
.pbase
, length
),
3732 "Test %d: wrong output, expected '%s' got '%s'\n", i
, tests
[i
].expected_text
, ssb
.base
.pbase
);
3735 call_func1(p_ostream_vbase_dtor
, &os
);
3736 call_func1(p_strstreambuf_dtor
, &ssb
);
3737 call_func1(p_strstreambuf_dtor
, &ssb_test1
);
3738 call_func1(p_strstreambuf_dtor
, &ssb_test2
);
3739 call_func1(p_strstreambuf_dtor
, &ssb_test3
);
3742 static void test_ostream_withassign(void)
3744 ostream osa1
, osa2
, *posa
, *pos
;
3747 memset(&osa1
, 0xab, sizeof(ostream
));
3748 memset(&osa2
, 0xab, sizeof(ostream
));
3750 /* constructors/destructors */
3751 posa
= call_func3(p_ostream_withassign_sb_ctor
, &osa1
, NULL
, TRUE
);
3752 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3753 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
3754 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
3755 ok(osa1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, osa1
.base_ios
.state
);
3756 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3757 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
3758 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
3759 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
3760 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
3761 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
3762 ok(osa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa1
.base_ios
.do_lock
);
3763 call_func1(p_ostream_withassign_vbase_dtor
, &osa1
);
3764 osa1
.unknown
= 0xabababab;
3765 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
3766 osa1
.base_ios
.delbuf
= 0;
3767 posa
= call_func3(p_ostream_withassign_sb_ctor
, &osa1
, NULL
, FALSE
);
3768 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3769 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
3770 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
3771 ok(osa1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
3772 0xabababab|IOSTATE_badbit
, osa1
.base_ios
.state
);
3773 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3774 ok(osa1
.base_ios
.tie
== osa2
.base_ios
.tie
, "expected %p got %p\n", osa2
.base_ios
.tie
, osa1
.base_ios
.tie
);
3775 ok(osa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, osa1
.base_ios
.flags
);
3776 ok(osa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.precision
);
3777 ok(osa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", osa1
.base_ios
.fill
);
3778 ok(osa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.width
);
3779 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
3780 call_func1(p_ostream_withassign_dtor
, &osa1
.base_ios
);
3781 osa1
.unknown
= 0xabababab;
3782 osa1
.base_ios
.sb
= (streambuf
*) 0xabababab;
3783 posa
= call_func3(p_ostream_withassign_sb_ctor
, &osa1
, &sb
, TRUE
);
3784 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3785 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
3786 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
3787 ok(osa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, osa1
.base_ios
.state
);
3788 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3789 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
3790 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
3791 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
3792 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
3793 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
3794 ok(osa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa1
.base_ios
.do_lock
);
3795 call_func1(p_ostream_withassign_vbase_dtor
, &osa1
);
3796 osa1
.unknown
= 0xabababab;
3797 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
3798 osa1
.base_ios
.state
|= IOSTATE_badbit
;
3799 osa1
.base_ios
.delbuf
= 0;
3800 posa
= call_func3(p_ostream_withassign_sb_ctor
, &osa1
, &sb
, FALSE
);
3801 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3802 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
3803 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
3804 ok(osa1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.state
);
3805 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3806 ok(osa1
.base_ios
.tie
== osa2
.base_ios
.tie
, "expected %p got %p\n", osa2
.base_ios
.tie
, osa1
.base_ios
.tie
);
3807 ok(osa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, osa1
.base_ios
.flags
);
3808 ok(osa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.precision
);
3809 ok(osa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", osa1
.base_ios
.fill
);
3810 ok(osa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.width
);
3811 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
3812 call_func1(p_ostream_withassign_dtor
, &osa1
.base_ios
);
3813 posa
= call_func2(p_ostream_withassign_ctor
, &osa2
, TRUE
);
3814 ok(posa
== &osa2
, "wrong return, expected %p got %p\n", &osa2
, posa
);
3815 ok(osa2
.unknown
== 0, "expected 0 got %d\n", osa2
.unknown
);
3816 ok(osa2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa2
.base_ios
.sb
);
3817 ok(osa2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, osa2
.base_ios
.state
);
3818 ok(osa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa2
.base_ios
.delbuf
);
3819 ok(osa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa2
.base_ios
.tie
);
3820 ok(osa2
.base_ios
.flags
== 0, "expected 0 got %x\n", osa2
.base_ios
.flags
);
3821 ok(osa2
.base_ios
.precision
== 6, "expected 6 got %d\n", osa2
.base_ios
.precision
);
3822 ok(osa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa2
.base_ios
.fill
);
3823 ok(osa2
.base_ios
.width
== 0, "expected 0 got %d\n", osa2
.base_ios
.width
);
3824 ok(osa2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa2
.base_ios
.do_lock
);
3825 call_func1(p_ostream_withassign_vbase_dtor
, &osa2
);
3826 osa2
.unknown
= 0xcdcdcdcd;
3827 memset(&osa2
.base_ios
, 0xcd, sizeof(ios
));
3828 osa2
.base_ios
.delbuf
= 0;
3829 psb
= osa2
.base_ios
.sb
;
3830 pos
= osa2
.base_ios
.tie
;
3831 posa
= call_func2(p_ostream_withassign_ctor
, &osa2
, FALSE
);
3832 ok(posa
== &osa2
, "wrong return, expected %p got %p\n", &osa2
, posa
);
3833 ok(osa2
.unknown
== 0, "expected 0 got %d\n", osa2
.unknown
);
3834 ok(osa2
.base_ios
.sb
== psb
, "expected %p got %p\n", psb
, osa2
.base_ios
.sb
);
3835 ok(osa2
.base_ios
.state
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa2
.base_ios
.state
);
3836 ok(osa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa2
.base_ios
.delbuf
);
3837 ok(osa2
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, osa2
.base_ios
.tie
);
3838 ok(osa2
.base_ios
.flags
== 0xcdcdcdcd, "expected %d got %x\n", 0xcdcdcdcd, osa2
.base_ios
.flags
);
3839 ok(osa2
.base_ios
.precision
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa2
.base_ios
.precision
);
3840 ok(osa2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", osa2
.base_ios
.fill
);
3841 ok(osa2
.base_ios
.width
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa2
.base_ios
.width
);
3842 ok(osa2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa2
.base_ios
.do_lock
);
3843 call_func1(p_ostream_withassign_dtor
, &osa2
.base_ios
);
3844 osa1
.unknown
= 0xabababab;
3845 osa2
.unknown
= osa2
.base_ios
.delbuf
= 0xcdcdcdcd;
3846 posa
= call_func3(p_ostream_withassign_copy_ctor
, &osa1
, &osa2
, TRUE
);
3847 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3848 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
3849 ok(osa1
.base_ios
.sb
== osa2
.base_ios
.sb
, "expected %p got %p\n", osa2
.base_ios
.sb
, osa1
.base_ios
.sb
);
3850 ok(osa1
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, osa1
.base_ios
.state
);
3851 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3852 ok(osa1
.base_ios
.tie
== osa2
.base_ios
.tie
, "expected %p got %p\n", osa2
.base_ios
.tie
, osa1
.base_ios
.tie
);
3853 ok(osa1
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, osa1
.base_ios
.flags
);
3854 ok(osa1
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.precision
);
3855 ok(osa1
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.fill
);
3856 ok(osa1
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.width
);
3857 ok(osa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa1
.base_ios
.do_lock
);
3858 call_func1(p_ostream_withassign_vbase_dtor
, &osa1
);
3859 osa1
.unknown
= 0xabababab;
3860 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
3861 osa1
.base_ios
.state
|= IOSTATE_badbit
;
3862 osa1
.base_ios
.delbuf
= 0;
3863 pos
= osa1
.base_ios
.tie
;
3864 posa
= call_func3(p_ostream_withassign_copy_ctor
, &osa1
, &osa2
, FALSE
);
3865 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3866 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
3867 ok(osa1
.base_ios
.sb
== osa2
.base_ios
.sb
, "expected %p got %p\n", osa2
.base_ios
.sb
, osa1
.base_ios
.sb
);
3868 ok(osa1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.state
);
3869 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3870 ok(osa1
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, osa1
.base_ios
.tie
);
3871 ok(osa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, osa1
.base_ios
.flags
);
3872 ok(osa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.precision
);
3873 ok(osa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", osa1
.base_ios
.fill
);
3874 ok(osa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.width
);
3875 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
3876 call_func1(p_ostream_withassign_dtor
, &osa1
.base_ios
);
3877 osa1
.unknown
= 0xabababab;
3878 osa2
.base_ios
.sb
= NULL
;
3879 posa
= call_func3(p_ostream_withassign_copy_ctor
, &osa1
, &osa2
, TRUE
);
3880 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3881 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
3882 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
3883 ok(osa1
.base_ios
.state
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa1
.base_ios
.state
);
3884 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3885 ok(osa1
.base_ios
.tie
== osa2
.base_ios
.tie
, "expected %p got %p\n", osa2
.base_ios
.tie
, osa1
.base_ios
.tie
);
3886 ok(osa1
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, osa1
.base_ios
.flags
);
3887 ok(osa1
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.precision
);
3888 ok(osa1
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.fill
);
3889 ok(osa1
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.width
);
3890 ok(osa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa1
.base_ios
.do_lock
);
3891 call_func1(p_ostream_withassign_vbase_dtor
, &osa1
);
3892 osa1
.unknown
= 0xabababab;
3893 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
3894 osa1
.base_ios
.delbuf
= 0;
3895 posa
= call_func3(p_ostream_withassign_copy_ctor
, &osa1
, &osa2
, FALSE
);
3896 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3897 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
3898 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
3899 ok(osa1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
3900 0xabababab|IOSTATE_badbit
, osa1
.base_ios
.state
);
3901 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3902 ok(osa1
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, osa1
.base_ios
.tie
);
3903 ok(osa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, osa1
.base_ios
.flags
);
3904 ok(osa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.precision
);
3905 ok(osa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", osa1
.base_ios
.fill
);
3906 ok(osa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.width
);
3907 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
3908 call_func1(p_ostream_withassign_dtor
, &osa1
.base_ios
);
3911 osa1
.unknown
= 0xabababab;
3912 osa1
.base_ios
.sb
= (streambuf
*) 0xabababab;
3913 if (0) /* crashes on native */
3914 osa1
.base_ios
.delbuf
= 0xabababab;
3915 posa
= call_func2(p_ostream_withassign_assign_sb
, &osa1
, &sb
);
3916 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3917 ok(osa1
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.unknown
);
3918 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
3919 ok(osa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, osa1
.base_ios
.state
);
3920 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3921 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
3922 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
3923 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
3924 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
3925 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
3926 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
3927 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
3928 osa1
.base_ios
.delbuf
= 0;
3929 posa
= call_func2(p_ostream_withassign_assign_sb
, &osa1
, NULL
);
3930 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3931 ok(osa1
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.unknown
);
3932 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
3933 ok(osa1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, osa1
.base_ios
.state
);
3934 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3935 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
3936 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
3937 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
3938 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
3939 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
3940 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
3941 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
3942 osa1
.base_ios
.delbuf
= 0;
3943 osa2
.base_ios
.sb
= &sb
;
3944 posa
= call_func2(p_ostream_withassign_assign_os
, &osa1
, &osa2
);
3945 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3946 ok(osa1
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.unknown
);
3947 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
3948 ok(osa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, osa1
.base_ios
.state
);
3949 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3950 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
3951 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
3952 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
3953 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
3954 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
3955 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
3956 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
3957 osa1
.base_ios
.delbuf
= 0;
3958 posa
= call_func2(p_ostream_withassign_assign
, &osa1
, &osa2
);
3959 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
3960 ok(osa1
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.unknown
);
3961 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
3962 ok(osa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, osa1
.base_ios
.state
);
3963 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
3964 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
3965 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
3966 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
3967 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
3968 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
3969 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
3972 static void test_istream(void)
3974 istream is1
, is2
, *pis
;
3976 filebuf fb1
, fb2
, *pfb
;
3977 const char filename1
[] = "test1";
3978 const char filename2
[] = "test2";
3982 memset(&is1
, 0xab, sizeof(istream
));
3983 memset(&is2
, 0xab, sizeof(istream
));
3984 memset(&fb1
, 0xab, sizeof(filebuf
));
3985 memset(&fb2
, 0xab, sizeof(filebuf
));
3987 /* constructors/destructors */
3988 pis
= call_func3(p_istream_sb_ctor
, &is1
, NULL
, TRUE
);
3989 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
3990 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
3991 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
3992 ok(is1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.sb
);
3993 ok(is1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is1
.base_ios
.state
);
3994 ok(is1
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is1
.base_ios
.flags
);
3995 call_func1(p_istream_vbase_dtor
, &is1
);
3996 is1
.extract_delim
= is1
.count
= 0xabababab;
3997 memset(&is1
.base_ios
, 0xab, sizeof(ios
));
3998 is1
.base_ios
.delbuf
= 0;
3999 pis
= call_func3(p_istream_sb_ctor
, &is1
, NULL
, FALSE
);
4000 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4001 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4002 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4003 ok(is1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.sb
);
4004 ok(is1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
4005 0xabababab|IOSTATE_badbit
, is1
.base_ios
.state
);
4006 ok(is1
.base_ios
.flags
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.flags
);
4007 call_func1(p_istream_dtor
, &is1
.base_ios
);
4008 pis
= call_func3(p_istream_sb_ctor
, &is1
, &fb1
.base
, FALSE
);
4009 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4010 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4011 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4012 ok(is1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, is1
.base_ios
.sb
);
4013 ok(is1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.state
);
4014 ok(is1
.base_ios
.flags
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.flags
);
4015 call_func1(p_istream_dtor
, &is1
.base_ios
);
4016 call_func1(p_filebuf_ctor
, &fb1
);
4017 pfb
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
4018 ok(pfb
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pfb
);
4019 ok(fb1
.base
.allocated
== 1, "expected %d got %d\n", 1, fb1
.base
.allocated
);
4020 pis
= call_func3(p_istream_sb_ctor
, &is1
, &fb1
.base
, TRUE
);
4021 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4022 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4023 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4024 ok(is1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, is1
.base_ios
.sb
);
4025 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4026 ok(is1
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is1
.base_ios
.flags
);
4027 pis
= call_func2(p_istream_ctor
, &is2
, TRUE
);
4028 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4029 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
4030 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4031 ok(is2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.sb
);
4032 ok(is2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is2
.base_ios
.state
);
4033 ok(is2
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is2
.base_ios
.flags
);
4034 call_func1(p_istream_vbase_dtor
, &is2
);
4035 is2
.extract_delim
= is2
.count
= 0xabababab;
4036 memset(&is2
.base_ios
, 0xab, sizeof(ios
));
4037 is2
.base_ios
.flags
&= ~FLAGS_skipws
;
4038 pis
= call_func2(p_istream_ctor
, &is2
, FALSE
);
4039 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4040 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
4041 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4042 ok(is2
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, is2
.base_ios
.sb
);
4043 ok(is2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.state
);
4044 ok(is2
.base_ios
.flags
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.flags
);
4045 call_func1(p_istream_dtor
, &is2
.base_ios
);
4046 is1
.extract_delim
= is1
.count
= 0xcdcdcdcd;
4047 is1
.base_ios
.state
= 0xcdcdcdcd;
4048 is1
.base_ios
.flags
&= ~FLAGS_skipws
;
4049 is2
.extract_delim
= is2
.count
= 0xabababab;
4050 memset(&is2
.base_ios
, 0xab, sizeof(ios
));
4051 is2
.base_ios
.flags
&= ~FLAGS_skipws
;
4052 is2
.base_ios
.delbuf
= 0;
4053 pis
= call_func3(p_istream_copy_ctor
, &is2
, &is1
, FALSE
);
4054 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4055 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
4056 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4057 ok(is2
.base_ios
.sb
== is1
.base_ios
.sb
, "expected %p got %p\n", is1
.base_ios
.sb
, is2
.base_ios
.sb
);
4058 ok(is2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.state
);
4059 ok(is2
.base_ios
.flags
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.flags
);
4060 call_func1(p_istream_dtor
, &is2
.base_ios
);
4061 is2
.extract_delim
= is2
.count
= 0xabababab;
4062 memset(&is2
.base_ios
, 0xab, sizeof(ios
));
4063 pis
= call_func3(p_istream_copy_ctor
, &is2
, &is1
, TRUE
);
4064 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4065 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
4066 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4067 ok(is2
.base_ios
.sb
== is1
.base_ios
.sb
, "expected %p got %p\n", is1
.base_ios
.sb
, is2
.base_ios
.sb
);
4068 ok(is2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is2
.base_ios
.state
);
4069 ok(is2
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is2
.base_ios
.flags
);
4072 is2
.extract_delim
= is2
.count
= 0xabababab;
4073 is2
.base_ios
.sb
= (streambuf
*) 0xabababab;
4074 is2
.base_ios
.state
= 0xabababab;
4075 is2
.base_ios
.special
[0] = 0xabababab;
4076 is2
.base_ios
.delbuf
= 0;
4077 is2
.base_ios
.tie
= (ostream
*) 0xabababab;
4078 is2
.base_ios
.flags
= 0xabababab;
4079 is2
.base_ios
.precision
= 0xabababab;
4080 is2
.base_ios
.width
= 0xabababab;
4081 pis
= call_func2(p_istream_assign
, &is2
, &is1
);
4082 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4083 ok(is2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.extract_delim
);
4084 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4085 ok(is2
.base_ios
.sb
== is1
.base_ios
.sb
, "expected %p got %p\n", is1
.base_ios
.sb
, is2
.base_ios
.sb
);
4086 ok(is2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is2
.base_ios
.state
);
4087 ok(is2
.base_ios
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.fill
);
4088 ok(is2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", is2
.base_ios
.delbuf
);
4089 ok(is2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.tie
);
4090 ok(is2
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is2
.base_ios
.flags
);
4091 ok(is2
.base_ios
.precision
== 6, "expected 6 got %d\n", is2
.base_ios
.precision
);
4092 ok(is2
.base_ios
.width
== 0, "expected 0 got %d\n", is2
.base_ios
.width
);
4093 if (0) /* crashes on native */
4094 pis
= call_func2(p_istream_assign
, &is2
, NULL
);
4095 is2
.extract_delim
= is2
.count
= 0xabababab;
4096 is2
.base_ios
.sb
= (streambuf
*) 0xabababab;
4097 is2
.base_ios
.state
= 0xabababab;
4098 is2
.base_ios
.special
[0] = 0xabababab;
4099 is2
.base_ios
.delbuf
= 0;
4100 is2
.base_ios
.tie
= (ostream
*) 0xabababab;
4101 is2
.base_ios
.flags
= 0xabababab;
4102 is2
.base_ios
.precision
= 0xabababab;
4103 is2
.base_ios
.width
= 0xabababab;
4104 pis
= call_func2(p_istream_assign_sb
, &is2
, NULL
);
4105 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4106 ok(is2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.extract_delim
);
4107 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4108 ok(is2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.sb
);
4109 ok(is2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is2
.base_ios
.state
);
4110 ok(is2
.base_ios
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.fill
);
4111 ok(is2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", is2
.base_ios
.delbuf
);
4112 ok(is2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.tie
);
4113 ok(is2
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is2
.base_ios
.flags
);
4114 ok(is2
.base_ios
.precision
== 6, "expected 6 got %d\n", is2
.base_ios
.precision
);
4115 ok(is2
.base_ios
.width
== 0, "expected 0 got %d\n", is2
.base_ios
.width
);
4116 call_func1(p_filebuf_ctor
, &fb2
);
4117 pfb
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
4118 ok(pfb
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pfb
);
4119 ok(fb2
.base
.allocated
== 1, "expected %d got %d\n", 1, fb2
.base
.allocated
);
4120 pis
= call_func2(p_istream_assign_sb
, &is2
, &fb2
.base
);
4121 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4122 ok(is2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.extract_delim
);
4123 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4124 ok(is2
.base_ios
.sb
== &fb2
.base
, "expected %p got %p\n", &fb2
.base
, is2
.base_ios
.sb
);
4125 ok(is2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is2
.base_ios
.state
);
4128 is1
.extract_delim
= is1
.count
= 0;
4129 if (0) /* crashes on native */
4130 is1
.base_ios
.sb
= NULL
;
4131 is1
.base_ios
.state
= IOSTATE_badbit
;
4132 is1
.base_ios
.flags
= 0;
4133 call_func1(p_istream_eatwhite
, &is1
);
4134 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_eofbit
), "expected %d got %d\n",
4135 IOSTATE_badbit
|IOSTATE_eofbit
, is1
.base_ios
.state
);
4136 is1
.base_ios
.state
= IOSTATE_failbit
;
4137 call_func1(p_istream_eatwhite
, &is1
);
4138 ok(is1
.base_ios
.state
== (IOSTATE_failbit
|IOSTATE_eofbit
), "expected %d got %d\n",
4139 IOSTATE_failbit
|IOSTATE_eofbit
, is1
.base_ios
.state
);
4140 is1
.base_ios
.state
= IOSTATE_goodbit
;
4141 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "And if \tyou ask\n\v\f\r me", 23);
4142 ok(ret
== 23, "expected 23 got %d\n", ret
);
4143 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
4144 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 23, fb1
.base
.pptr
);
4145 call_func1(p_istream_eatwhite
, &is1
);
4146 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4147 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
4148 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
4149 ok(fb1
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb1
.base
.epptr
);
4150 is1
.base_ios
.state
= IOSTATE_goodbit
;
4151 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 0, SEEKDIR_beg
, 0);
4152 ok(ret
== 0, "expected 0 got %d\n", ret
);
4153 call_func1(p_istream_eatwhite
, &is1
);
4154 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4155 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
4156 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
4157 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 23, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 23, fb1
.base
.egptr
);
4158 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 3, SEEKDIR_beg
, 0);
4159 ok(ret
== 3, "expected 3 got %d\n", ret
);
4160 call_func1(p_istream_eatwhite
, &is1
);
4161 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4162 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
4163 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 1, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.gptr
);
4164 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 20, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 20, fb1
.base
.egptr
);
4166 call_func1(p_istream_eatwhite
, &is1
);
4167 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4168 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
4169 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
4170 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 20, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 20, fb1
.base
.egptr
);
4172 call_func1(p_istream_eatwhite
, &is1
);
4173 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4174 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
4175 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 18, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 18, fb1
.base
.gptr
);
4176 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 20, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 20, fb1
.base
.egptr
);
4178 call_func1(p_istream_eatwhite
, &is1
);
4179 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4180 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
4181 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4182 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
4185 is1
.count
= 0xabababab;
4186 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
4187 ok(ret
== 0, "expected 0 got %d\n", ret
);
4188 ok(is1
.count
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.count
);
4189 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4190 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4191 is1
.base_ios
.state
= IOSTATE_badbit
;
4192 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
4193 ok(ret
== 0, "expected 0 got %d\n", ret
);
4194 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4195 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
4196 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4197 if (0) /* crashes on native */
4198 is1
.base_ios
.sb
= NULL
;
4199 is1
.base_ios
.state
= IOSTATE_goodbit
;
4200 is1
.base_ios
.tie
= &os
;
4201 pos
= call_func3(p_ostream_sb_ctor
, &os
, &fb2
.base
, TRUE
);
4202 ok(pos
== &os
, "wrong return, expected %p got %p\n", &os
, pos
);
4203 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "how I'm feeling", 15);
4204 ok(ret
== 15, "expected 15 got %d\n", ret
);
4205 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4206 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 15, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 15, fb2
.base
.pptr
);
4208 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
4209 ok(ret
== 1, "expected 1 got %d\n", ret
);
4210 ok(is1
.count
== -1, "expected -1 got %d\n", is1
.count
);
4211 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4212 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
4213 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
4214 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "Don't tell me", 13);
4215 ok(ret
== 13, "expected 13 got %d\n", ret
);
4216 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4217 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 13, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 13, fb2
.base
.pptr
);
4218 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
4219 ok(ret
== 1, "expected 1 got %d\n", ret
);
4220 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4221 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4222 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
4223 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
4224 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "you're too blind to see", 23);
4225 ok(ret
== 23, "expected 23 got %d\n", ret
);
4226 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4227 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 23, fb2
.base
.pptr
);
4228 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4229 fb1
.base
.egptr
= fb1
.base
.base
+ 15;
4230 strcpy(fb1
.base
.eback
, "Never \t gonna ");
4231 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
4232 ok(ret
== 1, "expected 1 got %d\n", ret
);
4233 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4234 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4235 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 23, fb2
.base
.pptr
);
4236 fb1
.base
.gptr
= fb1
.base
.base
+ 4;
4238 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 11);
4239 ok(ret
== 1, "expected 1 got %d\n", ret
);
4240 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4241 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4242 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4243 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 23, fb2
.base
.pptr
);
4246 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 12);
4247 ok(ret
== 1, "expected 1 got %d\n", ret
);
4248 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4249 ok(os
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, os
.base_ios
.state
);
4250 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4251 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 23, fb2
.base
.pptr
);
4252 os
.base_ios
.state
= IOSTATE_goodbit
;
4254 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 12);
4255 ok(ret
== 1, "expected 1 got %d\n", ret
);
4256 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4257 ok(os
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os
.base_ios
.state
);
4258 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
4259 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
4260 is1
.base_ios
.flags
= 0;
4261 fb1
.base
.gptr
= fb1
.base
.base
+ 5;
4262 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
4263 ok(ret
== 1, "expected 1 got %d\n", ret
);
4264 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4265 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
4266 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
4267 ok(ret
== 1, "expected 1 got %d\n", ret
);
4268 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4269 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
4270 is1
.base_ios
.flags
= FLAGS_skipws
;
4271 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
4272 ok(ret
== 1, "expected 1 got %d\n", ret
);
4273 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4274 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
4275 ret
= (int) call_func2(p_istream_ipfx
, &is1
, -1);
4276 ok(ret
== 1, "expected 1 got %d\n", ret
);
4277 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4278 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
4279 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
4280 ok(ret
== 1, "expected 1 got %d\n", ret
);
4281 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4282 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 9, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.gptr
);
4283 fb1
.base
.gptr
= fb1
.base
.base
+ 14;
4284 fb2
.base
.pbase
= fb2
.base
.base
;
4285 fb2
.base
.pptr
= fb2
.base
.epptr
= fb2
.base
.base
+ 23;
4286 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
4287 ok(ret
== 0, "expected 0 got %d\n", ret
);
4288 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4289 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4290 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4291 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
4292 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
4295 is1
.extract_delim
= is1
.count
= 0xabababab;
4296 is1
.base_ios
.state
= IOSTATE_badbit
;
4297 memset(buffer
, 'A', sizeof(buffer
));
4298 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 30, 0);
4299 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4300 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4301 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4302 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
4303 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4304 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4305 is1
.extract_delim
= is1
.count
= 0xabababab;
4306 is1
.base_ios
.state
= IOSTATE_goodbit
;
4307 memset(buffer
, 'A', sizeof(buffer
));
4308 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 30, 0);
4309 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4310 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4311 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4312 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4313 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4314 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4315 is1
.extract_delim
= is1
.count
= 0xabababab;
4316 is1
.base_ios
.state
= IOSTATE_goodbit
;
4317 is1
.base_ios
.flags
= 0;
4318 memset(buffer
, 'A', sizeof(buffer
));
4319 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 0, 0);
4320 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4321 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4322 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4323 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4324 ok(buffer
[0] == 'A', "expected 65 got %d\n", buffer
[0]);
4325 is1
.extract_delim
= is1
.count
= 0xabababab;
4326 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4327 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4328 strcpy(fb1
.base
.base
, " give \n you 11 ! up\t. ");
4329 memset(buffer
, 'A', sizeof(buffer
));
4330 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 30, 0);
4331 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4332 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4333 ok(is1
.count
== 29, "expected 29 got %d\n", is1
.count
);
4334 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4335 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 29, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 29, fb1
.base
.gptr
);
4336 ok(!strncmp(buffer
, fb1
.base
.base
, 29), "unexpected buffer content, got '%s'\n", buffer
);
4337 ok(buffer
[29] == 0, "expected 0 got %d\n", buffer
[29]);
4338 fb1
.base
.gptr
= fb1
.base
.egptr
;
4339 memset(buffer
, 'A', sizeof(buffer
));
4340 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 1, 0);
4341 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4342 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4343 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4344 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4345 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
4346 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4347 is1
.base_ios
.flags
= FLAGS_skipws
;
4348 fb1
.base
.gptr
= fb1
.base
.base
;
4349 memset(buffer
, 'A', sizeof(buffer
));
4350 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, 0);
4351 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4352 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4353 ok(is1
.count
== 19, "expected 19 got %d\n", is1
.count
);
4354 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4355 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 19, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 19, fb1
.base
.gptr
);
4356 ok(!strncmp(buffer
, fb1
.base
.base
, 19), "unexpected buffer content, got '%s'\n", buffer
);
4357 ok(buffer
[19] == 0, "expected 0 got %d\n", buffer
[19]);
4358 fb1
.base
.gptr
= fb1
.base
.base
+ 20;
4359 memset(buffer
, 'A', sizeof(buffer
));
4360 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, 0);
4361 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4362 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4363 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
4364 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4365 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4366 ok(!strncmp(buffer
, fb1
.base
.base
+ 20, 10), "unexpected buffer content, got '%s'\n", buffer
);
4367 ok(buffer
[10] == 0, "expected 0 got %d\n", buffer
[10]);
4368 is1
.extract_delim
= 1;
4369 is1
.base_ios
.state
= IOSTATE_goodbit
;
4370 fb1
.base
.eback
= fb1
.base
.base
;
4371 fb1
.base
.gptr
= fb1
.base
.base
+ 20;
4372 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4373 memset(buffer
, 'A', sizeof(buffer
));
4374 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, -1);
4375 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4376 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4377 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
4378 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4379 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4380 ok(!strncmp(buffer
, fb1
.base
.base
+ 20, 10), "unexpected buffer content, got '%s'\n", buffer
);
4381 ok(buffer
[10] == 0, "expected 0 got %d\n", buffer
[10]);
4382 is1
.base_ios
.state
= IOSTATE_goodbit
;
4383 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4384 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4385 memset(buffer
, 'A', sizeof(buffer
));
4386 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, '\n');
4387 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4388 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4389 ok(is1
.count
== 9, "expected 9 got %d\n", is1
.count
);
4390 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4391 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 9, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.gptr
);
4392 ok(!strncmp(buffer
, fb1
.base
.base
, 9), "unexpected buffer content, got '%s'\n", buffer
);
4393 ok(buffer
[9] == 0, "expected 0 got %d\n", buffer
[9]);
4394 memset(buffer
, 'A', sizeof(buffer
));
4395 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, '\n');
4396 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4397 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4398 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4399 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4400 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 9, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.gptr
);
4401 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4402 is1
.extract_delim
= 0xabababab;
4403 memset(buffer
, 'A', sizeof(buffer
));
4404 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, '\n');
4405 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4406 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4407 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
4408 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4409 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 10, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 10, fb1
.base
.gptr
);
4410 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4411 *fb1
.base
.gptr
= -50;
4412 memset(buffer
, 'A', sizeof(buffer
));
4413 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 2, -50);
4414 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4415 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4416 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
4417 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4418 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 11, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 11, fb1
.base
.gptr
);
4419 ok(buffer
[0] == -50, "expected 0 got %d\n", buffer
[0]);
4420 ok(buffer
[1] == 0, "expected 0 got %d\n", buffer
[1]);
4421 *fb1
.base
.gptr
= -50;
4422 memset(buffer
, 'A', sizeof(buffer
));
4423 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 2, 206);
4424 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4425 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4426 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4427 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4428 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 11, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 11, fb1
.base
.gptr
);
4429 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4430 is1
.extract_delim
= 3;
4431 memset(buffer
, 'A', sizeof(buffer
));
4432 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 2, 206);
4433 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4434 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4435 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
4436 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4437 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 12, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 12, fb1
.base
.gptr
);
4438 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4439 memset(buffer
, 'A', sizeof(buffer
));
4440 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, '!');
4441 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4442 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4443 ok(is1
.count
== 6, "expected 6 got %d\n", is1
.count
);
4444 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4445 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 18, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 18, fb1
.base
.gptr
);
4446 ok(!strncmp(buffer
, fb1
.base
.base
+ 12, 6), "unexpected buffer content, got '%s'\n", buffer
);
4447 ok(buffer
[6] == 0, "expected 0 got %d\n", buffer
[6]);
4448 pis
= call_func4(p_istream_get_str_delim
, &is1
, NULL
, 5, 0);
4449 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4450 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4451 ok(is1
.count
== 4, "expected 4 got %d\n", is1
.count
);
4452 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4453 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 22, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 22, fb1
.base
.gptr
);
4454 fb1
.base
.gptr
= fb1
.base
.egptr
;
4455 memset(buffer
, 'A', sizeof(buffer
));
4456 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 10, 0);
4457 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4458 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4459 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4460 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4461 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4462 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4463 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4464 if (0) /* crashes on native */
4465 pis
= call_func4(p_istream_get_str_delim
, &is1
, (char*) 0x1, 5, 0);
4468 is1
.extract_delim
= is1
.count
= 0xabababab;
4469 is1
.base_ios
.state
= IOSTATE_eofbit
;
4470 memset(buffer
, 'A', sizeof(buffer
));
4471 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 10, 0);
4472 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4473 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4474 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4475 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4476 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4477 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4478 is1
.base_ios
.state
= IOSTATE_goodbit
;
4479 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4480 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4481 memset(buffer
, 'A', sizeof(buffer
));
4482 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 20, 0);
4483 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4484 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4485 ok(is1
.count
== 19, "expected 19 got %d\n", is1
.count
);
4486 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4487 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 19, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 19, fb1
.base
.gptr
);
4488 ok(!strncmp(buffer
, fb1
.base
.base
, 19), "unexpected buffer content, got '%s'\n", buffer
);
4489 ok(buffer
[19] == 0, "expected 0 got %d\n", buffer
[19]);
4490 is1
.extract_delim
= -1;
4491 memset(buffer
, 'A', sizeof(buffer
));
4492 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 20, '\t');
4493 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4494 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4495 ok(is1
.count
== 4, "expected 4 got %d\n", is1
.count
);
4496 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4497 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 23, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 23, fb1
.base
.gptr
);
4498 ok(!strncmp(buffer
, fb1
.base
.base
+ 19, 3), "unexpected buffer content, got '%s'\n", buffer
);
4499 ok(buffer
[3] == 0, "expected 0 got %d\n", buffer
[3]);
4500 *fb1
.base
.gptr
= -50;
4501 memset(buffer
, 'A', sizeof(buffer
));
4502 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 5, -50);
4503 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4504 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4505 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4506 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4507 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 23, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 23, fb1
.base
.gptr
);
4508 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4509 *(fb1
.base
.gptr
+ 1) = -40;
4510 *(fb1
.base
.gptr
+ 2) = -30;
4511 memset(buffer
, 'A', sizeof(buffer
));
4512 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 5, -30);
4513 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4514 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4515 ok(is1
.count
== 2, "expected 2 got %d\n", is1
.count
);
4516 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4517 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 25, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 25, fb1
.base
.gptr
);
4518 ok(buffer
[0] == -50, "expected -50 got %d\n", buffer
[0]);
4519 ok(buffer
[1] == -40, "expected -40 got %d\n", buffer
[1]);
4520 ok(buffer
[2] == 0, "expected 0 got %d\n", buffer
[2]);
4523 is1
.count
= 0xabababab;
4524 is1
.base_ios
.state
= IOSTATE_eofbit
;
4525 ret
= (int) call_func1(p_istream_get
, &is1
);
4526 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
4527 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4528 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4529 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4530 is1
.base_ios
.state
= IOSTATE_badbit
;
4531 ret
= (int) call_func1(p_istream_get
, &is1
);
4532 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
4533 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4534 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
4535 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4536 is1
.base_ios
.state
= IOSTATE_goodbit
;
4537 fb1
.base
.egptr
= NULL
;
4538 ret
= (int) call_func1(p_istream_get
, &is1
);
4539 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
4540 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4541 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4542 is1
.base_ios
.state
= IOSTATE_goodbit
;
4543 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4544 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4545 ret
= (int) call_func1(p_istream_get
, &is1
);
4546 ok(ret
== ' ', "expected %d got %d\n", ' ', ret
);
4547 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
4548 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4549 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 1, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.gptr
);
4550 *fb1
.base
.gptr
= '\n';
4551 ret
= (int) call_func1(p_istream_get
, &is1
);
4552 ok(ret
== '\n', "expected %d got %d\n", '\n', ret
);
4553 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
4554 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4555 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 2, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 2, fb1
.base
.gptr
);
4556 *fb1
.base
.gptr
= -50;
4557 ret
= (int) call_func1(p_istream_get
, &is1
);
4558 ok(ret
== 206, "expected 206 got %d\n", ret
);
4559 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
4560 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4561 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 3, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 3, fb1
.base
.gptr
);
4562 fb1
.base
.gptr
= fb1
.base
.base
+ 30;
4563 ret
= (int) call_func1(p_istream_get
, &is1
);
4564 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
4565 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4566 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4567 ok(fb1
.base
.gptr
== (char*) 1, "wrong get pointer, expected %p got %p\n", (char*) 1, fb1
.base
.gptr
);
4570 is1
.count
= 0xabababab;
4571 is1
.base_ios
.state
= IOSTATE_badbit
;
4573 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
4574 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4575 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4576 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
4577 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4578 ok(c
== (char) 0xab, "expected %d got %d\n", (char) 0xab, c
);
4579 is1
.base_ios
.state
= IOSTATE_goodbit
;
4580 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
4581 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4582 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4583 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4584 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4585 ok(c
== EOF
, "expected -1 got %d\n", c
);
4586 is1
.base_ios
.state
= IOSTATE_goodbit
;
4587 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4588 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4589 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
4590 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4591 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
4592 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4593 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 1, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.gptr
);
4594 ok(c
== ' ', "expected %d got %d\n", ' ', c
);
4595 fb1
.base
.gptr
= fb1
.base
.base
+ 2;
4596 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
4597 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4598 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
4599 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4600 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 3, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 3, fb1
.base
.gptr
);
4601 ok(c
== -50, "expected %d got %d\n", -50, c
);
4602 if (0) /* crashes on native */
4603 pis
= call_func2(p_istream_get_char
, &is1
, NULL
);
4604 fb1
.base
.gptr
= fb1
.base
.base
+ 30;
4605 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
4606 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4607 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4608 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4609 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4610 ok(fb1
.base
.gptr
== (char*) 1, "wrong get pointer, expected %p got %p\n", (char*) 1, fb1
.base
.gptr
);
4611 ok(c
== EOF
, "expected -1 got %d\n", c
);
4612 is1
.base_ios
.state
= IOSTATE_failbit
;
4613 pis
= call_func2(p_istream_get_char
, &is1
, NULL
);
4614 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4615 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4616 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
4617 ok(fb1
.base
.gptr
== (char*) 1, "wrong get pointer, expected %p got %p\n", (char*) 1, fb1
.base
.gptr
);
4620 is1
.count
= 0xabababab;
4621 is1
.base_ios
.state
= IOSTATE_badbit
;
4622 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, 0);
4623 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4624 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4625 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
4626 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4627 is1
.base_ios
.state
= IOSTATE_goodbit
;
4628 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, 0);
4629 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4630 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4631 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4632 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
4633 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4634 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
4635 is1
.base_ios
.state
= IOSTATE_goodbit
;
4636 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4637 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4638 strcpy(fb1
.base
.base
, " Never gonna \nlet you \r down?");
4639 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, 0);
4640 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4641 ok(is1
.count
== 30, "expected 30 got %d\n", is1
.count
);
4642 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4643 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
4644 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4645 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
4646 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4647 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 30, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 30, fb2
.base
.pptr
);
4648 ok(fb2
.base
.epptr
== fb2
.base
.ebuf
, "wrong put end, expected %p got %p\n", fb2
.base
.ebuf
, fb2
.base
.epptr
);
4649 ok(!strncmp(fb2
.base
.pbase
, " Never gonna \nlet you \r down?", 30), "unexpected sb content, got '%s'\n", fb2
.base
.pbase
);
4650 is1
.base_ios
.state
= IOSTATE_goodbit
;
4651 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4652 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4653 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, '\n');
4654 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4655 ok(is1
.count
== 14, "expected 14 got %d\n", is1
.count
);
4656 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4657 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
4658 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
4659 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 30, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.egptr
);
4660 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4661 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 44, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 44, fb2
.base
.pptr
);
4662 ok(fb2
.base
.epptr
== fb2
.base
.ebuf
, "wrong put end, expected %p got %p\n", fb2
.base
.ebuf
, fb2
.base
.epptr
);
4663 ok(!strncmp(fb2
.base
.base
+ 30, " Never gonna ", 14), "unexpected sb content, got '%s'\n", fb2
.base
.pbase
);
4666 fb2
.base
.pbase
= fb2
.base
.pptr
= fb2
.base
.epptr
= NULL
;
4667 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, '\n');
4668 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4669 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4670 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4671 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
4672 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
4673 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 30, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.egptr
);
4674 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
4675 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
4676 ok(fb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb2
.base
.epptr
);
4677 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, 0);
4678 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4679 ok(is1
.count
== 16, "expected 16 got %d\n", is1
.count
);
4680 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4681 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4682 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
4683 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4684 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
4685 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
4686 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
4687 ok(fb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb2
.base
.epptr
);
4688 is1
.base_ios
.state
= IOSTATE_goodbit
;
4689 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4690 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4691 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, '\n');
4692 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4693 ok(is1
.count
== 14, "expected 14 got %d\n", is1
.count
);
4694 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
4695 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
4696 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
4697 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 30, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.egptr
);
4698 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
4699 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
4700 ok(fb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb2
.base
.epptr
);
4702 is1
.base_ios
.state
= IOSTATE_goodbit
;
4703 pis
= call_func3(p_istream_get_sb
, &is1
, NULL
, '\n');
4704 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4705 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4706 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4707 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
4708 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
4709 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 30, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.egptr
);
4710 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
4711 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
4712 ok(fb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb2
.base
.epptr
);
4713 is1
.base_ios
.state
= IOSTATE_goodbit
;
4714 if (0) /* crashes on native */
4715 pis
= call_func3(p_istream_get_sb
, &is1
, NULL
, '?');
4716 *fb1
.base
.gptr
= -50;
4717 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, -50);
4718 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4719 ok(is1
.count
== 16, "expected 16 got %d\n", is1
.count
);
4720 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4721 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
4722 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4723 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
4724 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4725 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 16, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 16, fb2
.base
.pptr
);
4726 ok(fb2
.base
.epptr
== fb2
.base
.ebuf
, "wrong put end, expected %p got %p\n", fb2
.base
.ebuf
, fb2
.base
.epptr
);
4727 is1
.base_ios
.state
= IOSTATE_goodbit
;
4728 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4729 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4730 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, 206);
4731 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4732 ok(is1
.count
== 30, "expected 30 got %d\n", is1
.count
);
4733 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4734 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
4735 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4736 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
4737 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
4738 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 46, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 46, fb2
.base
.pptr
);
4739 ok(fb2
.base
.epptr
== fb2
.base
.ebuf
, "wrong put end, expected %p got %p\n", fb2
.base
.ebuf
, fb2
.base
.epptr
);
4742 is1
.extract_delim
= is1
.count
= 0xabababab;
4743 memset(buffer
, 'A', sizeof(buffer
));
4744 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, 0);
4745 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4746 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4747 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4748 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4749 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4750 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4751 is1
.extract_delim
= is1
.count
= 0xabababab;
4752 is1
.base_ios
.state
= IOSTATE_goodbit
;
4753 memset(buffer
, 'A', sizeof(buffer
));
4754 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, 0);
4755 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4756 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4757 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4758 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4759 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4760 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4761 is1
.base_ios
.state
= IOSTATE_goodbit
;
4762 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4763 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4764 memset(buffer
, 'A', sizeof(buffer
));
4765 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, 'r');
4766 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4767 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4768 ok(is1
.count
== 7, "expected 7 got %d\n", is1
.count
);
4769 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4770 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 7, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 7, fb1
.base
.gptr
);
4771 ok(!strncmp(buffer
, fb1
.base
.base
, 6), "unexpected buffer content, got '%s'\n", buffer
);
4772 ok(buffer
[6] == 0, "expected 0 got %d\n", buffer
[6]);
4773 is1
.extract_delim
= -1;
4774 memset(buffer
, 'A', sizeof(buffer
));
4775 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, -50);
4776 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4777 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4778 ok(is1
.count
== 7, "expected 7 got %d\n", is1
.count
);
4779 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4780 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
4781 ok(!strncmp(buffer
, fb1
.base
.base
+ 7, 7), "unexpected buffer content, got '%s'\n", buffer
);
4782 ok(buffer
[7] == 0, "expected 0 got %d\n", buffer
[7]);
4783 is1
.extract_delim
= -1;
4784 memset(buffer
, 'A', sizeof(buffer
));
4785 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, 206);
4786 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4787 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4788 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4789 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4790 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
4791 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
4792 is1
.extract_delim
= -2;
4793 memset(buffer
, 'A', sizeof(buffer
));
4794 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 20, '\r');
4795 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4796 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4797 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
4798 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4799 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 24, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 24, fb1
.base
.gptr
);
4800 ok(!strncmp(buffer
, fb1
.base
.base
+ 14, 9), "unexpected buffer content, got '%s'\n", buffer
);
4801 ok(buffer
[9] == 0, "expected 0 got %d\n", buffer
[9]);
4802 memset(buffer
, 'A', sizeof(buffer
));
4803 pis
= call_func4(p_istream_getline
, &is1
, NULL
, 20, '?');
4804 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4805 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4806 ok(is1
.count
== 6, "expected 6 got %d\n", is1
.count
);
4807 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4808 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
4809 memset(buffer
, 'A', sizeof(buffer
));
4810 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 0, 0);
4811 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4812 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4813 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4814 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4815 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
4816 ok(buffer
[0] == 'A', "expected 'A' got %d\n", buffer
[0]);
4819 is1
.count
= is1
.extract_delim
= 0xabababab;
4820 is1
.base_ios
.state
= IOSTATE_badbit
;
4821 pis
= call_func3(p_istream_ignore
, &is1
, 10, 0);
4822 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4823 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4824 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4825 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
4826 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4827 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
4828 is1
.count
= is1
.extract_delim
= 0xabababab;
4829 is1
.base_ios
.state
= IOSTATE_goodbit
;
4830 pis
= call_func3(p_istream_ignore
, &is1
, 0, 0);
4831 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4832 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4833 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4834 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4835 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
4836 pis
= call_func3(p_istream_ignore
, &is1
, 1, 0);
4837 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4838 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4839 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4840 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4841 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4842 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4843 is1
.base_ios
.state
= IOSTATE_goodbit
;
4844 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4845 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4846 pis
= call_func3(p_istream_ignore
, &is1
, 5, -1);
4847 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4848 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4849 ok(is1
.count
== 5, "expected 5 got %d\n", is1
.count
);
4850 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4851 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
4852 is1
.extract_delim
= 0;
4853 pis
= call_func3(p_istream_ignore
, &is1
, 10, 'g');
4854 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4855 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4856 ok(is1
.count
== 4, "expected 4 got %d\n", is1
.count
);
4857 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4858 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 9, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.gptr
);
4859 is1
.extract_delim
= -1;
4860 pis
= call_func3(p_istream_ignore
, &is1
, 10, 'a');
4861 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4862 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4863 ok(is1
.count
== 3, "expected 3 got %d\n", is1
.count
);
4864 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4865 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 12, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 12, fb1
.base
.gptr
);
4866 is1
.extract_delim
= -1;
4867 pis
= call_func3(p_istream_ignore
, &is1
, 10, 206);
4868 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4869 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4870 ok(is1
.count
== 2, "expected 2 got %d\n", is1
.count
);
4871 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4872 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
4873 pis
= call_func3(p_istream_ignore
, &is1
, 10, -50);
4874 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4875 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4876 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
4877 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4878 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 24, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 24, fb1
.base
.gptr
);
4879 is1
.extract_delim
= -1;
4880 pis
= call_func3(p_istream_ignore
, &is1
, 10, -1);
4881 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4882 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4883 ok(is1
.count
== 6, "expected 6 got %d\n", is1
.count
);
4884 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4885 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4888 is1
.count
= 0xabababab;
4889 ret
= (int) call_func1(p_istream_peek
, &is1
);
4890 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
4891 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4892 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4893 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4894 is1
.count
= 0xabababab;
4895 is1
.base_ios
.state
= IOSTATE_goodbit
;
4896 ret
= (int) call_func1(p_istream_peek
, &is1
);
4897 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
4898 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4899 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4900 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4901 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
4902 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4903 ret
= (int) call_func1(p_istream_peek
, &is1
);
4904 ok(ret
== ' ', "expected ' ' got %d\n", ret
);
4905 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4906 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4907 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
4908 if (0) /* crashes on native */
4909 is1
.base_ios
.sb
= NULL
;
4910 fb1
.base
.gptr
= fb1
.base
.base
+ 14;
4911 ret
= (int) call_func1(p_istream_peek
, &is1
);
4912 ok(ret
== 206, "expected 206 got %d\n", ret
);
4913 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4914 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4915 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
4916 fb1
.base
.gptr
= fb1
.base
.base
+ 30;
4917 ret
= (int) call_func1(p_istream_peek
, &is1
);
4918 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
4919 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4920 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4921 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4924 is1
.base_ios
.state
= IOSTATE_goodbit
;
4925 pis
= call_func2(p_istream_putback
, &is1
, 'a');
4926 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4927 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4928 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4931 pis
= call_func2(p_istream_putback
, &is1
, 'a');
4932 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4933 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
4935 fb1
.base
.eback
= fb1
.base
.base
;
4936 fb1
.base
.gptr
= fb1
.base
.base
+ 15;
4937 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
4938 pis
= call_func2(p_istream_putback
, &is1
, -40);
4939 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4940 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
4941 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 15, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 15, fb1
.base
.gptr
);
4942 is1
.base_ios
.state
= IOSTATE_badbit
;
4943 pis
= call_func2(p_istream_putback
, &is1
, -40);
4944 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4945 ok(is1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is1
.base_ios
.state
);
4946 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 15, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 15, fb1
.base
.gptr
);
4947 is1
.base_ios
.state
= IOSTATE_eofbit
;
4948 pis
= call_func2(p_istream_putback
, &is1
, -40);
4949 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4950 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
4951 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 15, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 15, fb1
.base
.gptr
);
4952 is1
.base_ios
.state
= IOSTATE_goodbit
;
4953 if (0) /* crashes on native */
4954 is1
.base_ios
.sb
= NULL
;
4955 pis
= call_func2(p_istream_putback
, &is1
, -40);
4956 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4957 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4958 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
4959 ok(*fb1
.base
.gptr
== -40, "expected -40 got %d\n", *fb1
.base
.gptr
);
4962 is1
.extract_delim
= is1
.count
= 0xabababab;
4963 is1
.base_ios
.state
= IOSTATE_badbit
;
4964 memset(buffer
, 'A', sizeof(buffer
));
4965 pis
= call_func3(p_istream_read
, &is1
, buffer
, 10);
4966 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4967 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4968 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
4969 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4970 ok(buffer
[0] == 'A', "expected 'A' got %d\n", buffer
[0]);
4971 is1
.base_ios
.state
= IOSTATE_goodbit
;
4972 fb1
.base
.gptr
= fb1
.base
.base
;
4973 memset(buffer
, 'A', sizeof(buffer
));
4974 pis
= call_func3(p_istream_read
, &is1
, buffer
, 10);
4975 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4976 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
4977 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4978 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 10, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 10, fb1
.base
.gptr
);
4979 ok(!strncmp(buffer
, fb1
.base
.base
, 10), "unexpected buffer content, got '%s'\n", buffer
);
4980 ok(buffer
[10] == 'A', "expected 'A' got %d\n", buffer
[10]);
4981 memset(buffer
, 'A', sizeof(buffer
));
4982 pis
= call_func3(p_istream_read
, &is1
, buffer
, 20);
4983 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4984 ok(is1
.count
== 20, "expected 20 got %d\n", is1
.count
);
4985 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4986 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
4987 ok(!strncmp(buffer
, fb1
.base
.base
+ 10, 20), "unexpected buffer content, got '%s'\n", buffer
);
4988 ok(buffer
[4] == -40, "expected -40 got %d\n", buffer
[4]);
4989 ok(buffer
[20] == 'A', "expected 'A' got %d\n", buffer
[20]);
4990 memset(buffer
, 'A', sizeof(buffer
));
4991 pis
= call_func3(p_istream_read
, &is1
, buffer
, 5);
4992 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4993 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
4994 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
4995 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
4996 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
4997 ok(buffer
[0] == 'e', "expected 'e' got %d\n", buffer
[0]);
4998 ok(buffer
[1] == 'A', "expected 'A' got %d\n", buffer
[1]);
4999 is1
.base_ios
.state
= IOSTATE_goodbit
;
5000 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5001 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5002 memset(buffer
, 'A', sizeof(buffer
));
5003 pis
= call_func3(p_istream_read
, &is1
, buffer
, 35);
5004 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5005 ok(is1
.count
== 30, "expected 30 got %d\n", is1
.count
);
5006 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5007 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5008 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5009 ok(!strncmp(buffer
, fb1
.base
.base
, 30), "unexpected buffer content, got '%s'\n", buffer
);
5010 ok(buffer
[30] == 'A', "expected 'A' got %d\n", buffer
[30]);
5011 if (0) /* crashes on native */
5012 is1
.base_ios
.sb
= NULL
;
5013 is1
.base_ios
.state
= IOSTATE_goodbit
;
5014 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5015 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5016 memset(buffer
, 'A', sizeof(buffer
));
5017 if (0) /* crashes on native */
5018 pis
= call_func3(p_istream_read
, &is1
, buffer
, -1);
5019 pis
= call_func3(p_istream_read
, &is1
, buffer
, 0);
5020 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5021 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5022 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5023 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
5024 ok(buffer
[0] == 'A', "expected 'A' got %d\n", buffer
[0]);
5025 fb1
.base
.gptr
= fb1
.base
.egptr
;
5028 is1
.extract_delim
= is1
.count
= 0xabababab;
5029 pis
= call_func2(p_istream_seekg
, &is1
, 0);
5030 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5031 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5032 ok(_tell(fb1
.fd
) == 0, "expected 0 got %d\n", _tell(fb1
.fd
));
5033 if (0) /* crashes on native */
5034 is1
.base_ios
.sb
= NULL
;
5035 pis
= call_func2(p_istream_seekg
, &is1
, -5);
5036 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5037 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5038 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5039 ok(_tell(fb1
.fd
) == 0, "expected 0 got %d\n", _tell(fb1
.fd
));
5040 fb1
.base
.epptr
= fb1
.base
.ebuf
;
5041 pis
= call_func2(p_istream_seekg
, &is1
, 5);
5042 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5043 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5044 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5045 ok(fb1
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb1
.base
.epptr
);
5046 ok(_tell(fb1
.fd
) == 5, "expected 5 got %d\n", _tell(fb1
.fd
));
5047 is1
.base_ios
.state
= IOSTATE_goodbit
;
5050 pis
= call_func2(p_istream_seekg
, &is1
, 0);
5051 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5052 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5053 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5054 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5055 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5056 pis
= call_func3(p_istream_seekg_offset
, &is1
, 0, SEEKDIR_end
);
5057 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5058 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5059 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
5060 is1
.base_ios
.state
= IOSTATE_goodbit
;
5062 pis
= call_func3(p_istream_seekg_offset
, &is1
, 0, SEEKDIR_end
);
5063 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5064 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5065 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
5066 if (0) /* crashes on native */
5067 is1
.base_ios
.sb
= NULL
;
5068 fb1
.base
.gptr
= fb1
.base
.egptr
;
5069 pis
= call_func3(p_istream_seekg_offset
, &is1
, 0, SEEKDIR_end
);
5070 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5071 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5072 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5073 ok(_tell(fb1
.fd
) == 24, "expected 24 got %d\n", _tell(fb1
.fd
));
5076 ret
= (int) call_func1(p_istream_sync
, &is1
);
5077 ok(ret
== 0, "expected 0 got %d\n", ret
);
5078 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5079 is1
.base_ios
.state
= IOSTATE_badbit
;
5080 ret
= (int) call_func1(p_istream_sync
, &is1
);
5081 ok(ret
== 0, "expected 0 got %d\n", ret
);
5082 ok(is1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is1
.base_ios
.state
);
5083 is1
.base_ios
.state
= IOSTATE_goodbit
;
5084 ret
= (int) call_func1(p_istream_sync
, &is1
);
5085 ok(ret
== 0, "expected 0 got %d\n", ret
);
5086 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5087 if (0) /* crashes on native */
5088 is1
.base_ios
.sb
= NULL
;
5089 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5090 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5091 ret
= (int) call_func1(p_istream_sync
, &is1
);
5092 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5093 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
5094 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5095 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
5096 fb1
.base
.gptr
= fb1
.base
.egptr
;
5097 ret
= (int) call_func1(p_istream_sync
, &is1
);
5098 ok(ret
== 0, "expected 0 got %d\n", ret
);
5099 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
5100 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5101 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5102 is1
.base_ios
.state
= IOSTATE_eofbit
;
5105 ret
= (int) call_func1(p_istream_sync
, &is1
);
5106 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5107 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
), "expected %d got %d\n",
5108 IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
, is1
.base_ios
.state
);
5112 ret
= (int) call_func1(p_istream_tellg
, &is1
);
5113 ok(ret
== 24, "expected 24 got %d\n", ret
);
5114 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
), "expected %d got %d\n",
5115 IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
, is1
.base_ios
.state
);
5116 is1
.base_ios
.state
= IOSTATE_goodbit
;
5117 ret
= (int) call_func1(p_istream_tellg
, &is1
);
5118 ok(ret
== 24, "expected 24 got %d\n", ret
);
5119 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5120 if (0) /* crashes on native */
5121 is1
.base_ios
.sb
= NULL
;
5122 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5123 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5124 ret
= (int) call_func1(p_istream_tellg
, &is1
);
5125 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5126 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5127 is1
.base_ios
.state
= IOSTATE_eofbit
;
5128 ret
= (int) call_func1(p_istream_tellg
, &is1
);
5129 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5130 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5131 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5132 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.egptr
= NULL
;
5134 call_func1(p_istream_vbase_dtor
, &is1
);
5135 call_func1(p_istream_vbase_dtor
, &is2
);
5136 call_func1(p_ostream_vbase_dtor
, &os
);
5137 call_func1(p_filebuf_dtor
, &fb1
);
5138 call_func1(p_filebuf_dtor
, &fb2
);
5139 ok(_unlink(filename1
) == 0, "Couldn't unlink file named '%s'\n", filename1
);
5140 ok(_unlink(filename2
) == 0, "Couldn't unlink file named '%s'\n", filename2
);
5143 static void test_istream_getint(void)
5146 strstreambuf ssb
, *pssb
;
5150 struct istream_getint_test
{
5151 const char *stream_content
;
5152 ios_io_state initial_state
;
5154 int expected_return
;
5155 ios_io_state expected_state
;
5156 int expected_offset
;
5157 const char *expected_buffer
;
5159 {"", IOSTATE_badbit
, FLAGS_skipws
, 0, IOSTATE_badbit
|IOSTATE_failbit
, 0, ""},
5160 {"", IOSTATE_eofbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, ""},
5161 {"", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, ""},
5162 {" 0 ", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 2, "0"},
5163 {" \n0", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 3, "0"},
5164 {"-0", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 2, "-0"},
5165 {"000\n", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 3, "000"},
5166 {"015 16", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 3, "015"},
5167 {"099", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 1, "0"},
5168 {" 12345", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 6, "12345"},
5169 {"12345\r", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 5, "12345"},
5170 {"0xab ", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_goodbit
, 4, "0xab"},
5171 {" 0xefg", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_goodbit
, 5, "0xef"},
5172 {"0XABc", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_eofbit
, 5, "0XABc"},
5173 {"0xzzz", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_failbit
, 0, ""},
5174 {"0y123", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 1, "0"},
5175 {"\t+42 ", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 4, "+42"},
5176 {"+\t42", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
5177 {"+4\t2", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 2, "+4"},
5178 {"+0xc", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_eofbit
, 4, "+0xc"},
5179 {" -1 ", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 3, "-1"},
5180 {" -005 ", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 5, "-005"},
5181 {" 2-0 ", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 2, "2"},
5182 {"--3 ", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
5183 {"+-7", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
5184 {"+", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
5185 {"-0x123abc", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_eofbit
, 9, "-0x123abc"},
5186 {"0-x123abc", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 1, "0"},
5187 {"0x-123abc", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_failbit
, 0, ""},
5188 {"2147483648", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 10, "2147483648"},
5189 {"99999999999999", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 14, "99999999999999"},
5190 {"999999999999999", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 15, "999999999999999"},
5191 {"123456789123456789", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 15, "123456789123456"},
5192 {"000000000000000000", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 15, "000000000000000"},
5193 {"-0xffffffffffffffffff", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_goodbit
, 15, "-0xffffffffffff"},
5194 {"3.14159", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 1, "3"},
5195 {"deadbeef", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
5196 {"0deadbeef", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 1, "0"},
5197 {"98765L", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 5, "98765"},
5198 {"9999l", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 4, "9999"},
5199 {" 1", IOSTATE_goodbit
, 0, 0, IOSTATE_failbit
, 0, ""},
5200 {"1 ", IOSTATE_goodbit
, 0, 0, IOSTATE_goodbit
, 1, "1"},
5201 {"010", IOSTATE_goodbit
, FLAGS_dec
, 10, IOSTATE_eofbit
, 3, "010"},
5202 {"0x123", IOSTATE_goodbit
, FLAGS_dec
, 10, IOSTATE_goodbit
, 1, "0"},
5203 {"x1", IOSTATE_goodbit
, FLAGS_dec
, 10, IOSTATE_failbit
, 0, ""},
5204 {"33", IOSTATE_goodbit
, FLAGS_dec
|FLAGS_oct
, 10, IOSTATE_eofbit
, 2, "33"},
5205 {"abc", IOSTATE_goodbit
, FLAGS_dec
|FLAGS_hex
, 10, IOSTATE_failbit
, 0, ""},
5206 {"33", IOSTATE_goodbit
, FLAGS_oct
, 8, IOSTATE_eofbit
, 2, "33"},
5207 {"9", IOSTATE_goodbit
, FLAGS_oct
, 8, IOSTATE_failbit
, 0, ""},
5208 {"0", IOSTATE_goodbit
, FLAGS_oct
, 8, IOSTATE_eofbit
, 1, "0"},
5209 {"x1", IOSTATE_goodbit
, FLAGS_oct
, 8, IOSTATE_failbit
, 0, ""},
5210 {"9", IOSTATE_goodbit
, FLAGS_oct
|FLAGS_hex
, 16, IOSTATE_eofbit
, 1, "9"},
5211 {"abc", IOSTATE_goodbit
, FLAGS_oct
|FLAGS_hex
, 16, IOSTATE_eofbit
, 3, "abc"},
5212 {"123 ", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_goodbit
, 3, "123"},
5213 {"x123 ", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_failbit
, 0, ""},
5214 {"0x123 ", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_goodbit
, 5, "0x123"},
5215 {"-a", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_eofbit
, 2, "-a"},
5216 {"-j", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_failbit
, 0, ""},
5217 {"-0x-1", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_failbit
, 0, ""},
5218 {"0", IOSTATE_goodbit
, FLAGS_dec
|FLAGS_oct
|FLAGS_hex
, 10, IOSTATE_eofbit
, 1, "0"},
5219 {"0z", IOSTATE_goodbit
, FLAGS_dec
|FLAGS_oct
|FLAGS_hex
, 10, IOSTATE_goodbit
, 1, "0"}
5222 pssb
= call_func2(p_strstreambuf_dynamic_ctor
, &ssb
, 64);
5223 ok(pssb
== &ssb
, "wrong return, expected %p got %p\n", &ssb
, pssb
);
5224 ret
= (int) call_func1(p_streambuf_allocate
, &ssb
.base
);
5225 ok(ret
== 1, "expected 1 got %d\n", ret
);
5226 pis
= call_func3(p_istream_sb_ctor
, &is
, &ssb
.base
, TRUE
);
5227 ok(pis
== &is
, "wrong return, expected %p got %p\n", &is
, pis
);
5229 for (i
= 0; i
< sizeof(tests
) / sizeof(tests
[0]); i
++) {
5230 len
= strlen(tests
[i
].stream_content
);
5231 is
.base_ios
.state
= tests
[i
].initial_state
;
5232 is
.base_ios
.flags
= tests
[i
].flags
;
5233 ssb
.base
.eback
= ssb
.base
.gptr
= ssb
.base
.base
;
5234 ssb
.base
.egptr
= ssb
.base
.base
+ len
;
5235 memcpy(ssb
.base
.base
, tests
[i
].stream_content
, len
);
5237 ret
= (int) call_func2(p_istream_getint
, &is
, buffer
);
5238 ok(ret
== tests
[i
].expected_return
, "Test %d: wrong return, expected %d got %d\n", i
,
5239 tests
[i
].expected_return
, ret
);
5240 ok(is
.base_ios
.state
== tests
[i
].expected_state
, "Test %d: expected %d got %d\n", i
,
5241 tests
[i
].expected_state
, is
.base_ios
.state
);
5242 ok(ssb
.base
.gptr
== ssb
.base
.base
+ tests
[i
].expected_offset
, "Test %d: expected %p got %p\n", i
,
5243 ssb
.base
.base
+ tests
[i
].expected_offset
, ssb
.base
.gptr
);
5244 ok(!strncmp(buffer
, tests
[i
].expected_buffer
, strlen(tests
[i
].expected_buffer
)),
5245 "Test %d: unexpected buffer content, got '%s'\n", i
, buffer
);
5248 call_func1(p_istream_vbase_dtor
, &is
);
5249 call_func1(p_strstreambuf_dtor
, &ssb
);
5252 static void test_istream_getdouble(void)
5255 strstreambuf ssb
, *pssb
;
5259 struct istream_getdouble_test
{
5260 const char *stream_content
;
5262 ios_io_state initial_state
;
5264 int expected_return
;
5265 ios_io_state expected_state
;
5266 int expected_offset
;
5267 const char *expected_buffer
;
5270 {"", 32, IOSTATE_badbit
, FLAGS_skipws
, 0, IOSTATE_badbit
|IOSTATE_failbit
, 0, "", FALSE
},
5271 {"", 0, IOSTATE_badbit
, FLAGS_skipws
, 0, IOSTATE_badbit
|IOSTATE_failbit
, 0, "", FALSE
},
5272 {"", 32, IOSTATE_eofbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, "", FALSE
},
5273 {"", 32, IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, "", FALSE
},
5274 {" ", 32, IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 1, "", FALSE
},
5275 {" 0", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_eofbit
, 2, "0", FALSE
},
5276 {"156", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_eofbit
, 3, "156", FALSE
},
5277 {"123 ", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_goodbit
, 3, "123", FALSE
},
5278 {"+4 5", 32, IOSTATE_goodbit
, FLAGS_skipws
, 2, IOSTATE_goodbit
, 2, "+4", FALSE
},
5279 {"-88a", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_goodbit
, 3, "-88", FALSE
},
5280 {"-+5", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_failbit
, 1, "-", FALSE
},
5281 {"++7", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_failbit
, 1, "+", FALSE
},
5282 {"+", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_eofbit
|IOSTATE_failbit
, 1, "+", FALSE
},
5283 {"abc", 32, IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, "", FALSE
},
5284 {"0xabc", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_goodbit
, 1, "0", FALSE
},
5285 {"01", 32, IOSTATE_goodbit
, FLAGS_skipws
, 2, IOSTATE_eofbit
, 2, "01", FALSE
},
5286 {"10000000000000000000", 32, IOSTATE_goodbit
, FLAGS_skipws
, 20, IOSTATE_eofbit
, 20, "10000000000000000000", FALSE
},
5287 {"1.2", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_eofbit
, 3, "1.2", FALSE
},
5288 {"\t-0.4444f", 32, IOSTATE_goodbit
, FLAGS_skipws
, 7, IOSTATE_goodbit
, 8, "-0.4444", FALSE
},
5289 {"3.-14159", 32, IOSTATE_goodbit
, FLAGS_skipws
, 2, IOSTATE_goodbit
, 2, "3.", FALSE
},
5290 {"3.14.159", 32, IOSTATE_goodbit
, FLAGS_skipws
, 4, IOSTATE_goodbit
, 4, "3.14", FALSE
},
5291 {"3.000", 32, IOSTATE_goodbit
, FLAGS_skipws
, 5, IOSTATE_eofbit
, 5, "3.000", FALSE
},
5292 {".125f", 32, IOSTATE_goodbit
, FLAGS_skipws
, 4, IOSTATE_goodbit
, 4, ".125", FALSE
},
5293 {"-.125f", 32, IOSTATE_goodbit
, FLAGS_skipws
, 5, IOSTATE_goodbit
, 5, "-.125", FALSE
},
5294 {"5L", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_goodbit
, 1, "5", FALSE
},
5295 {"1.", 32, IOSTATE_goodbit
, FLAGS_skipws
, 2, IOSTATE_eofbit
, 2, "1.", FALSE
},
5296 {"55.!", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_goodbit
, 3, "55.", FALSE
},
5297 {"99.99999999999", 32, IOSTATE_goodbit
, FLAGS_skipws
, 14, IOSTATE_eofbit
, 14, "99.99999999999", FALSE
},
5298 {"9.9999999999999999999", 32, IOSTATE_goodbit
, FLAGS_skipws
, 21, IOSTATE_eofbit
, 21, "9.9999999999999999999", FALSE
},
5299 {"0.0000000000000f", 32, IOSTATE_goodbit
, FLAGS_skipws
, 15, IOSTATE_goodbit
, 15, "0.0000000000000", FALSE
},
5300 {"1.0000e5 ", 32, IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 8, "1.0000e5", FALSE
},
5301 {"-2.12345e1000 ", 32, IOSTATE_goodbit
, FLAGS_skipws
, 13, IOSTATE_goodbit
, 13, "-2.12345e1000", FALSE
},
5302 {" 8E1", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_eofbit
, 5, "8E1", FALSE
},
5303 {"99.99E-99E5", 32, IOSTATE_goodbit
, FLAGS_skipws
, 9, IOSTATE_goodbit
, 9, "99.99E-99", FALSE
},
5304 {"0e0", 32, IOSTATE_goodbit
, FLAGS_skipws
|FLAGS_uppercase
, 3, IOSTATE_eofbit
, 3, "0e0", FALSE
},
5305 {"1.e8.5", 32, IOSTATE_goodbit
, 0, 4, IOSTATE_goodbit
, 4, "1.e8", FALSE
},
5306 {"1.0e-1000000000000000000 ", 32, IOSTATE_goodbit
, 0, 24, IOSTATE_goodbit
, 24, "1.0e-1000000000000000000", FALSE
},
5307 {"1.e+f", 32, IOSTATE_goodbit
, 0, 3, IOSTATE_goodbit
, 3, "1.e", FALSE
},
5308 {"1.ef", 32, IOSTATE_goodbit
, 0, 2, IOSTATE_goodbit
, 2, "1.", FALSE
},
5309 {"1.E-z", 32, IOSTATE_goodbit
, 0, 3, IOSTATE_goodbit
, 3, "1.E", FALSE
},
5310 {".", 32, IOSTATE_goodbit
, 0, 1, IOSTATE_eofbit
|IOSTATE_failbit
, 1, ".", FALSE
},
5311 {".e", 32, IOSTATE_goodbit
, 0, 1, IOSTATE_failbit
, 1, ".", FALSE
},
5312 {".e.", 32, IOSTATE_goodbit
, 0, 1, IOSTATE_failbit
, 1, ".", FALSE
},
5313 {".e5", 32, IOSTATE_goodbit
, 0, 3, IOSTATE_eofbit
|IOSTATE_failbit
, 3, ".e5", FALSE
},
5314 {".2e5", 32, IOSTATE_goodbit
, 0, 4, IOSTATE_eofbit
, 4, ".2e5", FALSE
},
5315 {"9.e", 32, IOSTATE_goodbit
, 0, 2, IOSTATE_goodbit
, 2, "9.", FALSE
},
5316 {"0.0e-0", 32, IOSTATE_goodbit
, 0, 6, IOSTATE_eofbit
, 6, "0.0e-0", FALSE
},
5317 {"e5.2", 32, IOSTATE_goodbit
, 0, 2, IOSTATE_failbit
, 2, "e5", FALSE
},
5318 {"1.0000", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, "1.00", TRUE
},
5319 {"-123456", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, "-123", TRUE
},
5320 {"3.5e2", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, "3.5e", TRUE
},
5321 {"3.e25", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, "3.e2", TRUE
},
5322 {"1.11f", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_goodbit
, 4, "1.11", FALSE
},
5323 {".5e-5", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, ".5e-", TRUE
},
5324 {".5e-", 5, IOSTATE_goodbit
, 0, 3, IOSTATE_goodbit
, 3, ".5e", FALSE
},
5325 {".5e2", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_eofbit
, 4, ".5e2", FALSE
},
5326 {"1", 0, IOSTATE_goodbit
, 0, -1, IOSTATE_failbit
, 0, "", TRUE
},
5327 {"x", 0, IOSTATE_goodbit
, 0, -1, IOSTATE_failbit
, 0, "", TRUE
},
5328 {"", 0, IOSTATE_goodbit
, 0, -1, IOSTATE_failbit
, 0, "", TRUE
},
5329 {"", 1, IOSTATE_goodbit
, 0, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, "", FALSE
},
5330 {"1.0", 1, IOSTATE_goodbit
, 0, 0, IOSTATE_failbit
, 1, "", TRUE
},
5331 {"1.0", 2, IOSTATE_goodbit
, 0, 1, IOSTATE_failbit
, 2, "1", TRUE
}
5334 pssb
= call_func2(p_strstreambuf_dynamic_ctor
, &ssb
, 64);
5335 ok(pssb
== &ssb
, "wrong return, expected %p got %p\n", &ssb
, pssb
);
5336 ret
= (int) call_func1(p_streambuf_allocate
, &ssb
.base
);
5337 ok(ret
== 1, "expected 1 got %d\n", ret
);
5338 pis
= call_func3(p_istream_sb_ctor
, &is
, &ssb
.base
, TRUE
);
5339 ok(pis
== &is
, "wrong return, expected %p got %p\n", &is
, pis
);
5341 for (i
= 0; i
< sizeof(tests
) / sizeof(tests
[0]); i
++) {
5342 len
= strlen(tests
[i
].stream_content
);
5343 is
.base_ios
.state
= tests
[i
].initial_state
;
5344 is
.base_ios
.flags
= tests
[i
].flags
;
5345 ssb
.base
.eback
= ssb
.base
.gptr
= ssb
.base
.base
;
5346 ssb
.base
.egptr
= ssb
.base
.base
+ len
;
5347 memcpy(ssb
.base
.base
, tests
[i
].stream_content
, len
);
5349 ret
= (int) call_func3(p_istream_getdouble
, &is
, buffer
, tests
[i
].count
);
5350 ok(ret
== tests
[i
].expected_return
||
5351 /* xp, 2k3 */ broken(tests
[i
].broken
&& ret
== tests
[i
].expected_return
+ 1),
5352 "Test %d: wrong return, expected %d got %d\n", i
, tests
[i
].expected_return
, ret
);
5353 ok(is
.base_ios
.state
== tests
[i
].expected_state
, "Test %d: expected %d got %d\n", i
,
5354 tests
[i
].expected_state
, is
.base_ios
.state
);
5355 ok(ssb
.base
.gptr
== ssb
.base
.base
+ tests
[i
].expected_offset
, "Test %d: expected %p got %p\n",
5356 i
, ssb
.base
.base
+ tests
[i
].expected_offset
, ssb
.base
.gptr
);
5357 ok(!strncmp(buffer
, tests
[i
].expected_buffer
, strlen(tests
[i
].expected_buffer
)),
5358 "Test %d: unexpected buffer content, got '%s'\n", i
, buffer
);
5361 call_func1(p_istream_vbase_dtor
, &is
);
5362 call_func1(p_strstreambuf_dtor
, &ssb
);
5365 static void test_istream_read(void)
5368 strstreambuf ssb
, ssb_test
, *pssb
;
5371 /* makes tables narrower */
5372 const ios_io_state IOSTATE_faileof
= IOSTATE_failbit
|IOSTATE_eofbit
;
5374 char c
, st
[8], char_out
[] = {-85, ' ', 'a', -50};
5375 const char *str_out
[] = {"AAAAAAA", "abc", "a", "abc", "ab", "abcde"};
5376 short s
, short_out
[] = {32767, -32768};
5377 unsigned short us
, ushort_out
[] = {65535u, 65534u, 32768u};
5378 int n
, int_out
[] = {123456789, 0, 1, -500, 0x8000, 2147483646, 2147483647, -2147483647, -2147483647-1, -1};
5379 unsigned un
, uint_out
[] = {4294967295u, 4294967294u, 2147483648u, 1u};
5380 LONG l
, long_out
[] = {2147483647l, -2147483647l-1};
5381 ULONG ul
, ulong_out
[] = {4294967295ul, 4294967294ul, 2147483648ul, 1ul};
5382 float f
, float_out
[] = {123.456f
, 0.0f
, 1.0f
, 0.1f
, -1.0f
, -0.1f
, FLT_MIN
, -FLT_MIN
, FLT_MAX
, -FLT_MAX
};
5383 double d
, double_out
[] = {1.0, 0.1, 0.0, INFINITY
, -INFINITY
};
5384 const char *sbf_out
[] = {"", "abcd\n", "abcdef"};
5385 struct istream_read_test
{
5386 enum { type_chr
, type_str
, type_shrt
, type_ushrt
, type_int
, type_uint
,
5387 type_long
, type_ulong
, type_flt
, type_dbl
, type_ldbl
, type_sbf
} type
;
5388 const char *stream_content
;
5392 ios_io_state expected_state
;
5394 int expected_offset
;
5398 {type_chr
, "", FLAGS_skipws
, 6, /* -85 */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
5399 {type_chr
, " ", FLAGS_skipws
, 6, /* -85 */ 0, IOSTATE_faileof
, 6, 2, FALSE
},
5400 {type_chr
, " abc ", 0, 6, /* ' ' */ 1, IOSTATE_goodbit
, 6, 1, FALSE
},
5401 {type_chr
, " abc ", FLAGS_skipws
, 6, /* 'a' */ 2, IOSTATE_goodbit
, 6, 2, FALSE
},
5402 {type_chr
, " a", FLAGS_skipws
, 0, /* 'a' */ 2, IOSTATE_goodbit
, 0, 2, FALSE
},
5403 {type_chr
, "\xce", 0, 6, /* -50 */ 3, IOSTATE_goodbit
, 6, 1, FALSE
},
5405 {type_str
, "", FLAGS_skipws
, 6, /* "AAAAAAA" */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
5406 {type_str
, " ", FLAGS_skipws
, 6, /* "AAAAAAA" */ 0, IOSTATE_faileof
, 6, 1, FALSE
},
5407 {type_str
, " abc", FLAGS_skipws
, 6, /* "abc" */ 1, IOSTATE_eofbit
, 0, 4, FALSE
},
5408 {type_str
, " abc ", FLAGS_skipws
, 6, /* "abc" */ 1, IOSTATE_goodbit
, 0, 4, FALSE
},
5409 {type_str
, " a\tc", FLAGS_skipws
, 6, /* "a" */ 2, IOSTATE_goodbit
, 0, 2, FALSE
},
5410 {type_str
, " a\tc", 0, 6, /* "AAAAAAA" */ 0, IOSTATE_failbit
, 0, 0, FALSE
},
5411 {type_str
, "abcde\n", 0, 4, /* "abc" */ 3, IOSTATE_goodbit
, 0, 3, FALSE
},
5412 {type_str
, "abc\n", 0, 4, /* "abc" */ 3, IOSTATE_goodbit
, 0, 3, FALSE
},
5413 {type_str
, "ab\r\n", 0, 3, /* "ab" */ 4, IOSTATE_goodbit
, 0, 2, FALSE
},
5414 {type_str
, "abc", 0, 4, /* "abc" */ 3, IOSTATE_goodbit
, 0, 3, FALSE
},
5415 {type_str
, "abc", 0, 1, /* "AAAAAAA" */ 0, IOSTATE_failbit
, 0, 0, FALSE
},
5416 {type_str
, "\n", 0, 1, /* "AAAAAAA" */ 0, IOSTATE_failbit
, 0, 0, FALSE
},
5417 {type_str
, "abcde\n", 0, 0, /* "abcde" */ 5, IOSTATE_goodbit
, 0, 5, FALSE
},
5418 {type_str
, "\n", 0, 0, /* "AAAAAAA" */ 0, IOSTATE_failbit
, 0, 0, FALSE
},
5419 {type_str
, "abcde", 0, -1, /* "abcde" */ 5, IOSTATE_eofbit
, 0, 5, FALSE
},
5421 {type_shrt
, "32767", 0, 6, /* 32767 */ 0, IOSTATE_eofbit
, 6, 5, FALSE
},
5422 {type_shrt
, "32768", 0, 6, /* 32767 */ 0, IOSTATE_faileof
, 6, 5, FALSE
},
5423 {type_shrt
, "2147483648", 0, 6, /* 32767 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
5424 {type_shrt
, "4294967296", 0, 6, /* 32767 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
5425 {type_shrt
, "-32768", 0, 6, /* -32768 */ 1, IOSTATE_eofbit
, 6, 6, FALSE
},
5426 {type_shrt
, "-32769", 0, 6, /* -32768 */ 1, IOSTATE_faileof
, 6, 6, FALSE
},
5427 {type_shrt
, "-2147483648", 0, 6, /* -32768 */ 1, IOSTATE_faileof
, 6, 11, FALSE
},
5428 /* unsigned short */
5429 {type_ushrt
, "65535", 0, 6, /* 65535 */ 0, IOSTATE_eofbit
, 6, 5, FALSE
},
5430 {type_ushrt
, "65536", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 5, FALSE
},
5431 {type_ushrt
, "12345678", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 8, FALSE
},
5432 {type_ushrt
, "2147483648", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
5433 {type_ushrt
, "4294967296", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
5434 {type_ushrt
, "99999999999999", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 14, FALSE
},
5435 {type_ushrt
, "-1", 0, 6, /* 65535 */ 0, IOSTATE_eofbit
, 6, 2, TRUE
},
5436 {type_ushrt
, "-2", 0, 6, /* 65534 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
5437 {type_ushrt
, "-32768", 0, 6, /* 32768 */ 2, IOSTATE_eofbit
, 6, 6, FALSE
},
5438 {type_ushrt
, "-32769", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 6, FALSE
},
5439 {type_ushrt
, "-2147483648", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 11, FALSE
},
5441 {type_int
, "", FLAGS_skipws
, 6, /* 123456789 */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
5442 {type_int
, " 0", FLAGS_skipws
, 6, /* 0 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
5443 {type_int
, " 0", 0, 6, /* 0 */ 1, IOSTATE_failbit
, 6, 0, FALSE
},
5444 {type_int
, "+1 ", 0, 6, /* 1 */ 2, IOSTATE_goodbit
, 6, 2, FALSE
},
5445 {type_int
, "1L", 0, 6, /* 1 */ 2, IOSTATE_goodbit
, 6, 1, FALSE
},
5446 {type_int
, "-500.0", 0, 6, /* -500 */ 3, IOSTATE_goodbit
, 6, 4, FALSE
},
5447 {type_int
, "0x8000", 0, 6, /* 0x8000 */ 4, IOSTATE_eofbit
, 6, 6, FALSE
},
5448 {type_int
, "0xtest", 0, 6, /* 0 */ 1, IOSTATE_failbit
, 6, 0, FALSE
},
5449 {type_int
, "0test", 0, 6, /* 0 */ 1, IOSTATE_goodbit
, 6, 1, FALSE
},
5450 {type_int
, "0x7ffffffe", 0, 6, /* 2147483646 */ 5, IOSTATE_eofbit
, 6, 10, FALSE
},
5451 {type_int
, "0x7fffffff", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
5452 {type_int
, "0x80000000", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
5453 {type_int
, "0xdeadbeef", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
5454 {type_int
, "2147483648", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
5455 {type_int
, "4294967295", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
5456 {type_int
, "-2147483647", 0, 6, /* -2147483647 */ 7, IOSTATE_eofbit
, 6, 11, FALSE
},
5457 {type_int
, "-2147483648", 0, 6, /* -2147483648 */ 8, IOSTATE_eofbit
, 6, 11, FALSE
},
5458 {type_int
, "-2147483649", 0, 6, /* -2147483648 */ 8, IOSTATE_eofbit
, 6, 11, FALSE
},
5459 {type_int
, "-1f", FLAGS_dec
, 6, /* -1 */ 9, IOSTATE_goodbit
, 6, 2, FALSE
},
5461 {type_uint
, "4294967295", 0, 6, /* 4294967295 */ 0, IOSTATE_eofbit
, 6, 10, TRUE
},
5462 {type_uint
, "4294967296", 0, 6, /* 4294967295 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
5463 {type_uint
, "99999999999999", 0, 6, /* 4294967295 */ 0, IOSTATE_faileof
, 6, 14, FALSE
},
5464 {type_uint
, "-1", 0, 6, /* 4294967295 */ 0, IOSTATE_eofbit
, 6, 2, TRUE
},
5465 {type_uint
, "-2", 0, 6, /* 4294967294 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
5466 {type_uint
, "-2147483648", 0, 6, /* 2147483648 */ 2, IOSTATE_eofbit
, 6, 11, FALSE
},
5467 {type_uint
, "-4294967295", 0, 6, /* 1 */ 3, IOSTATE_eofbit
, 6, 11, FALSE
},
5468 {type_uint
, "-9999999999999", 0, 6, /* 1 */ 3, IOSTATE_eofbit
, 6, 14, FALSE
},
5470 {type_long
, "2147483647", 0, 6, /* 2147483647 */ 0, IOSTATE_eofbit
, 6, 10, TRUE
},
5471 {type_long
, "2147483648", 0, 6, /* 2147483647 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
5472 {type_long
, "4294967295", 0, 6, /* 2147483647 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
5473 {type_long
, "-2147483648", 0, 6, /* -2147483648 */ 1, IOSTATE_eofbit
, 6, 11, TRUE
},
5474 {type_long
, "-2147483649", 0, 6, /* -2147483648 */ 1, IOSTATE_faileof
, 6, 11, FALSE
},
5475 {type_long
, "-9999999999999", 0, 6, /* -2147483648 */ 1, IOSTATE_faileof
, 6, 14, FALSE
},
5477 {type_ulong
, "4294967295", 0, 6, /* 4294967295 */ 0, IOSTATE_eofbit
, 6, 10, TRUE
},
5478 {type_ulong
, "4294967296", 0, 6, /* 4294967295 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
5479 {type_ulong
, "99999999999999", 0, 6, /* 4294967295 */ 0, IOSTATE_faileof
, 6, 14, FALSE
},
5480 {type_ulong
, "-1", 0, 6, /* 4294967295 */ 0, IOSTATE_eofbit
, 6, 2, TRUE
},
5481 {type_ulong
, "-2", 0, 6, /* 4294967294 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
5482 {type_ulong
, "-2147483648", 0, 6, /* 2147483648 */ 2, IOSTATE_eofbit
, 6, 11, FALSE
},
5483 {type_ulong
, "-4294967295", 0, 6, /* 1 */ 3, IOSTATE_eofbit
, 6, 11, FALSE
},
5484 {type_ulong
, "-9999999999999", 0, 6, /* 1 */ 3, IOSTATE_eofbit
, 6, 14, FALSE
},
5486 {type_flt
, "", FLAGS_skipws
, 6, /* 123.456 */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
5487 {type_flt
, "", 0, 6, /* 123.456 */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
5488 {type_flt
, " 0", 0, 6, /* 123.456 */ 0, IOSTATE_failbit
, 6, 0, FALSE
},
5489 {type_flt
, " 0", FLAGS_skipws
, 6, /* 0.0 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
5490 {type_flt
, "-0 ", 0, 6, /* 0.0 */ 1, IOSTATE_goodbit
, 6, 2, FALSE
},
5491 {type_flt
, "+1.0", 0, 6, /* 1.0 */ 2, IOSTATE_eofbit
, 6, 4, FALSE
},
5492 {type_flt
, "1.#INF", 0, 6, /* 1.0 */ 2, IOSTATE_goodbit
, 6, 2, FALSE
},
5493 {type_flt
, "0.100000000000000e1", 0, 6, /* 1.0 */ 2, IOSTATE_eofbit
, 6, 19, FALSE
},
5495 {type_flt, "0.1000000000000000e1", 0, 6, 0.1 3, IOSTATE_failbit, 6, 20, FALSE}, */
5496 {type_flt
, "0.10000000000000000e1", 0, 6, /* 0.1 */ 3, IOSTATE_failbit
, 6, 20, TRUE
},
5497 {type_flt
, "-0.10000000000000e1", 0, 6, /* -1.0 */ 4, IOSTATE_eofbit
, 6, 19, FALSE
},
5499 {type_flt, "-0.100000000000000e1 ", 0, 6, -0.1 5, IOSTATE_failbit, 6, 20, FALSE}, */
5500 {type_flt
, "-0.1000000000000000e1", 0, 6, /* -0.1 */ 5, IOSTATE_failbit
, 6, 20, TRUE
},
5501 {type_flt
, "5.1691126e-77", 0, 6, /* FLT_MIN */ 6, IOSTATE_eofbit
, 6, 13, FALSE
},
5502 {type_flt
, "-2.49873e-41f", 0, 6, /* -FLT_MIN */ 7, IOSTATE_goodbit
, 6, 12, FALSE
},
5503 {type_flt
, "1.23456789e1234", 0, 6, /* FLT_MAX */ 8, IOSTATE_eofbit
, 6, 15, FALSE
},
5504 {type_flt
, "-1.23456789e1234", 0, 6, /* -FLT_MAX */ 9, IOSTATE_eofbit
, 6, 16, FALSE
},
5506 {type_dbl
, "0.10000000000000000000000e1", 0, 6, /* 1.0 */ 0, IOSTATE_eofbit
, 6, 27, FALSE
},
5508 {type_dbl, "0.100000000000000000000000e1", 0, 6, 0.1 1, IOSTATE_failbit, 6, 28, FALSE}, */
5509 {type_dbl
, "0.1000000000000000000000000e1", 0, 6, /* 0.1 */ 1, IOSTATE_failbit
, 6, 28, TRUE
},
5510 {type_dbl
, "3.698124698114778e-6228", 0, 6, /* 0.0 */ 2, IOSTATE_eofbit
, 6, 23, FALSE
},
5511 {type_dbl
, "-3.698124698114778e-6228", 0, 6, /* 0.0 */ 2, IOSTATE_eofbit
, 6, 24, FALSE
},
5512 {type_dbl
, "3.698124698114778e6228", 0, 6, /* INF */ 3, IOSTATE_eofbit
, 6, 22, FALSE
},
5513 {type_dbl
, "-3.698124698114778e6228A", 0, 6, /* -INF */ 4, IOSTATE_goodbit
, 6, 23, FALSE
},
5515 {type_ldbl
, "0.100000000000000000000000000e1", 0, 6, /* 1.0 */ 0, IOSTATE_eofbit
, 6, 31, FALSE
},
5517 {type_ldbl, "0.1000000000000000000000000000e1", 0, 6, 0.1 1, IOSTATE_failbit, 6, 32, FALSE}, */
5518 {type_ldbl
, "0.10000000000000000000000000000e1", 0, 6, /* 0.1 */ 1, IOSTATE_failbit
, 6, 32, TRUE
},
5519 {type_ldbl
, "1.69781699841e-1475", 0, 6, /* 0.0 */ 2, IOSTATE_eofbit
, 6, 19, FALSE
},
5520 {type_ldbl
, "-1.69781699841e-1475l", 0, 6, /* 0.0 */ 2, IOSTATE_goodbit
, 6, 20, FALSE
},
5521 {type_ldbl
, "1.69781699841e1475", 0, 6, /* INF */ 3, IOSTATE_eofbit
, 6, 18, FALSE
},
5522 {type_ldbl
, "-1.69781699841e1475", 0, 6, /* -INF */ 4, IOSTATE_eofbit
, 6, 19, FALSE
},
5524 {type_sbf
, "", FLAGS_skipws
, 6, /* "" */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
5525 {type_sbf
, " ", FLAGS_skipws
, 6, /* "" */ 0, IOSTATE_faileof
, 6, 2, FALSE
},
5526 {type_sbf
, "\r\nabcd\n", FLAGS_skipws
, 6, /* "abc\n" */ 1, IOSTATE_goodbit
, 6, 8, FALSE
},
5527 {type_sbf
, "abcdefg\n", 0, 6, /* "abcde" */ 2, IOSTATE_failbit
, 6, 9, FALSE
},
5528 {type_sbf
, "abcdefg\n", 0, 0, /* "" */ 0, IOSTATE_failbit
, 0, 9, FALSE
}
5531 pssb
= call_func2(p_strstreambuf_dynamic_ctor
, &ssb_test
, 64);
5532 ok(pssb
== &ssb_test
, "wrong return, expected %p got %p\n", &ssb_test
, pssb
);
5533 ret
= (int) call_func1(p_streambuf_allocate
, &ssb_test
.base
);
5534 ok(ret
== 1, "expected 1 got %d\n", ret
);
5535 ssb_test
.dynamic
= 0;
5536 pssb
= call_func2(p_strstreambuf_dynamic_ctor
, &ssb
, 64);
5537 ok(pssb
== &ssb
, "wrong return, expected %p got %p\n", &ssb
, pssb
);
5538 ret
= (int) call_func1(p_streambuf_allocate
, &ssb
.base
);
5539 ok(ret
== 1, "expected 1 got %d\n", ret
);
5540 pis
= call_func3(p_istream_sb_ctor
, &is
, &ssb
.base
, TRUE
);
5541 ok(pis
== &is
, "wrong return, expected %p got %p\n", &is
, pis
);
5543 for (i
= 0; i
< sizeof(tests
) / sizeof(tests
[0]); i
++) {
5544 len
= strlen(tests
[i
].stream_content
);
5545 is
.base_ios
.state
= IOSTATE_goodbit
;
5546 is
.base_ios
.flags
= tests
[i
].flags
;
5547 is
.base_ios
.width
= tests
[i
].width
;
5548 ssb
.base
.eback
= ssb
.base
.gptr
= ssb
.base
.base
;
5549 ssb
.base
.egptr
= ssb
.base
.base
+ len
;
5550 memcpy(ssb
.base
.base
, tests
[i
].stream_content
, len
);
5552 switch (tests
[i
].type
) {
5555 pis
= call_func2(p_istream_read_char
, &is
, &c
);
5556 ok(c
== char_out
[tests
[i
].expected_val
], "Test %d: expected %d got %d\n", i
,
5557 char_out
[tests
[i
].expected_val
], c
);
5560 memset(st
, 'A', sizeof(st
));
5562 pis
= call_func2(p_istream_read_str
, &is
, st
);
5563 ok(!strcmp(st
, str_out
[tests
[i
].expected_val
]), "Test %d: expected %s got %s\n", i
,
5564 str_out
[tests
[i
].expected_val
], st
);
5568 pis
= call_func2(p_istream_read_short
, &is
, &s
);
5569 ok(s
== short_out
[tests
[i
].expected_val
], "Test %d: expected %hd got %hd\n", i
,
5570 short_out
[tests
[i
].expected_val
], s
);
5574 pis
= call_func2(p_istream_read_unsigned_short
, &is
, &us
);
5575 ok(us
== ushort_out
[tests
[i
].expected_val
], "Test %d: expected %hu got %hu\n", i
,
5576 ushort_out
[tests
[i
].expected_val
], us
);
5580 pis
= call_func2(p_istream_read_int
, &is
, &n
);
5581 ok(n
== int_out
[tests
[i
].expected_val
], "Test %d: expected %d got %d\n", i
,
5582 int_out
[tests
[i
].expected_val
], n
);
5586 pis
= call_func2(p_istream_read_unsigned_int
, &is
, &un
);
5587 ok(un
== uint_out
[tests
[i
].expected_val
], "Test %d: expected %u got %u\n", i
,
5588 uint_out
[tests
[i
].expected_val
], un
);
5592 pis
= call_func2(p_istream_read_long
, &is
, &l
);
5593 ok(l
== long_out
[tests
[i
].expected_val
], "Test %d: expected %d got %d\n", i
,
5594 long_out
[tests
[i
].expected_val
], l
);
5598 pis
= call_func2(p_istream_read_unsigned_long
, &is
, &ul
);
5599 ok(ul
== ulong_out
[tests
[i
].expected_val
], "Test %d: expected %u got %u\n", i
,
5600 ulong_out
[tests
[i
].expected_val
], ul
);
5604 pis
= call_func2(p_istream_read_float
, &is
, &f
);
5605 ok(f
== float_out
[tests
[i
].expected_val
], "Test %d: expected %f got %f\n", i
,
5606 float_out
[tests
[i
].expected_val
], f
);
5610 pis
= call_func2(p_istream_read_double
, &is
, &d
);
5611 ok(d
== double_out
[tests
[i
].expected_val
], "Test %d: expected %f got %f\n", i
,
5612 double_out
[tests
[i
].expected_val
], d
);
5616 pis
= call_func2(p_istream_read_long_double
, &is
, &d
);
5617 ok(d
== double_out
[tests
[i
].expected_val
], "Test %d: expected %f got %f\n", i
,
5618 double_out
[tests
[i
].expected_val
], d
);
5621 ssb_test
.base
.pbase
= ssb_test
.base
.pptr
= ssb_test
.base
.base
;
5622 ssb_test
.base
.epptr
= ssb_test
.base
.base
+ tests
[i
].width
;
5623 pis
= call_func2(p_istream_read_streambuf
, &is
, &ssb_test
.base
);
5624 len
= strlen(sbf_out
[tests
[i
].expected_val
]);
5625 ok(ssb_test
.base
.pptr
== ssb_test
.base
.pbase
+ len
, "Test %d: wrong put pointer, expected %p got %p\n",
5626 i
, ssb_test
.base
.pbase
+ len
, ssb_test
.base
.pptr
);
5627 ok(!strncmp(ssb_test
.base
.pbase
, sbf_out
[tests
[i
].expected_val
], len
),
5628 "Test %d: expected %s got %s\n", i
, sbf_out
[tests
[i
].expected_val
], ssb_test
.base
.pbase
);
5632 ok(pis
== &is
, "Test %d: wrong return, expected %p got %p\n", i
, &is
, pis
);
5633 ok(is
.base_ios
.state
== tests
[i
].expected_state
|| /* xp, 2k3 */ broken(tests
[i
].broken
),
5634 "Test %d: expected %d got %d\n", i
, tests
[i
].expected_state
, is
.base_ios
.state
);
5635 ok(is
.base_ios
.width
== tests
[i
].expected_width
, "Test %d: expected %d got %d\n", i
,
5636 tests
[i
].expected_width
, is
.base_ios
.width
);
5637 ok(ssb
.base
.gptr
== ssb
.base
.base
+ tests
[i
].expected_offset
||
5638 /* xp, 2k3 */ broken(tests
[i
].broken
), "Test %d: expected %p got %p\n", i
,
5639 ssb
.base
.base
+ tests
[i
].expected_offset
, ssb
.base
.gptr
);
5642 ssb_test
.dynamic
= 1;
5643 call_func1(p_istream_vbase_dtor
, &is
);
5644 call_func1(p_strstreambuf_dtor
, &ssb
);
5645 call_func1(p_strstreambuf_dtor
, &ssb_test
);
5648 static void test_istream_withassign(void)
5650 istream isa1
, isa2
, *pisa
;
5654 memset(&isa1
, 0xab, sizeof(istream
));
5655 memset(&isa2
, 0xab, sizeof(istream
));
5657 /* constructors/destructors */
5658 pisa
= call_func3(p_istream_withassign_sb_ctor
, &isa1
, NULL
, TRUE
);
5659 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
5660 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
5661 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
5662 ok(isa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.sb
);
5663 ok(isa1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, isa1
.base_ios
.state
);
5664 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
5665 ok(isa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.tie
);
5666 ok(isa1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa1
.base_ios
.flags
);
5667 ok(isa1
.base_ios
.precision
== 6, "expected 6 got %d\n", isa1
.base_ios
.precision
);
5668 ok(isa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa1
.base_ios
.fill
);
5669 ok(isa1
.base_ios
.width
== 0, "expected 0 got %d\n", isa1
.base_ios
.width
);
5670 ok(isa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", isa1
.base_ios
.do_lock
);
5671 call_func1(p_istream_withassign_vbase_dtor
, &isa1
);
5672 isa1
.extract_delim
= isa1
.count
= 0xabababab;
5673 memset(&isa1
.base_ios
, 0xab, sizeof(ios
));
5674 isa1
.base_ios
.delbuf
= 0;
5675 pisa
= call_func3(p_istream_withassign_sb_ctor
, &isa1
, NULL
, FALSE
);
5676 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
5677 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
5678 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
5679 ok(isa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.sb
);
5680 ok(isa1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
5681 0xabababab|IOSTATE_badbit
, isa1
.base_ios
.state
);
5682 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
5683 ok(isa1
.base_ios
.tie
== isa2
.base_ios
.tie
, "expected %p got %p\n", isa2
.base_ios
.tie
, isa1
.base_ios
.tie
);
5684 ok(isa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, isa1
.base_ios
.flags
);
5685 ok(isa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.precision
);
5686 ok(isa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", isa1
.base_ios
.fill
);
5687 ok(isa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.width
);
5688 ok(isa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.do_lock
);
5689 call_func1(p_istream_withassign_dtor
, &isa1
.base_ios
);
5690 isa1
.extract_delim
= isa1
.count
= 0xabababab;
5691 memset(&isa1
.base_ios
, 0xab, sizeof(ios
));
5692 pisa
= call_func3(p_istream_withassign_sb_ctor
, &isa1
, &sb
, TRUE
);
5693 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
5694 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
5695 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
5696 ok(isa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, isa1
.base_ios
.sb
);
5697 ok(isa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, isa1
.base_ios
.state
);
5698 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
5699 ok(isa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.tie
);
5700 ok(isa1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa1
.base_ios
.flags
);
5701 ok(isa1
.base_ios
.precision
== 6, "expected 6 got %d\n", isa1
.base_ios
.precision
);
5702 ok(isa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa1
.base_ios
.fill
);
5703 ok(isa1
.base_ios
.width
== 0, "expected 0 got %d\n", isa1
.base_ios
.width
);
5704 ok(isa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", isa1
.base_ios
.do_lock
);
5705 call_func1(p_istream_withassign_vbase_dtor
, &isa1
);
5706 isa1
.extract_delim
= isa1
.count
= 0xabababab;
5707 memset(&isa1
.base_ios
, 0xab, sizeof(ios
));
5708 isa1
.base_ios
.delbuf
= 0;
5709 isa1
.base_ios
.state
= 0xabababab | IOSTATE_badbit
;
5710 pisa
= call_func3(p_istream_withassign_sb_ctor
, &isa1
, &sb
, FALSE
);
5711 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
5712 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
5713 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
5714 ok(isa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, isa1
.base_ios
.sb
);
5715 ok(isa1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.state
);
5716 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
5717 ok(isa1
.base_ios
.tie
== isa2
.base_ios
.tie
, "expected %p got %p\n", isa2
.base_ios
.tie
, isa1
.base_ios
.tie
);
5718 ok(isa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, isa1
.base_ios
.flags
);
5719 ok(isa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.precision
);
5720 ok(isa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", isa1
.base_ios
.fill
);
5721 ok(isa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.width
);
5722 ok(isa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.do_lock
);
5723 call_func1(p_istream_withassign_dtor
, &isa1
.base_ios
);
5724 isa1
.extract_delim
= isa1
.count
= 0xabababab;
5725 pisa
= call_func2(p_istream_withassign_ctor
, &isa1
, TRUE
);
5726 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
5727 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
5728 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
5729 ok(isa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.sb
);
5730 ok(isa1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, isa1
.base_ios
.state
);
5731 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
5732 ok(isa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.tie
);
5733 ok(isa1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa1
.base_ios
.flags
);
5734 ok(isa1
.base_ios
.precision
== 6, "expected 6 got %d\n", isa1
.base_ios
.precision
);
5735 ok(isa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa1
.base_ios
.fill
);
5736 ok(isa1
.base_ios
.width
== 0, "expected 0 got %d\n", isa1
.base_ios
.width
);
5737 ok(isa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", isa1
.base_ios
.do_lock
);
5738 call_func1(p_istream_withassign_vbase_dtor
, &isa1
);
5739 isa1
.extract_delim
= isa1
.count
= 0xabababab;
5740 memset(&isa1
.base_ios
, 0xab, sizeof(ios
));
5741 pisa
= call_func2(p_istream_withassign_ctor
, &isa1
, FALSE
);
5742 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
5743 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
5744 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
5745 ok(isa1
.base_ios
.sb
== isa2
.base_ios
.sb
, "expected %p got %p\n", isa2
.base_ios
.sb
, isa1
.base_ios
.sb
);
5746 ok(isa1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.state
);
5747 ok(isa1
.base_ios
.delbuf
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.delbuf
);
5748 ok(isa1
.base_ios
.tie
== isa2
.base_ios
.tie
, "expected %p got %p\n", isa2
.base_ios
.tie
, isa1
.base_ios
.tie
);
5749 ok(isa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, isa1
.base_ios
.flags
);
5750 ok(isa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.precision
);
5751 ok(isa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", isa1
.base_ios
.fill
);
5752 ok(isa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.width
);
5753 ok(isa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.do_lock
);
5754 call_func1(p_istream_withassign_dtor
, &isa1
.base_ios
);
5755 isa1
.extract_delim
= isa1
.count
= 0xcdcdcdcd;
5756 memset(&isa1
.base_ios
, 0xcd, sizeof(ios
));
5757 pisa
= call_func3(p_istream_withassign_copy_ctor
, &isa2
, &isa1
, TRUE
);
5758 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
5759 ok(isa2
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
5760 ok(isa2
.count
== 0, "expected 0 got %d\n", isa1
.count
);
5761 ok(isa2
.base_ios
.sb
== isa1
.base_ios
.sb
, "expected %p got %p\n", isa1
.base_ios
.sb
, isa2
.base_ios
.sb
);
5762 ok(isa2
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, isa2
.base_ios
.state
);
5763 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
5764 ok(isa2
.base_ios
.tie
== isa1
.base_ios
.tie
, "expected %p got %p\n", isa1
.base_ios
.tie
, isa2
.base_ios
.tie
);
5765 ok(isa2
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, isa2
.base_ios
.flags
);
5766 ok(isa2
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", isa2
.base_ios
.precision
);
5767 ok(isa2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", isa2
.base_ios
.fill
);
5768 ok(isa2
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", isa2
.base_ios
.width
);
5769 ok(isa2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", isa2
.base_ios
.do_lock
);
5770 call_func1(p_istream_withassign_vbase_dtor
, &isa2
);
5771 isa1
.base_ios
.sb
= NULL
;
5772 isa2
.extract_delim
= isa2
.count
= 0xabababab;
5773 memset(&isa2
.base_ios
, 0xab, sizeof(ios
));
5774 isa2
.base_ios
.delbuf
= 0;
5775 isa2
.base_ios
.flags
&= ~FLAGS_skipws
;
5776 pos
= isa2
.base_ios
.tie
;
5777 pisa
= call_func3(p_istream_withassign_copy_ctor
, &isa2
, &isa1
, FALSE
);
5778 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
5779 ok(isa2
.extract_delim
== 0, "expected 0 got %d\n", isa2
.extract_delim
);
5780 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
5781 ok(isa2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.sb
);
5782 ok(isa2
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
5783 0xabababab|IOSTATE_badbit
, isa2
.base_ios
.state
);
5784 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
5785 ok(isa2
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, isa2
.base_ios
.tie
);
5786 ok(isa2
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, isa2
.base_ios
.flags
);
5787 ok(isa2
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.precision
);
5788 ok(isa2
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", isa2
.base_ios
.fill
);
5789 ok(isa2
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.width
);
5790 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
5791 call_func1(p_istream_withassign_dtor
, &isa2
.base_ios
);
5794 isa2
.extract_delim
= isa2
.count
= 0xabababab;
5795 isa2
.base_ios
.delbuf
= 0xabababab;
5796 pisa
= call_func2(p_istream_withassign_assign_sb
, &isa2
, &sb
);
5797 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
5798 ok(isa2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.extract_delim
);
5799 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
5800 ok(isa2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, isa2
.base_ios
.sb
);
5801 ok(isa2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, isa2
.base_ios
.state
);
5802 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
5803 ok(isa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.tie
);
5804 ok(isa2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa2
.base_ios
.flags
);
5805 ok(isa2
.base_ios
.precision
== 6, "expected 6 got %d\n", isa2
.base_ios
.precision
);
5806 ok(isa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa2
.base_ios
.fill
);
5807 ok(isa2
.base_ios
.width
== 0, "expected 0 got %d\n", isa2
.base_ios
.width
);
5808 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
5809 isa2
.count
= 0xabababab;
5810 memset(&isa2
.base_ios
, 0xab, sizeof(ios
));
5811 isa2
.base_ios
.delbuf
= 0;
5812 pisa
= call_func2(p_istream_withassign_assign_sb
, &isa2
, NULL
);
5813 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
5814 ok(isa2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.extract_delim
);
5815 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
5816 ok(isa2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.sb
);
5817 ok(isa2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, isa2
.base_ios
.state
);
5818 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
5819 ok(isa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.tie
);
5820 ok(isa2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa2
.base_ios
.flags
);
5821 ok(isa2
.base_ios
.precision
== 6, "expected 6 got %d\n", isa2
.base_ios
.precision
);
5822 ok(isa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa2
.base_ios
.fill
);
5823 ok(isa2
.base_ios
.width
== 0, "expected 0 got %d\n", isa2
.base_ios
.width
);
5824 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
5825 isa2
.count
= 0xabababab;
5826 memset(&isa2
.base_ios
, 0xab, sizeof(ios
));
5827 isa2
.base_ios
.delbuf
= 0;
5828 pisa
= call_func2(p_istream_withassign_assign_is
, &isa2
, &isa1
);
5829 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
5830 ok(isa2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.extract_delim
);
5831 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
5832 ok(isa2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.sb
);
5833 ok(isa2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, isa2
.base_ios
.state
);
5834 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
5835 ok(isa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.tie
);
5836 ok(isa2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa2
.base_ios
.flags
);
5837 ok(isa2
.base_ios
.precision
== 6, "expected 6 got %d\n", isa2
.base_ios
.precision
);
5838 ok(isa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa2
.base_ios
.fill
);
5839 ok(isa2
.base_ios
.width
== 0, "expected 0 got %d\n", isa2
.base_ios
.width
);
5840 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
5841 isa1
.base_ios
.sb
= &sb
;
5842 isa2
.count
= 0xabababab;
5843 memset(&isa2
.base_ios
, 0xab, sizeof(ios
));
5844 isa2
.base_ios
.delbuf
= 0;
5845 pisa
= call_func2(p_istream_withassign_assign
, &isa2
, &isa1
);
5846 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
5847 ok(isa2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.extract_delim
);
5848 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
5849 ok(isa2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, isa2
.base_ios
.sb
);
5850 ok(isa2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, isa2
.base_ios
.state
);
5851 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
5852 ok(isa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.tie
);
5853 ok(isa2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa2
.base_ios
.flags
);
5854 ok(isa2
.base_ios
.precision
== 6, "expected 6 got %d\n", isa2
.base_ios
.precision
);
5855 ok(isa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa2
.base_ios
.fill
);
5856 ok(isa2
.base_ios
.width
== 0, "expected 0 got %d\n", isa2
.base_ios
.width
);
5857 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
5860 static void test_iostream(void)
5862 iostream ios1
, ios2
, *pios
;
5866 memset(&ios1
, 0xab, sizeof(iostream
));
5867 memset(&ios2
, 0xab, sizeof(iostream
));
5869 /* constructors/destructors */
5870 pios
= call_func3(p_iostream_sb_ctor
, &ios1
, NULL
, TRUE
);
5871 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
5872 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
5873 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
5874 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
5875 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
5876 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
5877 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
5878 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
5879 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
5880 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
5881 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
5882 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
5883 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
5884 call_func1(p_iostream_vbase_dtor
, &ios1
);
5885 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
5886 ios1
.base2
.unknown
= 0xabababab;
5887 memset(&ios1
.base_ios
, 0xab, sizeof(ios
));
5888 ios1
.base_ios
.delbuf
= 0;
5889 pios
= call_func3(p_iostream_sb_ctor
, &ios1
, NULL
, FALSE
);
5890 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
5891 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
5892 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
5893 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
5894 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
5895 ok(ios1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
5896 0xabababab|IOSTATE_badbit
, ios1
.base_ios
.state
);
5897 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
5898 ok(ios1
.base_ios
.tie
== ios2
.base_ios
.tie
, "expected %p got %p\n", ios2
.base_ios
.tie
, ios1
.base_ios
.tie
);
5899 ok(ios1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios1
.base_ios
.flags
);
5900 ok(ios1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.precision
);
5901 ok(ios1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios1
.base_ios
.fill
);
5902 ok(ios1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.width
);
5903 ok(ios1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.do_lock
);
5904 call_func1(p_iostream_dtor
, &ios1
.base_ios
);
5905 memset(&ios1
, 0xab, sizeof(iostream
));
5906 pios
= call_func3(p_iostream_sb_ctor
, &ios1
, &sb
, TRUE
);
5907 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
5908 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
5909 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
5910 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
5911 ok(ios1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios1
.base_ios
.sb
);
5912 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
5913 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
5914 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
5915 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
5916 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
5917 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
5918 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
5919 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
5920 call_func1(p_iostream_vbase_dtor
, &ios1
);
5921 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
5922 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
5923 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
5924 ios1
.base2
.unknown
= 0xabababab;
5925 memset(&ios1
.base_ios
, 0xab, sizeof(ios
));
5926 ios1
.base_ios
.delbuf
= 0;
5927 pios
= call_func3(p_iostream_sb_ctor
, &ios1
, &sb
, FALSE
);
5928 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
5929 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
5930 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
5931 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
5932 ok(ios1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios1
.base_ios
.sb
);
5933 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
5934 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
5935 ok(ios1
.base_ios
.tie
== ios2
.base_ios
.tie
, "expected %p got %p\n", ios2
.base_ios
.tie
, ios1
.base_ios
.tie
);
5936 ok(ios1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios1
.base_ios
.flags
);
5937 ok(ios1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.precision
);
5938 ok(ios1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios1
.base_ios
.fill
);
5939 ok(ios1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.width
);
5940 ok(ios1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.do_lock
);
5941 call_func1(p_iostream_dtor
, &ios1
.base_ios
);
5942 memset(&ios1
, 0xab, sizeof(iostream
));
5943 pios
= call_func2(p_iostream_ctor
, &ios1
, TRUE
);
5944 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
5945 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
5946 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
5947 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
5948 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
5949 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
5950 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
5951 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
5952 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
5953 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
5954 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
5955 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
5956 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
5957 call_func1(p_iostream_vbase_dtor
, &ios1
);
5958 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
5959 ios1
.base2
.unknown
= 0xabababab;
5960 memset(&ios1
.base_ios
, 0xab, sizeof(ios
));
5961 pios
= call_func2(p_iostream_ctor
, &ios1
, FALSE
);
5962 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
5963 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
5964 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
5965 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
5966 ok(ios1
.base_ios
.sb
== ios2
.base_ios
.sb
, "expected %p got %p\n", ios2
.base_ios
.sb
, ios1
.base_ios
.sb
);
5967 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
5968 ok(ios1
.base_ios
.delbuf
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.delbuf
);
5969 ok(ios1
.base_ios
.tie
== ios2
.base_ios
.tie
, "expected %p got %p\n", ios2
.base_ios
.tie
, ios1
.base_ios
.tie
);
5970 ok(ios1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios1
.base_ios
.flags
);
5971 ok(ios1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.precision
);
5972 ok(ios1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios1
.base_ios
.fill
);
5973 ok(ios1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.width
);
5974 ok(ios1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.do_lock
);
5975 call_func1(p_iostream_dtor
, &ios1
.base_ios
);
5976 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
5977 ios1
.base2
.unknown
= 0xabababab;
5978 memset(&ios2
, 0xcd, sizeof(iostream
));
5979 pios
= call_func3(p_iostream_copy_ctor
, &ios2
, &ios1
, TRUE
);
5980 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
5981 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
5982 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
5983 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
5984 ok(ios2
.base_ios
.sb
== ios1
.base_ios
.sb
, "expected %p got %p\n", ios1
.base_ios
.sb
, ios2
.base_ios
.sb
);
5985 ok(ios2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios2
.base_ios
.state
);
5986 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
5987 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
5988 ok(ios2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios2
.base_ios
.flags
);
5989 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
5990 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
5991 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
5992 ok(ios2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios2
.base_ios
.do_lock
);
5993 call_func1(p_iostream_vbase_dtor
, &ios2
);
5994 ios1
.base_ios
.sb
= NULL
;
5995 memset(&ios2
, 0xcd, sizeof(iostream
));
5996 pios
= call_func3(p_iostream_copy_ctor
, &ios2
, &ios1
, TRUE
);
5997 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
5998 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
5999 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
6000 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
6001 ok(ios2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.sb
);
6002 ok(ios2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios2
.base_ios
.state
);
6003 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
6004 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
6005 ok(ios2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios2
.base_ios
.flags
);
6006 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
6007 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
6008 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
6009 ok(ios2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios2
.base_ios
.do_lock
);
6010 call_func1(p_iostream_vbase_dtor
, &ios2
);
6011 ios1
.base_ios
.sb
= &sb
;
6012 ios2
.base1
.extract_delim
= ios2
.base1
.count
= 0xcdcdcdcd;
6013 ios2
.base2
.unknown
= 0xcdcdcdcd;
6014 memset(&ios2
.base_ios
, 0xcd, sizeof(ios
));
6015 ios2
.base_ios
.delbuf
= 0;
6016 pos
= ios2
.base_ios
.tie
;
6017 pios
= call_func3(p_iostream_copy_ctor
, &ios2
, &ios1
, FALSE
);
6018 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
6019 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
6020 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
6021 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
6022 ok(ios2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios2
.base_ios
.sb
);
6023 ok(ios2
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, ios2
.base_ios
.state
);
6024 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
6025 ok(ios2
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, ios2
.base_ios
.tie
);
6026 ok(ios2
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, ios2
.base_ios
.flags
);
6027 ok(ios2
.base_ios
.precision
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.precision
);
6028 ok(ios2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", ios2
.base_ios
.fill
);
6029 ok(ios2
.base_ios
.width
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.width
);
6030 ok(ios2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.do_lock
);
6031 call_func1(p_iostream_dtor
, &ios2
.base_ios
);
6034 ios2
.base1
.extract_delim
= ios2
.base1
.count
= 0xcdcdcdcd;
6035 ios2
.base2
.unknown
= 0xcdcdcdcd;
6036 ios2
.base_ios
.sb
= (streambuf
*) 0xcdcdcdcd;
6037 ios2
.base_ios
.state
= 0xcdcdcdcd;
6038 pios
= call_func2(p_iostream_assign_sb
, &ios2
, &sb
);
6039 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
6040 ok(ios2
.base1
.extract_delim
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base1
.extract_delim
);
6041 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
6042 ok(ios2
.base2
.unknown
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base2
.unknown
);
6043 ok(ios2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios2
.base_ios
.sb
);
6044 ok(ios2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios2
.base_ios
.state
);
6045 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
6046 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
6047 ok(ios2
.base_ios
.flags
== 0, "expected 0 got %x\n", ios2
.base_ios
.flags
);
6048 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
6049 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
6050 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
6051 ok(ios2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.do_lock
);
6052 ios2
.base1
.count
= 0xcdcdcdcd;
6053 memset(&ios2
.base_ios
, 0xcd, sizeof(ios
));
6054 ios2
.base_ios
.delbuf
= 0;
6055 pios
= call_func2(p_iostream_assign_sb
, &ios2
, NULL
);
6056 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
6057 ok(ios2
.base1
.extract_delim
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base1
.extract_delim
);
6058 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
6059 ok(ios2
.base2
.unknown
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base2
.unknown
);
6060 ok(ios2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.sb
);
6061 ok(ios2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios2
.base_ios
.state
);
6062 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
6063 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
6064 ok(ios2
.base_ios
.flags
== 0, "expected 0 got %x\n", ios2
.base_ios
.flags
);
6065 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
6066 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
6067 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
6068 ok(ios2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.do_lock
);
6069 ios2
.base1
.count
= 0xcdcdcdcd;
6070 memset(&ios2
.base_ios
, 0xcd, sizeof(ios
));
6071 ios2
.base_ios
.delbuf
= 0;
6072 if (0) /* crashes on native */
6073 pios
= call_func2(p_iostream_assign
, &ios2
, NULL
);
6074 pios
= call_func2(p_iostream_assign
, &ios2
, &ios1
);
6075 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
6076 ok(ios2
.base1
.extract_delim
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base1
.extract_delim
);
6077 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
6078 ok(ios2
.base2
.unknown
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base2
.unknown
);
6079 ok(ios2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios2
.base_ios
.sb
);
6080 ok(ios2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios2
.base_ios
.state
);
6081 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
6082 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
6083 ok(ios2
.base_ios
.flags
== 0, "expected 0 got %x\n", ios2
.base_ios
.flags
);
6084 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
6085 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
6086 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
6087 ok(ios2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.do_lock
);
6090 static void test_Iostream_init(void)
6097 memset(&ios_obj
, 0xab, sizeof(ios
));
6099 pinit
= call_func3(p_Iostream_init_ios_ctor
, NULL
, &ios_obj
, 0);
6100 ok(pinit
== NULL
, "wrong return, expected %p got %p\n", NULL
, pinit
);
6101 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
6102 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
6103 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
6104 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
6105 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
6106 ok(ios_obj
.tie
== p_cout
, "expected %p got %p\n", p_cout
, ios_obj
.tie
);
6107 ok(ios_obj
.flags
== 0xabababab, "expected %d got %x\n", 0xabababab, ios_obj
.flags
);
6108 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
6109 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
6110 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
6111 ok(ios_obj
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.do_lock
);
6113 memset(&ios_obj
, 0xab, sizeof(ios
));
6115 pinit
= call_func3(p_Iostream_init_ios_ctor
, NULL
, &ios_obj
, -1);
6116 ok(pinit
== NULL
, "wrong return, expected %p got %p\n", NULL
, pinit
);
6117 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
6118 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
6119 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
6120 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
6121 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
6122 ok(ios_obj
.tie
== pos
, "expected %p got %p\n", pos
, ios_obj
.tie
);
6123 ok(ios_obj
.flags
== 0xabababab, "expected %d got %x\n", 0xabababab, ios_obj
.flags
);
6124 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
6125 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
6126 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
6127 ok(ios_obj
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.do_lock
);
6129 memset(&ios_obj
, 0xab, sizeof(ios
));
6130 pinit
= call_func3(p_Iostream_init_ios_ctor
, NULL
, &ios_obj
, -100);
6131 ok(pinit
== NULL
, "wrong return, expected %p got %p\n", NULL
, pinit
);
6132 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
6133 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
6134 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
6135 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
6136 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
6137 ok(ios_obj
.tie
== pos
, "expected %p got %p\n", pos
, ios_obj
.tie
);
6138 ok(ios_obj
.flags
== 0xabababab, "expected %d got %x\n", 0xabababab, ios_obj
.flags
);
6139 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
6140 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
6141 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
6142 ok(ios_obj
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.do_lock
);
6144 if (0) /* crashes on native */
6145 pinit
= call_func3(p_Iostream_init_ios_ctor
, NULL
, NULL
, -1);
6147 memset(&ios_obj
, 0xab, sizeof(ios
));
6148 ios_obj
.flags
= 0xcdcdcdcd;
6149 ios_obj
.do_lock
= 0x34343434;
6150 pinit
= call_func3(p_Iostream_init_ios_ctor
, (void*) 0xdeadbeef, &ios_obj
, 1);
6151 ok(pinit
== (void*) 0xdeadbeef, "wrong return, expected %p got %p\n", (void*) 0xdeadbeef, pinit
);
6152 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
6153 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
6154 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
6155 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
6156 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
6157 ok(ios_obj
.tie
== p_cout
, "expected %p got %p\n", p_cout
, ios_obj
.tie
);
6158 ok(ios_obj
.flags
== (0xcdcdcdcd|FLAGS_unitbuf
), "expected %d got %x\n",
6159 0xcdcdcdcd|FLAGS_unitbuf
, ios_obj
.flags
);
6160 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
6161 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
6162 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
6163 ok(ios_obj
.do_lock
== 0x34343434, "expected %d got %d\n", 0x34343434, ios_obj
.do_lock
);
6165 memset(&ios_obj
, 0xab, sizeof(ios
));
6166 ios_obj
.flags
= 0xcdcdcdcd;
6167 ios_obj
.do_lock
= 0x34343434;
6168 pinit
= call_func3(p_Iostream_init_ios_ctor
, (void*) 0xabababab, &ios_obj
, 5);
6169 ok(pinit
== (void*) 0xabababab, "wrong return, expected %p got %p\n", (void*) 0xabababab, pinit
);
6170 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
6171 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
6172 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
6173 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
6174 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
6175 ok(ios_obj
.tie
== p_cout
, "expected %p got %p\n", p_cout
, ios_obj
.tie
);
6176 ok(ios_obj
.flags
== (0xcdcdcdcd|FLAGS_unitbuf
), "expected %d got %x\n",
6177 0xcdcdcdcd|FLAGS_unitbuf
, ios_obj
.flags
);
6178 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
6179 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
6180 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
6181 ok(ios_obj
.do_lock
== 0x34343434, "expected %d got %d\n", 0x34343434, ios_obj
.do_lock
);
6184 static void test_std_streams(void)
6186 filebuf
*pfb_cin
= (filebuf
*) p_cin
->base_ios
.sb
;
6187 filebuf
*pfb_cout
= (filebuf
*) p_cout
->base_ios
.sb
;
6188 filebuf
*pfb_cerr
= (filebuf
*) p_cerr
->base_ios
.sb
;
6189 filebuf
*pfb_clog
= (filebuf
*) p_clog
->base_ios
.sb
;
6190 stdiobuf
*pstb_cin
, *pstb_cout
, *pstb_cerr
, *pstb_clog
;
6192 ok(p_cin
->extract_delim
== 0, "expected 0 got %d\n", p_cin
->extract_delim
);
6193 ok(p_cin
->count
== 0, "expected 0 got %d\n", p_cin
->count
);
6194 ok(p_cin
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cin
->base_ios
.state
);
6195 ok(p_cin
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cin
->base_ios
.delbuf
);
6196 ok(p_cin
->base_ios
.tie
== p_cout
, "expected %p got %p\n", p_cout
, p_cin
->base_ios
.tie
);
6197 ok(p_cin
->base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, p_cin
->base_ios
.flags
);
6198 ok(p_cin
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cin
->base_ios
.precision
);
6199 ok(p_cin
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cin
->base_ios
.fill
);
6200 ok(p_cin
->base_ios
.width
== 0, "expected 0 got %d\n", p_cin
->base_ios
.width
);
6201 ok(p_cin
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cin
->base_ios
.do_lock
);
6202 ok(pfb_cin
->fd
== 0, "wrong fd, expected 0 got %d\n", pfb_cin
->fd
);
6203 ok(pfb_cin
->close
== 0, "wrong value, expected 0 got %d\n", pfb_cin
->close
);
6204 ok(pfb_cin
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb_cin
->base
.allocated
);
6205 ok(pfb_cin
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb_cin
->base
.unbuffered
);
6207 ok(p_cout
->unknown
== 0, "expected 0 got %d\n", p_cout
->unknown
);
6208 ok(p_cout
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cout
->base_ios
.state
);
6209 ok(p_cout
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cout
->base_ios
.delbuf
);
6210 ok(p_cout
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_cout
->base_ios
.tie
);
6211 ok(p_cout
->base_ios
.flags
== 0, "expected 0 got %x\n", p_cout
->base_ios
.flags
);
6212 ok(p_cout
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cout
->base_ios
.precision
);
6213 ok(p_cout
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cout
->base_ios
.fill
);
6214 ok(p_cout
->base_ios
.width
== 0, "expected 0 got %d\n", p_cout
->base_ios
.width
);
6215 ok(p_cout
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cout
->base_ios
.do_lock
);
6216 ok(pfb_cout
->fd
== 1, "wrong fd, expected 1 got %d\n", pfb_cout
->fd
);
6217 ok(pfb_cout
->close
== 0, "wrong value, expected 0 got %d\n", pfb_cout
->close
);
6218 ok(pfb_cout
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb_cout
->base
.allocated
);
6219 ok(pfb_cout
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb_cout
->base
.unbuffered
);
6221 ok(p_cerr
->unknown
== 0, "expected 0 got %d\n", p_cerr
->unknown
);
6222 ok(p_cerr
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cerr
->base_ios
.state
);
6223 ok(p_cerr
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cerr
->base_ios
.delbuf
);
6224 ok(p_cerr
->base_ios
.tie
== p_cout
, "expected %p got %p\n", p_cout
, p_cerr
->base_ios
.tie
);
6225 ok(p_cerr
->base_ios
.flags
== FLAGS_unitbuf
, "expected %x got %x\n", FLAGS_unitbuf
, p_cerr
->base_ios
.flags
);
6226 ok(p_cerr
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cerr
->base_ios
.precision
);
6227 ok(p_cerr
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cerr
->base_ios
.fill
);
6228 ok(p_cerr
->base_ios
.width
== 0, "expected 0 got %d\n", p_cerr
->base_ios
.width
);
6229 ok(p_cerr
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cerr
->base_ios
.do_lock
);
6230 ok(pfb_cerr
->fd
== 2, "wrong fd, expected 2 got %d\n", pfb_cerr
->fd
);
6231 ok(pfb_cerr
->close
== 0, "wrong value, expected 0 got %d\n", pfb_cerr
->close
);
6232 ok(pfb_cerr
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb_cerr
->base
.allocated
);
6233 ok(pfb_cerr
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb_cerr
->base
.unbuffered
);
6235 ok(p_clog
->unknown
== 0, "expected 0 got %d\n", p_clog
->unknown
);
6236 ok(p_clog
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_clog
->base_ios
.state
);
6237 ok(p_clog
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_clog
->base_ios
.delbuf
);
6238 ok(p_clog
->base_ios
.tie
== p_cout
, "expected %p got %p\n", p_cout
, p_clog
->base_ios
.tie
);
6239 ok(p_clog
->base_ios
.flags
== 0, "expected 0 got %x\n", p_clog
->base_ios
.flags
);
6240 ok(p_clog
->base_ios
.precision
== 6, "expected 6 got %d\n", p_clog
->base_ios
.precision
);
6241 ok(p_clog
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_clog
->base_ios
.fill
);
6242 ok(p_clog
->base_ios
.width
== 0, "expected 0 got %d\n", p_clog
->base_ios
.width
);
6243 ok(p_clog
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_clog
->base_ios
.do_lock
);
6244 ok(pfb_clog
->fd
== 2, "wrong fd, expected 2 got %d\n", pfb_clog
->fd
);
6245 ok(pfb_clog
->close
== 0, "wrong value, expected 0 got %d\n", pfb_clog
->close
);
6246 ok(pfb_clog
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb_clog
->base
.allocated
);
6247 ok(pfb_clog
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb_clog
->base
.unbuffered
);
6249 /* sync_with_stdio */
6250 ok(*p_ios_sunk_with_stdio
== 0, "expected 0 got %d\n", *p_ios_sunk_with_stdio
);
6251 p_cin
->extract_delim
= p_cin
->count
= 0xabababab;
6252 p_cin
->base_ios
.state
= 0xabababab;
6253 p_cin
->base_ios
.precision
= p_cin
->base_ios
.fill
= p_cin
->base_ios
.width
= 0xabababab;
6254 p_cout
->unknown
= 0xabababab;
6255 p_cout
->base_ios
.state
= 0xabababab;
6256 p_cout
->base_ios
.precision
= p_cout
->base_ios
.fill
= p_cout
->base_ios
.width
= 0xabababab;
6257 p_cerr
->unknown
= 0xabababab;
6258 p_cerr
->base_ios
.state
= 0xabababab;
6259 p_cerr
->base_ios
.precision
= p_cerr
->base_ios
.fill
= p_cerr
->base_ios
.width
= 0xabababab;
6260 p_clog
->unknown
= 0xabababab;
6261 p_clog
->base_ios
.state
= 0xabababab;
6262 p_clog
->base_ios
.precision
= p_clog
->base_ios
.fill
= p_clog
->base_ios
.width
= 0xabababab;
6263 p_ios_sync_with_stdio();
6264 ok(*p_ios_sunk_with_stdio
== 1, "expected 1 got %d\n", *p_ios_sunk_with_stdio
);
6266 pstb_cin
= (stdiobuf
*) p_cin
->base_ios
.sb
;
6267 ok(p_cin
->extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cin
->extract_delim
);
6268 ok(p_cin
->count
== 0, "expected 0 got %d\n", p_cin
->count
);
6269 ok(p_cin
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cin
->base_ios
.state
);
6270 ok(p_cin
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cin
->base_ios
.delbuf
);
6271 ok(p_cin
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_cin
->base_ios
.tie
);
6272 ok(p_cin
->base_ios
.flags
== (FLAGS_skipws
|FLAGS_stdio
), "expected %x got %x\n",
6273 FLAGS_skipws
|FLAGS_stdio
, p_cin
->base_ios
.flags
);
6274 ok(p_cin
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cin
->base_ios
.precision
);
6275 ok(p_cin
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cin
->base_ios
.fill
);
6276 ok(p_cin
->base_ios
.width
== 0, "expected 0 got %d\n", p_cin
->base_ios
.width
);
6277 ok(p_cin
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cin
->base_ios
.do_lock
);
6278 ok(pstb_cin
->file
== stdin
, "wrong file pointer, expected %p got %p\n", stdin
, pstb_cin
->file
);
6279 ok(pstb_cin
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pstb_cin
->base
.allocated
);
6280 ok(pstb_cin
->base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", pstb_cin
->base
.unbuffered
);
6281 ok(pstb_cin
->base
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, pstb_cin
->base
.eback
);
6282 ok(pstb_cin
->base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, pstb_cin
->base
.eback
);
6283 ok(pstb_cin
->base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, pstb_cin
->base
.pbase
);
6285 pstb_cout
= (stdiobuf
*) p_cout
->base_ios
.sb
;
6286 ok(p_cout
->unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cout
->unknown
);
6287 ok(p_cout
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cout
->base_ios
.state
);
6288 ok(p_cout
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cout
->base_ios
.delbuf
);
6289 ok(p_cout
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_cout
->base_ios
.tie
);
6290 ok(p_cout
->base_ios
.flags
== (FLAGS_unitbuf
|FLAGS_stdio
), "expected %x got %x\n",
6291 FLAGS_unitbuf
|FLAGS_stdio
, p_cout
->base_ios
.flags
);
6292 ok(p_cout
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cout
->base_ios
.precision
);
6293 ok(p_cout
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cout
->base_ios
.fill
);
6294 ok(p_cout
->base_ios
.width
== 0, "expected 0 got %d\n", p_cout
->base_ios
.width
);
6295 ok(p_cout
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cout
->base_ios
.do_lock
);
6296 ok(pstb_cout
->file
== stdout
, "wrong file pointer, expected %p got %p\n", stdout
, pstb_cout
->file
);
6297 ok(pstb_cout
->base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", pstb_cout
->base
.allocated
);
6298 ok(pstb_cout
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pstb_cout
->base
.unbuffered
);
6299 ok(pstb_cout
->base
.ebuf
== pstb_cout
->base
.base
+ 80, "wrong ebuf pointer, expected %p got %p\n",
6300 pstb_cout
->base
.base
+ 80, pstb_cout
->base
.eback
);
6301 ok(pstb_cout
->base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, pstb_cout
->base
.eback
);
6302 ok(pstb_cout
->base
.pbase
== pstb_cout
->base
.base
, "wrong put base, expected %p got %p\n",
6303 pstb_cout
->base
.base
, pstb_cout
->base
.pbase
);
6304 ok(pstb_cout
->base
.pptr
== pstb_cout
->base
.base
, "wrong put pointer, expected %p got %p\n",
6305 pstb_cout
->base
.base
, pstb_cout
->base
.pptr
);
6306 ok(pstb_cout
->base
.epptr
== pstb_cout
->base
.base
+ 80, "wrong put end, expected %p got %p\n",
6307 pstb_cout
->base
.base
+ 80, pstb_cout
->base
.epptr
);
6309 pstb_cerr
= (stdiobuf
*) p_cerr
->base_ios
.sb
;
6310 ok(p_cerr
->unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cerr
->unknown
);
6311 ok(p_cerr
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cerr
->base_ios
.state
);
6312 ok(p_cerr
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cerr
->base_ios
.delbuf
);
6313 ok(p_cerr
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_cerr
->base_ios
.tie
);
6314 ok(p_cerr
->base_ios
.flags
== (FLAGS_unitbuf
|FLAGS_stdio
), "expected %x got %x\n",
6315 FLAGS_unitbuf
|FLAGS_stdio
, p_cerr
->base_ios
.flags
);
6316 ok(p_cerr
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cerr
->base_ios
.precision
);
6317 ok(p_cerr
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cerr
->base_ios
.fill
);
6318 ok(p_cerr
->base_ios
.width
== 0, "expected 0 got %d\n", p_cerr
->base_ios
.width
);
6319 ok(p_cerr
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cerr
->base_ios
.do_lock
);
6320 ok(pstb_cerr
->file
== stderr
, "wrong file pointer, expected %p got %p\n", stderr
, pstb_cerr
->file
);
6321 ok(pstb_cerr
->base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", pstb_cerr
->base
.allocated
);
6322 ok(pstb_cerr
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pstb_cerr
->base
.unbuffered
);
6323 ok(pstb_cerr
->base
.ebuf
== pstb_cerr
->base
.base
+ 80, "wrong ebuf pointer, expected %p got %p\n",
6324 pstb_cerr
->base
.base
+ 80, pstb_cerr
->base
.eback
);
6325 ok(pstb_cerr
->base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, pstb_cerr
->base
.eback
);
6326 ok(pstb_cerr
->base
.pbase
== pstb_cerr
->base
.base
, "wrong put base, expected %p got %p\n",
6327 pstb_cerr
->base
.base
, pstb_cerr
->base
.pbase
);
6328 ok(pstb_cerr
->base
.pptr
== pstb_cerr
->base
.base
, "wrong put pointer, expected %p got %p\n",
6329 pstb_cerr
->base
.base
, pstb_cerr
->base
.pptr
);
6330 ok(pstb_cerr
->base
.epptr
== pstb_cerr
->base
.base
+ 80, "wrong put end, expected %p got %p\n",
6331 pstb_cerr
->base
.base
+ 80, pstb_cerr
->base
.epptr
);
6333 pstb_clog
= (stdiobuf
*) p_clog
->base_ios
.sb
;
6334 ok(p_clog
->unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, p_clog
->unknown
);
6335 ok(p_clog
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_clog
->base_ios
.state
);
6336 ok(p_clog
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_clog
->base_ios
.delbuf
);
6337 ok(p_clog
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_clog
->base_ios
.tie
);
6338 ok(p_clog
->base_ios
.flags
== FLAGS_stdio
, "expected %x got %x\n", FLAGS_stdio
, p_clog
->base_ios
.flags
);
6339 ok(p_clog
->base_ios
.precision
== 6, "expected 6 got %d\n", p_clog
->base_ios
.precision
);
6340 ok(p_clog
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_clog
->base_ios
.fill
);
6341 ok(p_clog
->base_ios
.width
== 0, "expected 0 got %d\n", p_clog
->base_ios
.width
);
6342 ok(p_clog
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_clog
->base_ios
.do_lock
);
6343 ok(pstb_clog
->file
== stderr
, "wrong file pointer, expected %p got %p\n", stderr
, pstb_clog
->file
);
6344 ok(pstb_clog
->base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", pstb_clog
->base
.allocated
);
6345 ok(pstb_clog
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pstb_clog
->base
.unbuffered
);
6346 ok(pstb_clog
->base
.ebuf
== pstb_clog
->base
.base
+ 512, "wrong ebuf pointer, expected %p got %p\n",
6347 pstb_clog
->base
.base
+ 512, pstb_clog
->base
.eback
);
6348 ok(pstb_clog
->base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, pstb_clog
->base
.eback
);
6349 ok(pstb_clog
->base
.pbase
== pstb_clog
->base
.base
, "wrong put base, expected %p got %p\n",
6350 pstb_clog
->base
.base
, pstb_clog
->base
.pbase
);
6351 ok(pstb_clog
->base
.pptr
== pstb_clog
->base
.base
, "wrong put pointer, expected %p got %p\n",
6352 pstb_clog
->base
.base
, pstb_clog
->base
.pptr
);
6353 ok(pstb_clog
->base
.epptr
== pstb_clog
->base
.base
+ 512, "wrong put end, expected %p got %p\n",
6354 pstb_clog
->base
.base
+ 512, pstb_clog
->base
.epptr
);
6356 p_cin
->count
= 0xabababab;
6357 p_ios_sync_with_stdio();
6358 ok(*p_ios_sunk_with_stdio
== 1, "expected 1 got %d\n", *p_ios_sunk_with_stdio
);
6359 ok(p_cin
->count
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cin
->count
);
6360 p_ios_sync_with_stdio();
6361 ok(*p_ios_sunk_with_stdio
== 1, "expected 1 got %d\n", *p_ios_sunk_with_stdio
);
6362 ok(p_cin
->count
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cin
->count
);
6372 test_strstreambuf();
6376 test_ostream_print();
6377 test_ostream_withassign();
6379 test_istream_getint();
6380 test_istream_getdouble();
6381 test_istream_read();
6382 test_istream_withassign();
6384 test_Iostream_init();
6387 FreeLibrary(msvcrt
);
6388 FreeLibrary(msvcirt
);