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
27 #include "wine/test.h"
29 typedef void (*vtable_ptr
)(void);
30 typedef LONG streamoff
;
31 typedef LONG streampos
;
33 typedef void* (__cdecl
*allocFunction
)(LONG
);
34 typedef void (__cdecl
*freeFunction
)(void*);
37 IOSTATE_goodbit
= 0x0,
39 IOSTATE_failbit
= 0x2,
48 OPENMODE_trunc
= 0x10,
49 OPENMODE_nocreate
= 0x20,
50 OPENMODE_noreplace
= 0x40,
51 OPENMODE_binary
= 0x80
68 FLAGS_showbase
= 0x80,
69 FLAGS_showpoint
= 0x100,
70 FLAGS_uppercase
= 0x200,
71 FLAGS_showpos
= 0x400,
72 FLAGS_scientific
= 0x800,
74 FLAGS_unitbuf
= 0x2000,
78 const int filebuf_sh_none
= 0x800;
79 const int filebuf_sh_read
= 0xa00;
80 const int filebuf_sh_write
= 0xc00;
81 const int filebuf_openprot
= 420;
82 const int filebuf_binary
= _O_BINARY
;
83 const int filebuf_text
= _O_TEXT
;
87 const vtable_ptr
*vtable
;
100 CRITICAL_SECTION lock
;
110 /* class strstreambuf */
117 allocFunction f_alloc
;
130 const vtable_ptr
*vtable
;
135 struct _ostream
*tie
;
141 CRITICAL_SECTION lock
;
145 typedef struct _ostream
{
148 ios base_ios
; /* virtually inherited */
156 ios base_ios
; /* virtually inherited */
161 struct { /* istream */
166 struct { /* ostream */
170 ios base_ios
; /* virtually inherited */
173 /* class exception */
180 /* class logic_error */
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);
235 static int (*__thiscall p_filebuf_is_open
)(filebuf
*);
238 static strstreambuf
* (*__thiscall p_strstreambuf_dynamic_ctor
)(strstreambuf
*, int);
239 static strstreambuf
* (*__thiscall p_strstreambuf_funcs_ctor
)(strstreambuf
*, allocFunction
, freeFunction
);
240 static strstreambuf
* (*__thiscall p_strstreambuf_buffer_ctor
)(strstreambuf
*, char*, int, char*);
241 static strstreambuf
* (*__thiscall p_strstreambuf_ubuffer_ctor
)(strstreambuf
*, unsigned char*, int, unsigned char*);
242 static strstreambuf
* (*__thiscall p_strstreambuf_ctor
)(strstreambuf
*);
243 static void (*__thiscall p_strstreambuf_dtor
)(strstreambuf
*);
244 static int (*__thiscall p_strstreambuf_doallocate
)(strstreambuf
*);
245 static void (*__thiscall p_strstreambuf_freeze
)(strstreambuf
*, int);
246 static int (*__thiscall p_strstreambuf_overflow
)(strstreambuf
*, int);
247 static streampos (*__thiscall p_strstreambuf_seekoff
)(strstreambuf
*, streamoff
, ios_seek_dir
, int);
248 static streambuf
* (*__thiscall p_strstreambuf_setbuf
)(strstreambuf
*, char*, int);
249 static int (*__thiscall p_strstreambuf_underflow
)(strstreambuf
*);
252 static stdiobuf
* (*__thiscall p_stdiobuf_file_ctor
)(stdiobuf
*, FILE*);
253 static void (*__thiscall p_stdiobuf_dtor
)(stdiobuf
*);
254 static int (*__thiscall p_stdiobuf_overflow
)(stdiobuf
*, int);
255 static int (*__thiscall p_stdiobuf_pbackfail
)(stdiobuf
*, int);
256 static streampos (*__thiscall p_stdiobuf_seekoff
)(stdiobuf
*, streamoff
, ios_seek_dir
, int);
257 static int (*__thiscall p_stdiobuf_setrwbuf
)(stdiobuf
*, int, int);
258 static int (*__thiscall p_stdiobuf_sync
)(stdiobuf
*);
259 static int (*__thiscall p_stdiobuf_underflow
)(stdiobuf
*);
262 static ios
* (*__thiscall p_ios_copy_ctor
)(ios
*, const ios
*);
263 static ios
* (*__thiscall p_ios_ctor
)(ios
*);
264 static ios
* (*__thiscall p_ios_sb_ctor
)(ios
*, streambuf
*);
265 static ios
* (*__thiscall p_ios_assign
)(ios
*, const ios
*);
266 static void (*__thiscall p_ios_init
)(ios
*, streambuf
*);
267 static void (*__thiscall p_ios_dtor
)(ios
*);
268 static void (*__cdecl p_ios_clrlock
)(ios
*);
269 static void (*__cdecl p_ios_setlock
)(ios
*);
270 static void (*__cdecl p_ios_lock
)(ios
*);
271 static void (*__cdecl p_ios_unlock
)(ios
*);
272 static void (*__cdecl p_ios_lockbuf
)(ios
*);
273 static void (*__cdecl p_ios_unlockbuf
)(ios
*);
274 static CRITICAL_SECTION
*p_ios_static_lock
;
275 static void (*__cdecl p_ios_lockc
)(void);
276 static void (*__cdecl p_ios_unlockc
)(void);
277 static LONG (*__thiscall p_ios_flags_set
)(ios
*, LONG
);
278 static LONG (*__thiscall p_ios_flags_get
)(const ios
*);
279 static LONG (*__thiscall p_ios_setf
)(ios
*, LONG
);
280 static LONG (*__thiscall p_ios_setf_mask
)(ios
*, LONG
, LONG
);
281 static LONG (*__thiscall p_ios_unsetf
)(ios
*, LONG
);
282 static int (*__thiscall p_ios_good
)(const ios
*);
283 static int (*__thiscall p_ios_bad
)(const ios
*);
284 static int (*__thiscall p_ios_eof
)(const ios
*);
285 static int (*__thiscall p_ios_fail
)(const ios
*);
286 static void (*__thiscall p_ios_clear
)(ios
*, int);
287 static LONG
*p_ios_maxbit
;
288 static LONG (*__cdecl p_ios_bitalloc
)(void);
289 static int *p_ios_curindex
;
290 static LONG
*p_ios_statebuf
;
291 static LONG
* (*__thiscall p_ios_iword
)(const ios
*, int);
292 static void** (*__thiscall p_ios_pword
)(const ios
*, int);
293 static int (*__cdecl p_ios_xalloc
)(void);
294 static void (*__cdecl p_ios_sync_with_stdio
)(void);
295 static int *p_ios_sunk_with_stdio
;
296 static int *p_ios_fLockcInit
;
299 static ostream
* (*__thiscall p_ostream_copy_ctor
)(ostream
*, const ostream
*, BOOL
);
300 static ostream
* (*__thiscall p_ostream_sb_ctor
)(ostream
*, streambuf
*, BOOL
);
301 static ostream
* (*__thiscall p_ostream_ctor
)(ostream
*, BOOL
);
302 static void (*__thiscall p_ostream_dtor
)(ios
*);
303 static ostream
* (*__thiscall p_ostream_assign
)(ostream
*, const ostream
*);
304 static ostream
* (*__thiscall p_ostream_assign_sb
)(ostream
*, streambuf
*);
305 static void (*__thiscall p_ostream_vbase_dtor
)(ostream
*);
306 static ostream
* (*__thiscall p_ostream_flush
)(ostream
*);
307 static int (*__thiscall p_ostream_opfx
)(ostream
*);
308 static void (*__thiscall p_ostream_osfx
)(ostream
*);
309 static ostream
* (*__thiscall p_ostream_put_char
)(ostream
*, char);
310 static ostream
* (*__thiscall p_ostream_write_char
)(ostream
*, const char*, int);
311 static ostream
* (*__thiscall p_ostream_seekp_offset
)(ostream
*, streamoff
, ios_seek_dir
);
312 static ostream
* (*__thiscall p_ostream_seekp
)(ostream
*, streampos
);
313 static streampos (*__thiscall p_ostream_tellp
)(ostream
*);
314 static ostream
* (*__thiscall p_ostream_writepad
)(ostream
*, const char*, const char*);
315 static ostream
* (*__thiscall p_ostream_print_char
)(ostream
*, char);
316 static ostream
* (*__thiscall p_ostream_print_str
)(ostream
*, const char*);
317 static ostream
* (*__thiscall p_ostream_print_int
)(ostream
*, int);
318 static ostream
* (*__thiscall p_ostream_print_float
)(ostream
*, float);
319 static ostream
* (*__thiscall p_ostream_print_double
)(ostream
*, double);
320 static ostream
* (*__thiscall p_ostream_print_ptr
)(ostream
*, const void*);
321 static ostream
* (*__thiscall p_ostream_print_streambuf
)(ostream
*, streambuf
*);
323 /* ostream_withassign */
324 static ostream
* (*__thiscall p_ostream_withassign_sb_ctor
)(ostream
*, streambuf
*, BOOL
);
325 static ostream
* (*__thiscall p_ostream_withassign_copy_ctor
)(ostream
*, const ostream
*, BOOL
);
326 static ostream
* (*__thiscall p_ostream_withassign_ctor
)(ostream
*, BOOL
);
327 static void (*__thiscall p_ostream_withassign_dtor
)(ios
*);
328 static void (*__thiscall p_ostream_withassign_vbase_dtor
)(ostream
*);
329 static ostream
* (*__thiscall p_ostream_withassign_assign_sb
)(ostream
*, streambuf
*);
330 static ostream
* (*__thiscall p_ostream_withassign_assign_os
)(ostream
*, const ostream
*);
331 static ostream
* (*__thiscall p_ostream_withassign_assign
)(ostream
*, const ostream
*);
334 static ostream
* (*__thiscall p_ostrstream_copy_ctor
)(ostream
*, const ostream
*, BOOL
);
335 static ostream
* (*__thiscall p_ostrstream_buffer_ctor
)(ostream
*, char*, int, int, BOOL
);
336 static ostream
* (*__thiscall p_ostrstream_ctor
)(ostream
*, BOOL
);
337 static void (*__thiscall p_ostrstream_dtor
)(ios
*);
338 static void (*__thiscall p_ostrstream_vbase_dtor
)(ostream
*);
339 static ostream
* (*__thiscall p_ostrstream_assign
)(ostream
*, const ostream
*);
340 static int (*__thiscall p_ostrstream_pcount
)(const ostream
*);
343 static ostream
* (*__thiscall p_ofstream_copy_ctor
)(ostream
*, const ostream
*, BOOL
);
344 static ostream
* (*__thiscall p_ofstream_buffer_ctor
)(ostream
*, filedesc
, char*, int, BOOL
);
345 static ostream
* (*__thiscall p_ofstream_fd_ctor
)(ostream
*, filedesc fd
, BOOL virt_init
);
346 static ostream
* (*__thiscall p_ofstream_open_ctor
)(ostream
*, const char *name
, ios_open_mode
, int, BOOL
);
347 static ostream
* (*__thiscall p_ofstream_ctor
)(ostream
*, BOOL
);
348 static void (*__thiscall p_ofstream_dtor
)(ios
*);
349 static void (*__thiscall p_ofstream_vbase_dtor
)(ostream
*);
350 static void (*__thiscall p_ofstream_attach
)(ostream
*, filedesc
);
351 static void (*__thiscall p_ofstream_close
)(ostream
*);
352 static filedesc (*__thiscall p_ofstream_fd
)(ostream
*);
353 static int (*__thiscall p_ofstream_is_open
)(const ostream
*);
354 static void (*__thiscall p_ofstream_open
)(ostream
*, const char*, ios_open_mode
, int);
355 static filebuf
* (*__thiscall p_ofstream_rdbuf
)(const ostream
*);
356 static streambuf
* (*__thiscall p_ofstream_setbuf
)(ostream
*, char*, int);
357 static int (*__thiscall p_ofstream_setmode
)(ostream
*, int);
360 static istream
* (*__thiscall p_istream_copy_ctor
)(istream
*, const istream
*, BOOL
);
361 static istream
* (*__thiscall p_istream_ctor
)(istream
*, BOOL
);
362 static istream
* (*__thiscall p_istream_sb_ctor
)(istream
*, streambuf
*, BOOL
);
363 static void (*__thiscall p_istream_dtor
)(ios
*);
364 static istream
* (*__thiscall p_istream_assign_sb
)(istream
*, streambuf
*);
365 static istream
* (*__thiscall p_istream_assign
)(istream
*, const istream
*);
366 static void (*__thiscall p_istream_vbase_dtor
)(istream
*);
367 static void (*__thiscall p_istream_eatwhite
)(istream
*);
368 static int (*__thiscall p_istream_ipfx
)(istream
*, int);
369 static istream
* (*__thiscall p_istream_get_str_delim
)(istream
*, char*, int, int);
370 static istream
* (*__thiscall p_istream_get_str
)(istream
*, char*, int, char);
371 static int (*__thiscall p_istream_get
)(istream
*);
372 static istream
* (*__thiscall p_istream_get_char
)(istream
*, char*);
373 static istream
* (*__thiscall p_istream_get_sb
)(istream
*, streambuf
*, char);
374 static istream
* (*__thiscall p_istream_getline
)(istream
*, char*, int, char);
375 static istream
* (*__thiscall p_istream_ignore
)(istream
*, int, int);
376 static int (*__thiscall p_istream_peek
)(istream
*);
377 static istream
* (*__thiscall p_istream_putback
)(istream
*, char);
378 static istream
* (*__thiscall p_istream_read
)(istream
*, char*, int);
379 static istream
* (*__thiscall p_istream_seekg
)(istream
*, streampos
);
380 static istream
* (*__thiscall p_istream_seekg_offset
)(istream
*, streamoff
, ios_seek_dir
);
381 static int (*__thiscall p_istream_sync
)(istream
*);
382 static streampos (*__thiscall p_istream_tellg
)(istream
*);
383 static int (*__thiscall p_istream_getint
)(istream
*, char*);
384 static int (*__thiscall p_istream_getdouble
)(istream
*, char*, int);
385 static istream
* (*__thiscall p_istream_read_char
)(istream
*, char*);
386 static istream
* (*__thiscall p_istream_read_str
)(istream
*, char*);
387 static istream
* (*__thiscall p_istream_read_short
)(istream
*, short*);
388 static istream
* (*__thiscall p_istream_read_unsigned_short
)(istream
*, unsigned short*);
389 static istream
* (*__thiscall p_istream_read_int
)(istream
*, int*);
390 static istream
* (*__thiscall p_istream_read_unsigned_int
)(istream
*, unsigned int*);
391 static istream
* (*__thiscall p_istream_read_long
)(istream
*, LONG
*);
392 static istream
* (*__thiscall p_istream_read_unsigned_long
)(istream
*, ULONG
*);
393 static istream
* (*__thiscall p_istream_read_float
)(istream
*, float*);
394 static istream
* (*__thiscall p_istream_read_double
)(istream
*, double*);
395 static istream
* (*__thiscall p_istream_read_long_double
)(istream
*, double*);
396 static istream
* (*__thiscall p_istream_read_streambuf
)(istream
*, streambuf
*);
398 /* istream_withassign */
399 static istream
* (*__thiscall p_istream_withassign_sb_ctor
)(istream
*, streambuf
*, BOOL
);
400 static istream
* (*__thiscall p_istream_withassign_copy_ctor
)(istream
*, const istream
*, BOOL
);
401 static istream
* (*__thiscall p_istream_withassign_ctor
)(istream
*, BOOL
);
402 static void (*__thiscall p_istream_withassign_dtor
)(ios
*);
403 static void (*__thiscall p_istream_withassign_vbase_dtor
)(istream
*);
404 static istream
* (*__thiscall p_istream_withassign_assign_sb
)(istream
*, streambuf
*);
405 static istream
* (*__thiscall p_istream_withassign_assign_is
)(istream
*, const istream
*);
406 static istream
* (*__thiscall p_istream_withassign_assign
)(istream
*, const istream
*);
409 static istream
* (*__thiscall p_istrstream_copy_ctor
)(istream
*, const istream
*, BOOL
);
410 static istream
* (*__thiscall p_istrstream_str_ctor
)(istream
*, char*, BOOL
);
411 static istream
* (*__thiscall p_istrstream_buffer_ctor
)(istream
*, char*, int, BOOL
);
412 static void (*__thiscall p_istrstream_dtor
)(ios
*);
413 static void (*__thiscall p_istrstream_vbase_dtor
)(istream
*);
414 static istream
* (*__thiscall p_istrstream_assign
)(istream
*, const istream
*);
417 static iostream
* (*__thiscall p_iostream_copy_ctor
)(iostream
*, const iostream
*, BOOL
);
418 static iostream
* (*__thiscall p_iostream_sb_ctor
)(iostream
*, streambuf
*, BOOL
);
419 static iostream
* (*__thiscall p_iostream_ctor
)(iostream
*, BOOL
);
420 static void (*__thiscall p_iostream_dtor
)(ios
*);
421 static void (*__thiscall p_iostream_vbase_dtor
)(iostream
*);
422 static iostream
* (*__thiscall p_iostream_assign_sb
)(iostream
*, streambuf
*);
423 static iostream
* (*__thiscall p_iostream_assign
)(iostream
*, const iostream
*);
426 static istream
* (*__thiscall p_ifstream_copy_ctor
)(istream
*, const istream
*, BOOL
);
427 static istream
* (*__thiscall p_ifstream_buffer_ctor
)(istream
*, filedesc
, char*, int, BOOL
);
428 static istream
* (*__thiscall p_ifstream_fd_ctor
)(istream
*, filedesc fd
, BOOL virt_init
);
429 static istream
* (*__thiscall p_ifstream_open_ctor
)(istream
*, const char *name
, ios_open_mode
, int, BOOL
);
430 static istream
* (*__thiscall p_ifstream_ctor
)(istream
*, BOOL
);
431 static void (*__thiscall p_ifstream_dtor
)(ios
*);
432 static void (*__thiscall p_ifstream_vbase_dtor
)(istream
*);
433 static void (*__thiscall p_ifstream_attach
)(istream
*, filedesc
);
434 static void (*__thiscall p_ifstream_close
)(istream
*);
435 static filedesc (*__thiscall p_ifstream_fd
)(istream
*);
436 static int (*__thiscall p_ifstream_is_open
)(const istream
*);
437 static void (*__thiscall p_ifstream_open
)(istream
*, const char*, ios_open_mode
, int);
438 static filebuf
* (*__thiscall p_ifstream_rdbuf
)(const istream
*);
439 static streambuf
* (*__thiscall p_ifstream_setbuf
)(istream
*, char*, int);
440 static int (*__thiscall p_ifstream_setmode
)(istream
*, int);
443 static iostream
* (*__thiscall p_strstream_copy_ctor
)(iostream
*, const iostream
*, BOOL
);
444 static iostream
* (*__thiscall p_strstream_buffer_ctor
)(iostream
*, char*, int, int, BOOL
);
445 static iostream
* (*__thiscall p_strstream_ctor
)(iostream
*, BOOL
);
446 static void (*__thiscall p_strstream_dtor
)(ios
*);
447 static void (*__thiscall p_strstream_vbase_dtor
)(iostream
*);
448 static iostream
* (*__thiscall p_strstream_assign
)(iostream
*, const iostream
*);
451 static iostream
* (*__thiscall p_stdiostream_copy_ctor
)(iostream
*, const iostream
*, BOOL
);
452 static iostream
* (*__thiscall p_stdiostream_file_ctor
)(iostream
*, FILE*, BOOL
);
453 static void (*__thiscall p_stdiostream_dtor
)(ios
*);
454 static void (*__thiscall p_stdiostream_vbase_dtor
)(iostream
*);
455 static iostream
* (*__thiscall p_stdiostream_assign
)(iostream
*, const iostream
*);
458 static iostream
* (*__thiscall p_fstream_open_ctor
)(iostream
*, const char*, ios_open_mode
, int, BOOL
);
459 static void (*__thiscall p_fstream_dtor
)(ios
*);
460 static void (*__thiscall p_fstream_vbase_dtor
)(iostream
*);
463 static void* (*__thiscall p_Iostream_init_ios_ctor
)(void*, ios
*, int);
466 static exception
* (*__thiscall p_exception_ctor
)(exception
*, const char**);
467 static void (*__thiscall p_exception_dtor
)(exception
*);
468 static const char* (*__thiscall p_exception_what
)(exception
*);
470 static logic_error
* (*__thiscall p_logic_error_ctor
)(logic_error
*, const char**);
471 static void (*__thiscall p_logic_error_dtor
)(logic_error
*);
474 static void (*__cdecl p__mtlock
)(CRITICAL_SECTION
*);
475 static void (*__cdecl p__mtunlock
)(CRITICAL_SECTION
*);
477 /* Predefined streams */
478 static istream
*p_cin
;
479 static ostream
*p_cout
, *p_cerr
, *p_clog
;
481 /* Emulate a __thiscall */
484 #include "pshpack1.h"
485 struct thiscall_thunk
487 BYTE pop_eax
; /* popl %eax (ret addr) */
488 BYTE pop_edx
; /* popl %edx (func) */
489 BYTE pop_ecx
; /* popl %ecx (this) */
490 BYTE push_eax
; /* pushl %eax */
491 WORD jmp_edx
; /* jmp *%edx */
495 static void * (WINAPI
*call_thiscall_func1
)( void *func
, void *this );
496 static void * (WINAPI
*call_thiscall_func2
)( void *func
, void *this, const void *a
);
497 static void * (WINAPI
*call_thiscall_func3
)( void *func
, void *this, const void *a
, const void *b
);
498 static void * (WINAPI
*call_thiscall_func4
)( void *func
, void *this, const void *a
, const void *b
,
500 static void * (WINAPI
*call_thiscall_func5
)( void *func
, void *this, const void *a
, const void *b
,
501 const void *c
, const void *d
);
502 static void * (WINAPI
*call_thiscall_func2_ptr_dbl
)( void *func
, void *this, double a
);
503 static void * (WINAPI
*call_thiscall_func2_ptr_flt
)( void *func
, void *this, float a
);
505 static void init_thiscall_thunk(void)
507 struct thiscall_thunk
*thunk
= VirtualAlloc( NULL
, sizeof(*thunk
),
508 MEM_COMMIT
, PAGE_EXECUTE_READWRITE
);
509 thunk
->pop_eax
= 0x58; /* popl %eax */
510 thunk
->pop_edx
= 0x5a; /* popl %edx */
511 thunk
->pop_ecx
= 0x59; /* popl %ecx */
512 thunk
->push_eax
= 0x50; /* pushl %eax */
513 thunk
->jmp_edx
= 0xe2ff; /* jmp *%edx */
514 call_thiscall_func1
= (void *)thunk
;
515 call_thiscall_func2
= (void *)thunk
;
516 call_thiscall_func3
= (void *)thunk
;
517 call_thiscall_func4
= (void *)thunk
;
518 call_thiscall_func5
= (void *)thunk
;
519 call_thiscall_func2_ptr_dbl
= (void *)thunk
;
520 call_thiscall_func2_ptr_flt
= (void *)thunk
;
523 #define call_func1(func,_this) call_thiscall_func1(func,_this)
524 #define call_func2(func,_this,a) call_thiscall_func2(func,_this,(const void*)(a))
525 #define call_func3(func,_this,a,b) call_thiscall_func3(func,_this,(const void*)(a),(const void*)(b))
526 #define call_func4(func,_this,a,b,c) call_thiscall_func4(func,_this,(const void*)(a),(const void*)(b), \
528 #define call_func5(func,_this,a,b,c,d) call_thiscall_func5(func,_this,(const void*)(a),(const void*)(b), \
529 (const void*)(c), (const void *)(d))
530 #define call_func2_ptr_dbl(func,_this,a) call_thiscall_func2_ptr_dbl(func,_this,a)
531 #define call_func2_ptr_flt(func,_this,a) call_thiscall_func2_ptr_flt(func,_this,a)
535 #define init_thiscall_thunk()
536 #define call_func1(func,_this) func(_this)
537 #define call_func2(func,_this,a) func(_this,a)
538 #define call_func3(func,_this,a,b) func(_this,a,b)
539 #define call_func4(func,_this,a,b,c) func(_this,a,b,c)
540 #define call_func5(func,_this,a,b,c,d) func(_this,a,b,c,d)
541 #define call_func2_ptr_dbl call_func2
542 #define call_func2_ptr_flt call_func2
544 #endif /* __i386__ */
546 static HMODULE msvcrt
, msvcirt
;
547 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcirt,y)
548 #define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
549 static BOOL
init(void)
551 msvcrt
= LoadLibraryA("msvcrt.dll");
552 msvcirt
= LoadLibraryA("msvcirt.dll");
554 win_skip("msvcirt.dll not installed\n");
558 if(sizeof(void*) == 8) { /* 64-bit initialization */
559 p_operator_new
= (void*)GetProcAddress(msvcrt
, "??2@YAPEAX_K@Z");
560 p_operator_delete
= (void*)GetProcAddress(msvcrt
, "??3@YAXPEAX@Z");
562 SET(p_streambuf_reserve_ctor
, "??0streambuf@@IEAA@PEADH@Z");
563 SET(p_streambuf_ctor
, "??0streambuf@@IEAA@XZ");
564 SET(p_streambuf_dtor
, "??1streambuf@@UEAA@XZ");
565 SET(p_streambuf_allocate
, "?allocate@streambuf@@IEAAHXZ");
566 SET(p_streambuf_clrclock
, "?clrlock@streambuf@@QEAAXXZ");
567 SET(p_streambuf_doallocate
, "?doallocate@streambuf@@MEAAHXZ");
568 SET(p_streambuf_gbump
, "?gbump@streambuf@@IEAAXH@Z");
569 SET(p_streambuf_in_avail
, "?in_avail@streambuf@@QEBAHXZ");
570 SET(p_streambuf_lock
, "?lock@streambuf@@QEAAXXZ");
571 SET(p_streambuf_out_waiting
, "?out_waiting@streambuf@@QEBAHXZ");
572 SET(p_streambuf_pbackfail
, "?pbackfail@streambuf@@UEAAHH@Z");
573 SET(p_streambuf_pbump
, "?pbump@streambuf@@IEAAXH@Z");
574 SET(p_streambuf_sbumpc
, "?sbumpc@streambuf@@QEAAHXZ");
575 SET(p_streambuf_setb
, "?setb@streambuf@@IEAAXPEAD0H@Z");
576 SET(p_streambuf_setbuf
, "?setbuf@streambuf@@UEAAPEAV1@PEADH@Z");
577 SET(p_streambuf_setlock
, "?setlock@streambuf@@QEAAXXZ");
578 SET(p_streambuf_sgetc
, "?sgetc@streambuf@@QEAAHXZ");
579 SET(p_streambuf_snextc
, "?snextc@streambuf@@QEAAHXZ");
580 SET(p_streambuf_sputc
, "?sputc@streambuf@@QEAAHH@Z");
581 SET(p_streambuf_stossc
, "?stossc@streambuf@@QEAAXXZ");
582 SET(p_streambuf_sync
, "?sync@streambuf@@UEAAHXZ");
583 SET(p_streambuf_unlock
, "?unlock@streambuf@@QEAAXXZ");
584 SET(p_streambuf_xsgetn
, "?xsgetn@streambuf@@UEAAHPEADH@Z");
585 SET(p_streambuf_xsputn
, "?xsputn@streambuf@@UEAAHPEBDH@Z");
587 SET(p_filebuf_fd_ctor
, "??0filebuf@@QEAA@H@Z");
588 SET(p_filebuf_fd_reserve_ctor
, "??0filebuf@@QEAA@HPEADH@Z");
589 SET(p_filebuf_ctor
, "??0filebuf@@QEAA@XZ");
590 SET(p_filebuf_dtor
, "??1filebuf@@UEAA@XZ");
591 SET(p_filebuf_attach
, "?attach@filebuf@@QEAAPEAV1@H@Z");
592 SET(p_filebuf_open
, "?open@filebuf@@QEAAPEAV1@PEBDHH@Z");
593 SET(p_filebuf_close
, "?close@filebuf@@QEAAPEAV1@XZ");
594 SET(p_filebuf_setmode
, "?setmode@filebuf@@QEAAHH@Z");
595 SET(p_filebuf_setbuf
, "?setbuf@filebuf@@UEAAPEAVstreambuf@@PEADH@Z");
596 SET(p_filebuf_sync
, "?sync@filebuf@@UEAAHXZ");
597 SET(p_filebuf_overflow
, "?overflow@filebuf@@UEAAHH@Z");
598 SET(p_filebuf_underflow
, "?underflow@filebuf@@UEAAHXZ");
599 SET(p_filebuf_seekoff
, "?seekoff@filebuf@@UEAAJJW4seek_dir@ios@@H@Z");
600 SET(p_filebuf_is_open
, "?is_open@filebuf@@QEBAHXZ");
602 SET(p_strstreambuf_dynamic_ctor
, "??0strstreambuf@@QEAA@H@Z");
603 SET(p_strstreambuf_funcs_ctor
, "??0strstreambuf@@QEAA@P6APEAXJ@ZP6AXPEAX@Z@Z");
604 SET(p_strstreambuf_buffer_ctor
, "??0strstreambuf@@QEAA@PEADH0@Z");
605 SET(p_strstreambuf_ubuffer_ctor
, "??0strstreambuf@@QEAA@PEAEH0@Z");
606 SET(p_strstreambuf_ctor
, "??0strstreambuf@@QEAA@XZ");
607 SET(p_strstreambuf_dtor
, "??1strstreambuf@@UEAA@XZ");
608 SET(p_strstreambuf_doallocate
, "?doallocate@strstreambuf@@MEAAHXZ");
609 SET(p_strstreambuf_freeze
, "?freeze@strstreambuf@@QEAAXH@Z");
610 SET(p_strstreambuf_overflow
, "?overflow@strstreambuf@@UEAAHH@Z");
611 SET(p_strstreambuf_seekoff
, "?seekoff@strstreambuf@@UEAAJJW4seek_dir@ios@@H@Z");
612 SET(p_strstreambuf_setbuf
, "?setbuf@strstreambuf@@UEAAPEAVstreambuf@@PEADH@Z");
613 SET(p_strstreambuf_underflow
, "?underflow@strstreambuf@@UEAAHXZ");
615 SET(p_stdiobuf_file_ctor
, "??0stdiobuf@@QEAA@PEAU_iobuf@@@Z");
616 SET(p_stdiobuf_dtor
, "??1stdiobuf@@UEAA@XZ");
617 SET(p_stdiobuf_overflow
, "?overflow@stdiobuf@@UEAAHH@Z");
618 SET(p_stdiobuf_pbackfail
, "?pbackfail@stdiobuf@@UEAAHH@Z");
619 SET(p_stdiobuf_seekoff
, "?seekoff@stdiobuf@@UEAAJJW4seek_dir@ios@@H@Z");
620 SET(p_stdiobuf_setrwbuf
, "?setrwbuf@stdiobuf@@QEAAHHH@Z");
621 SET(p_stdiobuf_sync
, "?sync@stdiobuf@@UEAAHXZ");
622 SET(p_stdiobuf_underflow
, "?underflow@stdiobuf@@UEAAHXZ");
624 SET(p_ios_copy_ctor
, "??0ios@@IEAA@AEBV0@@Z");
625 SET(p_ios_ctor
, "??0ios@@IEAA@XZ");
626 SET(p_ios_sb_ctor
, "??0ios@@QEAA@PEAVstreambuf@@@Z");
627 SET(p_ios_assign
, "??4ios@@IEAAAEAV0@AEBV0@@Z");
628 SET(p_ios_init
, "?init@ios@@IEAAXPEAVstreambuf@@@Z");
629 SET(p_ios_dtor
, "??1ios@@UEAA@XZ");
630 SET(p_ios_clrlock
, "?clrlock@ios@@QEAAXXZ");
631 SET(p_ios_setlock
, "?setlock@ios@@QEAAXXZ");
632 SET(p_ios_lock
, "?lock@ios@@QEAAXXZ");
633 SET(p_ios_unlock
, "?unlock@ios@@QEAAXXZ");
634 SET(p_ios_lockbuf
, "?lockbuf@ios@@QEAAXXZ");
635 SET(p_ios_unlockbuf
, "?unlockbuf@ios@@QEAAXXZ");
636 SET(p_ios_flags_set
, "?flags@ios@@QEAAJJ@Z");
637 SET(p_ios_flags_get
, "?flags@ios@@QEBAJXZ");
638 SET(p_ios_setf
, "?setf@ios@@QEAAJJ@Z");
639 SET(p_ios_setf_mask
, "?setf@ios@@QEAAJJJ@Z");
640 SET(p_ios_unsetf
, "?unsetf@ios@@QEAAJJ@Z");
641 SET(p_ios_good
, "?good@ios@@QEBAHXZ");
642 SET(p_ios_bad
, "?bad@ios@@QEBAHXZ");
643 SET(p_ios_eof
, "?eof@ios@@QEBAHXZ");
644 SET(p_ios_fail
, "?fail@ios@@QEBAHXZ");
645 SET(p_ios_clear
, "?clear@ios@@QEAAXH@Z");
646 SET(p_ios_iword
, "?iword@ios@@QEBAAEAJH@Z");
647 SET(p_ios_pword
, "?pword@ios@@QEBAAEAPEAXH@Z");
649 SET(p_ostream_copy_ctor
, "??0ostream@@IEAA@AEBV0@@Z");
650 SET(p_ostream_sb_ctor
, "??0ostream@@QEAA@PEAVstreambuf@@@Z");
651 SET(p_ostream_ctor
, "??0ostream@@IEAA@XZ");
652 SET(p_ostream_dtor
, "??1ostream@@UEAA@XZ");
653 SET(p_ostream_assign
, "??4ostream@@IEAAAEAV0@AEBV0@@Z");
654 SET(p_ostream_assign_sb
, "??4ostream@@IEAAAEAV0@PEAVstreambuf@@@Z");
655 SET(p_ostream_vbase_dtor
, "??_Dostream@@QEAAXXZ");
656 SET(p_ostream_flush
, "?flush@ostream@@QEAAAEAV1@XZ");
657 SET(p_ostream_opfx
, "?opfx@ostream@@QEAAHXZ");
658 SET(p_ostream_osfx
, "?osfx@ostream@@QEAAXXZ");
659 SET(p_ostream_put_char
, "?put@ostream@@QEAAAEAV1@D@Z");
660 SET(p_ostream_write_char
, "?write@ostream@@QEAAAEAV1@PEBDH@Z");
661 SET(p_ostream_seekp_offset
, "?seekp@ostream@@QEAAAEAV1@JW4seek_dir@ios@@@Z");
662 SET(p_ostream_seekp
, "?seekp@ostream@@QEAAAEAV1@J@Z");
663 SET(p_ostream_tellp
, "?tellp@ostream@@QEAAJXZ");
664 SET(p_ostream_writepad
, "?writepad@ostream@@AEAAAEAV1@PEBD0@Z");
665 SET(p_ostream_print_char
, "??6ostream@@QEAAAEAV0@D@Z");
666 SET(p_ostream_print_str
, "??6ostream@@QEAAAEAV0@PEBD@Z");
667 SET(p_ostream_print_int
, "??6ostream@@QEAAAEAV0@H@Z");
668 SET(p_ostream_print_float
, "??6ostream@@QEAAAEAV0@M@Z");
669 SET(p_ostream_print_double
, "??6ostream@@QEAAAEAV0@N@Z");
670 SET(p_ostream_print_ptr
, "??6ostream@@QEAAAEAV0@PEBX@Z");
671 SET(p_ostream_print_streambuf
, "??6ostream@@QEAAAEAV0@PEAVstreambuf@@@Z");
673 SET(p_ostream_withassign_sb_ctor
, "??0ostream_withassign@@QEAA@PEAVstreambuf@@@Z");
674 SET(p_ostream_withassign_copy_ctor
, "??0ostream_withassign@@QEAA@AEBV0@@Z");
675 SET(p_ostream_withassign_ctor
, "??0ostream_withassign@@QEAA@XZ");
676 SET(p_ostream_withassign_dtor
, "??1ostream_withassign@@UEAA@XZ");
677 SET(p_ostream_withassign_vbase_dtor
, "??_Dostream_withassign@@QEAAXXZ");
678 SET(p_ostream_withassign_assign_sb
, "??4ostream_withassign@@QEAAAEAVostream@@PEAVstreambuf@@@Z");
679 SET(p_ostream_withassign_assign_os
, "??4ostream_withassign@@QEAAAEAVostream@@AEBV1@@Z");
680 SET(p_ostream_withassign_assign
, "??4ostream_withassign@@QEAAAEAV0@AEBV0@@Z");
682 SET(p_ostrstream_copy_ctor
, "??0ostrstream@@QEAA@AEBV0@@Z");
683 SET(p_ostrstream_buffer_ctor
, "??0ostrstream@@QEAA@PEADHH@Z");
684 SET(p_ostrstream_ctor
, "??0ostrstream@@QEAA@XZ");
685 SET(p_ostrstream_dtor
, "??1ostrstream@@UEAA@XZ");
686 SET(p_ostrstream_vbase_dtor
, "??_Dostrstream@@QEAAXXZ");
687 SET(p_ostrstream_assign
, "??4ostrstream@@QEAAAEAV0@AEBV0@@Z");
688 SET(p_ostrstream_pcount
, "?pcount@ostrstream@@QEBAHXZ");
690 SET(p_ofstream_copy_ctor
, "??0ofstream@@QEAA@AEBV0@@Z");
691 SET(p_ofstream_buffer_ctor
, "??0ofstream@@QEAA@HPEADH@Z");
692 SET(p_ofstream_fd_ctor
, "??0ofstream@@QEAA@H@Z");
693 SET(p_ofstream_open_ctor
, "??0ofstream@@QEAA@PEBDHH@Z");
694 SET(p_ofstream_ctor
, "??0ofstream@@QEAA@XZ");
695 SET(p_ofstream_dtor
, "??1ofstream@@UEAA@XZ");
696 SET(p_ofstream_vbase_dtor
, "??_Dofstream@@QEAAXXZ");
697 SET(p_ofstream_attach
, "?attach@ofstream@@QEAAXH@Z");
698 SET(p_ofstream_close
, "?close@ofstream@@QEAAXXZ");
699 SET(p_ofstream_fd
, "?fd@ofstream@@QEBAHXZ");
700 SET(p_ofstream_is_open
, "?is_open@ofstream@@QEBAHXZ");
701 SET(p_ofstream_open
, "?open@ofstream@@QEAAXPEBDHH@Z");
702 SET(p_ofstream_rdbuf
, "?rdbuf@ofstream@@QEBAPEAVfilebuf@@XZ");
703 SET(p_ofstream_setbuf
, "?setbuf@ofstream@@QEAAPEAVstreambuf@@PEADH@Z");
704 SET(p_ofstream_setmode
, "?setmode@ofstream@@QEAAHH@Z");
706 SET(p_istream_copy_ctor
, "??0istream@@IEAA@AEBV0@@Z");
707 SET(p_istream_ctor
, "??0istream@@IEAA@XZ");
708 SET(p_istream_sb_ctor
, "??0istream@@QEAA@PEAVstreambuf@@@Z");
709 SET(p_istream_dtor
, "??1istream@@UEAA@XZ");
710 SET(p_istream_assign_sb
, "??4istream@@IEAAAEAV0@PEAVstreambuf@@@Z");
711 SET(p_istream_assign
, "??4istream@@IEAAAEAV0@AEBV0@@Z");
712 SET(p_istream_vbase_dtor
, "??_Distream@@QEAAXXZ");
713 SET(p_istream_eatwhite
, "?eatwhite@istream@@QEAAXXZ");
714 SET(p_istream_ipfx
, "?ipfx@istream@@QEAAHH@Z");
715 SET(p_istream_get_str_delim
, "?get@istream@@IEAAAEAV1@PEADHH@Z");
716 SET(p_istream_get_str
, "?get@istream@@QEAAAEAV1@PEADHD@Z");
717 SET(p_istream_get
, "?get@istream@@QEAAHXZ");
718 SET(p_istream_get_char
, "?get@istream@@QEAAAEAV1@AEAD@Z");
719 SET(p_istream_get_sb
, "?get@istream@@QEAAAEAV1@AEAVstreambuf@@D@Z");
720 SET(p_istream_getline
, "?getline@istream@@QEAAAEAV1@PEADHD@Z");
721 SET(p_istream_ignore
, "?ignore@istream@@QEAAAEAV1@HH@Z");
722 SET(p_istream_peek
, "?peek@istream@@QEAAHXZ");
723 SET(p_istream_putback
, "?putback@istream@@QEAAAEAV1@D@Z");
724 SET(p_istream_read
, "?read@istream@@QEAAAEAV1@PEADH@Z");
725 SET(p_istream_seekg
, "?seekg@istream@@QEAAAEAV1@J@Z");
726 SET(p_istream_seekg_offset
, "?seekg@istream@@QEAAAEAV1@JW4seek_dir@ios@@@Z");
727 SET(p_istream_sync
, "?sync@istream@@QEAAHXZ");
728 SET(p_istream_tellg
, "?tellg@istream@@QEAAJXZ");
729 SET(p_istream_getint
, "?getint@istream@@AEAAHPEAD@Z");
730 SET(p_istream_getdouble
, "?getdouble@istream@@AEAAHPEADH@Z");
731 SET(p_istream_read_char
, "??5istream@@QEAAAEAV0@AEAD@Z");
732 SET(p_istream_read_str
, "??5istream@@QEAAAEAV0@PEAD@Z");
733 SET(p_istream_read_short
, "??5istream@@QEAAAEAV0@AEAF@Z");
734 SET(p_istream_read_unsigned_short
, "??5istream@@QEAAAEAV0@AEAG@Z");
735 SET(p_istream_read_int
, "??5istream@@QEAAAEAV0@AEAH@Z");
736 SET(p_istream_read_unsigned_int
, "??5istream@@QEAAAEAV0@AEAI@Z");
737 SET(p_istream_read_long
, "??5istream@@QEAAAEAV0@AEAJ@Z");
738 SET(p_istream_read_unsigned_long
, "??5istream@@QEAAAEAV0@AEAK@Z");
739 SET(p_istream_read_float
, "??5istream@@QEAAAEAV0@AEAM@Z");
740 SET(p_istream_read_double
, "??5istream@@QEAAAEAV0@AEAN@Z");
741 SET(p_istream_read_long_double
, "??5istream@@QEAAAEAV0@AEAO@Z");
742 SET(p_istream_read_streambuf
, "??5istream@@QEAAAEAV0@PEAVstreambuf@@@Z");
744 SET(p_istream_withassign_sb_ctor
, "??0istream_withassign@@QEAA@PEAVstreambuf@@@Z");
745 SET(p_istream_withassign_copy_ctor
, "??0istream_withassign@@QEAA@AEBV0@@Z");
746 SET(p_istream_withassign_ctor
, "??0istream_withassign@@QEAA@XZ");
747 SET(p_istream_withassign_dtor
, "??1ostream_withassign@@UEAA@XZ");
748 SET(p_istream_withassign_vbase_dtor
, "??_Distream_withassign@@QEAAXXZ");
749 SET(p_istream_withassign_assign_sb
, "??4istream_withassign@@QEAAAEAVistream@@PEAVstreambuf@@@Z");
750 SET(p_istream_withassign_assign_is
, "??4istream_withassign@@QEAAAEAVistream@@AEBV1@@Z");
751 SET(p_istream_withassign_assign
, "??4istream_withassign@@QEAAAEAV0@AEBV0@@Z");
753 SET(p_istrstream_copy_ctor
, "??0istrstream@@QEAA@AEBV0@@Z");
754 SET(p_istrstream_str_ctor
, "??0istrstream@@QEAA@PEAD@Z");
755 SET(p_istrstream_buffer_ctor
, "??0istrstream@@QEAA@PEADH@Z");
756 SET(p_istrstream_dtor
, "??1istrstream@@UEAA@XZ");
757 SET(p_istrstream_vbase_dtor
, "??_Distrstream@@QEAAXXZ");
758 SET(p_istrstream_assign
, "??4istrstream@@QEAAAEAV0@AEBV0@@Z");
760 SET(p_iostream_copy_ctor
, "??0iostream@@IEAA@AEBV0@@Z");
761 SET(p_iostream_sb_ctor
, "??0iostream@@QEAA@PEAVstreambuf@@@Z");
762 SET(p_iostream_ctor
, "??0iostream@@IEAA@XZ");
763 SET(p_iostream_dtor
, "??1iostream@@UEAA@XZ");
764 SET(p_iostream_vbase_dtor
, "??_Diostream@@QEAAXXZ");
765 SET(p_iostream_assign_sb
, "??4iostream@@IEAAAEAV0@PEAVstreambuf@@@Z");
766 SET(p_iostream_assign
, "??4iostream@@IEAAAEAV0@AEAV0@@Z");
768 SET(p_ifstream_copy_ctor
, "??0ifstream@@QEAA@AEBV0@@Z");
769 SET(p_ifstream_buffer_ctor
, "??0ifstream@@QEAA@HPEADH@Z");
770 SET(p_ifstream_fd_ctor
, "??0ifstream@@QEAA@H@Z");
771 SET(p_ifstream_open_ctor
, "??0ifstream@@QEAA@PEBDHH@Z");
772 SET(p_ifstream_ctor
, "??0ifstream@@QEAA@XZ");
773 SET(p_ifstream_dtor
, "??1ifstream@@UEAA@XZ");
774 SET(p_ifstream_vbase_dtor
, "??_Difstream@@QEAAXXZ");
775 SET(p_ifstream_attach
, "?attach@ifstream@@QEAAXH@Z");
776 SET(p_ifstream_close
, "?close@ifstream@@QEAAXXZ");
777 SET(p_ifstream_fd
, "?fd@ifstream@@QEBAHXZ");
778 SET(p_ifstream_is_open
, "?is_open@ifstream@@QEBAHXZ");
779 SET(p_ifstream_open
, "?open@ifstream@@QEAAXPEBDHH@Z");
780 SET(p_ifstream_rdbuf
, "?rdbuf@ifstream@@QEBAPEAVfilebuf@@XZ");
781 SET(p_ifstream_setbuf
, "?setbuf@ifstream@@QEAAPEAVstreambuf@@PEADH@Z");
782 SET(p_ifstream_setmode
, "?setmode@ifstream@@QEAAHH@Z");
784 SET(p_strstream_copy_ctor
, "??0strstream@@QEAA@AEBV0@@Z");
785 SET(p_strstream_buffer_ctor
, "??0strstream@@QEAA@PEADHH@Z");
786 SET(p_strstream_ctor
, "??0strstream@@QEAA@XZ");
787 SET(p_strstream_dtor
, "??1strstream@@UEAA@XZ");
788 SET(p_strstream_vbase_dtor
, "??_Dstrstream@@QEAAXXZ");
789 SET(p_strstream_assign
, "??4strstream@@QEAAAEAV0@AEAV0@@Z");
791 SET(p_stdiostream_copy_ctor
, "??0stdiostream@@QEAA@AEBV0@@Z");
792 SET(p_stdiostream_file_ctor
, "??0stdiostream@@QEAA@PEAU_iobuf@@@Z");
793 SET(p_stdiostream_dtor
, "??1stdiostream@@UEAA@XZ");
794 SET(p_stdiostream_vbase_dtor
, "??_Dstdiostream@@QEAAXXZ");
795 SET(p_stdiostream_assign
, "??4stdiostream@@QEAAAEAV0@AEAV0@@Z");
797 SET(p_fstream_open_ctor
, "??0fstream@@QEAA@PEBDHH@Z");
798 SET(p_fstream_dtor
, "??1fstream@@UEAA@XZ");
799 SET(p_fstream_vbase_dtor
, "??_Dfstream@@QEAAXXZ");
801 SET(p_Iostream_init_ios_ctor
, "??0Iostream_init@@QEAA@AEAVios@@H@Z");
803 SET(p_exception_ctor
, "??0exception@@QEAA@AEBQEBD@Z");
804 SET(p_exception_dtor
, "??1exception@@UEAA@XZ");
805 SET(p_exception_what
, "?what@exception@@UEBAPEBDXZ");
807 SET(p_logic_error_ctor
, "??0logic_error@@QEAA@AEBQEBD@Z");
808 SET(p_logic_error_dtor
, "??1logic_error@@UEAA@XZ");
810 p_operator_new
= (void*)GetProcAddress(msvcrt
, "??2@YAPAXI@Z");
811 p_operator_delete
= (void*)GetProcAddress(msvcrt
, "??3@YAXPAX@Z");
813 SET(p_streambuf_reserve_ctor
, "??0streambuf@@IAE@PADH@Z");
814 SET(p_streambuf_ctor
, "??0streambuf@@IAE@XZ");
815 SET(p_streambuf_dtor
, "??1streambuf@@UAE@XZ");
816 SET(p_streambuf_allocate
, "?allocate@streambuf@@IAEHXZ");
817 SET(p_streambuf_clrclock
, "?clrlock@streambuf@@QAEXXZ");
818 SET(p_streambuf_doallocate
, "?doallocate@streambuf@@MAEHXZ");
819 SET(p_streambuf_gbump
, "?gbump@streambuf@@IAEXH@Z");
820 SET(p_streambuf_in_avail
, "?in_avail@streambuf@@QBEHXZ");
821 SET(p_streambuf_lock
, "?lock@streambuf@@QAEXXZ");
822 SET(p_streambuf_out_waiting
, "?out_waiting@streambuf@@QBEHXZ");
823 SET(p_streambuf_pbackfail
, "?pbackfail@streambuf@@UAEHH@Z");
824 SET(p_streambuf_pbump
, "?pbump@streambuf@@IAEXH@Z");
825 SET(p_streambuf_sbumpc
, "?sbumpc@streambuf@@QAEHXZ");
826 SET(p_streambuf_setb
, "?setb@streambuf@@IAEXPAD0H@Z");
827 SET(p_streambuf_setbuf
, "?setbuf@streambuf@@UAEPAV1@PADH@Z");
828 SET(p_streambuf_setlock
, "?setlock@streambuf@@QAEXXZ");
829 SET(p_streambuf_sgetc
, "?sgetc@streambuf@@QAEHXZ");
830 SET(p_streambuf_snextc
, "?snextc@streambuf@@QAEHXZ");
831 SET(p_streambuf_sputc
, "?sputc@streambuf@@QAEHH@Z");
832 SET(p_streambuf_stossc
, "?stossc@streambuf@@QAEXXZ");
833 SET(p_streambuf_sync
, "?sync@streambuf@@UAEHXZ");
834 SET(p_streambuf_unlock
, "?unlock@streambuf@@QAEXXZ");
835 SET(p_streambuf_xsgetn
, "?xsgetn@streambuf@@UAEHPADH@Z");
836 SET(p_streambuf_xsputn
, "?xsputn@streambuf@@UAEHPBDH@Z");
838 SET(p_filebuf_fd_ctor
, "??0filebuf@@QAE@H@Z");
839 SET(p_filebuf_fd_reserve_ctor
, "??0filebuf@@QAE@HPADH@Z");
840 SET(p_filebuf_ctor
, "??0filebuf@@QAE@XZ");
841 SET(p_filebuf_dtor
, "??1filebuf@@UAE@XZ");
842 SET(p_filebuf_attach
, "?attach@filebuf@@QAEPAV1@H@Z");
843 SET(p_filebuf_open
, "?open@filebuf@@QAEPAV1@PBDHH@Z");
844 SET(p_filebuf_close
, "?close@filebuf@@QAEPAV1@XZ");
845 SET(p_filebuf_setmode
, "?setmode@filebuf@@QAEHH@Z");
846 SET(p_filebuf_setbuf
, "?setbuf@filebuf@@UAEPAVstreambuf@@PADH@Z");
847 SET(p_filebuf_sync
, "?sync@filebuf@@UAEHXZ");
848 SET(p_filebuf_overflow
, "?overflow@filebuf@@UAEHH@Z");
849 SET(p_filebuf_underflow
, "?underflow@filebuf@@UAEHXZ");
850 SET(p_filebuf_seekoff
, "?seekoff@filebuf@@UAEJJW4seek_dir@ios@@H@Z");
851 SET(p_filebuf_is_open
, "?is_open@filebuf@@QBEHXZ");
853 SET(p_strstreambuf_dynamic_ctor
, "??0strstreambuf@@QAE@H@Z");
854 SET(p_strstreambuf_funcs_ctor
, "??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z");
855 SET(p_strstreambuf_buffer_ctor
, "??0strstreambuf@@QAE@PADH0@Z");
856 SET(p_strstreambuf_ubuffer_ctor
, "??0strstreambuf@@QAE@PAEH0@Z");
857 SET(p_strstreambuf_ctor
, "??0strstreambuf@@QAE@XZ");
858 SET(p_strstreambuf_dtor
, "??1strstreambuf@@UAE@XZ");
859 SET(p_strstreambuf_doallocate
, "?doallocate@strstreambuf@@MAEHXZ");
860 SET(p_strstreambuf_freeze
, "?freeze@strstreambuf@@QAEXH@Z");
861 SET(p_strstreambuf_overflow
, "?overflow@strstreambuf@@UAEHH@Z");
862 SET(p_strstreambuf_seekoff
, "?seekoff@strstreambuf@@UAEJJW4seek_dir@ios@@H@Z");
863 SET(p_strstreambuf_setbuf
, "?setbuf@strstreambuf@@UAEPAVstreambuf@@PADH@Z");
864 SET(p_strstreambuf_underflow
, "?underflow@strstreambuf@@UAEHXZ");
866 SET(p_stdiobuf_file_ctor
, "??0stdiobuf@@QAE@PAU_iobuf@@@Z");
867 SET(p_stdiobuf_dtor
, "??1stdiobuf@@UAE@XZ");
868 SET(p_stdiobuf_overflow
, "?overflow@stdiobuf@@UAEHH@Z");
869 SET(p_stdiobuf_pbackfail
, "?pbackfail@stdiobuf@@UAEHH@Z");
870 SET(p_stdiobuf_seekoff
, "?seekoff@stdiobuf@@UAEJJW4seek_dir@ios@@H@Z");
871 SET(p_stdiobuf_setrwbuf
, "?setrwbuf@stdiobuf@@QAEHHH@Z");
872 SET(p_stdiobuf_sync
, "?sync@stdiobuf@@UAEHXZ");
873 SET(p_stdiobuf_underflow
, "?underflow@stdiobuf@@UAEHXZ");
875 SET(p_ios_copy_ctor
, "??0ios@@IAE@ABV0@@Z");
876 SET(p_ios_ctor
, "??0ios@@IAE@XZ");
877 SET(p_ios_sb_ctor
, "??0ios@@QAE@PAVstreambuf@@@Z");
878 SET(p_ios_assign
, "??4ios@@IAEAAV0@ABV0@@Z");
879 SET(p_ios_init
, "?init@ios@@IAEXPAVstreambuf@@@Z");
880 SET(p_ios_dtor
, "??1ios@@UAE@XZ");
881 SET(p_ios_clrlock
, "?clrlock@ios@@QAAXXZ");
882 SET(p_ios_setlock
, "?setlock@ios@@QAAXXZ");
883 SET(p_ios_lock
, "?lock@ios@@QAAXXZ");
884 SET(p_ios_unlock
, "?unlock@ios@@QAAXXZ");
885 SET(p_ios_lockbuf
, "?lockbuf@ios@@QAAXXZ");
886 SET(p_ios_unlockbuf
, "?unlockbuf@ios@@QAAXXZ");
887 SET(p_ios_flags_set
, "?flags@ios@@QAEJJ@Z");
888 SET(p_ios_flags_get
, "?flags@ios@@QBEJXZ");
889 SET(p_ios_setf
, "?setf@ios@@QAEJJ@Z");
890 SET(p_ios_setf_mask
, "?setf@ios@@QAEJJJ@Z");
891 SET(p_ios_unsetf
, "?unsetf@ios@@QAEJJ@Z");
892 SET(p_ios_good
, "?good@ios@@QBEHXZ");
893 SET(p_ios_bad
, "?bad@ios@@QBEHXZ");
894 SET(p_ios_eof
, "?eof@ios@@QBEHXZ");
895 SET(p_ios_fail
, "?fail@ios@@QBEHXZ");
896 SET(p_ios_clear
, "?clear@ios@@QAEXH@Z");
897 SET(p_ios_iword
, "?iword@ios@@QBEAAJH@Z");
898 SET(p_ios_pword
, "?pword@ios@@QBEAAPAXH@Z");
900 SET(p_ostream_copy_ctor
, "??0ostream@@IAE@ABV0@@Z");
901 SET(p_ostream_sb_ctor
, "??0ostream@@QAE@PAVstreambuf@@@Z");
902 SET(p_ostream_ctor
, "??0ostream@@IAE@XZ");
903 SET(p_ostream_dtor
, "??1ostream@@UAE@XZ");
904 SET(p_ostream_assign
, "??4ostream@@IAEAAV0@ABV0@@Z");
905 SET(p_ostream_assign_sb
, "??4ostream@@IAEAAV0@PAVstreambuf@@@Z");
906 SET(p_ostream_vbase_dtor
, "??_Dostream@@QAEXXZ");
907 SET(p_ostream_flush
, "?flush@ostream@@QAEAAV1@XZ");
908 SET(p_ostream_opfx
, "?opfx@ostream@@QAEHXZ");
909 SET(p_ostream_osfx
, "?osfx@ostream@@QAEXXZ");
910 SET(p_ostream_put_char
, "?put@ostream@@QAEAAV1@D@Z");
911 SET(p_ostream_write_char
, "?write@ostream@@QAEAAV1@PBDH@Z");
912 SET(p_ostream_seekp_offset
, "?seekp@ostream@@QAEAAV1@JW4seek_dir@ios@@@Z");
913 SET(p_ostream_seekp
, "?seekp@ostream@@QAEAAV1@J@Z");
914 SET(p_ostream_tellp
, "?tellp@ostream@@QAEJXZ");
915 SET(p_ostream_writepad
, "?writepad@ostream@@AAEAAV1@PBD0@Z");
916 SET(p_ostream_print_char
, "??6ostream@@QAEAAV0@D@Z");
917 SET(p_ostream_print_str
, "??6ostream@@QAEAAV0@PBD@Z");
918 SET(p_ostream_print_int
, "??6ostream@@QAEAAV0@H@Z");
919 SET(p_ostream_print_float
, "??6ostream@@QAEAAV0@M@Z");
920 SET(p_ostream_print_double
, "??6ostream@@QAEAAV0@N@Z");
921 SET(p_ostream_print_ptr
, "??6ostream@@QAEAAV0@PBX@Z");
922 SET(p_ostream_print_streambuf
, "??6ostream@@QAEAAV0@PAVstreambuf@@@Z");
924 SET(p_ostream_withassign_sb_ctor
, "??0ostream_withassign@@QAE@PAVstreambuf@@@Z");
925 SET(p_ostream_withassign_copy_ctor
, "??0ostream_withassign@@QAE@ABV0@@Z");
926 SET(p_ostream_withassign_ctor
, "??0ostream_withassign@@QAE@XZ");
927 SET(p_ostream_withassign_dtor
, "??1ostream_withassign@@UAE@XZ");
928 SET(p_ostream_withassign_vbase_dtor
, "??_Dostream_withassign@@QAEXXZ");
929 SET(p_ostream_withassign_assign_sb
, "??4ostream_withassign@@QAEAAVostream@@PAVstreambuf@@@Z");
930 SET(p_ostream_withassign_assign_os
, "??4ostream_withassign@@QAEAAVostream@@ABV1@@Z");
931 SET(p_ostream_withassign_assign
, "??4ostream_withassign@@QAEAAV0@ABV0@@Z");
933 SET(p_ostrstream_copy_ctor
, "??0ostrstream@@QAE@ABV0@@Z");
934 SET(p_ostrstream_buffer_ctor
, "??0ostrstream@@QAE@PADHH@Z");
935 SET(p_ostrstream_ctor
, "??0ostrstream@@QAE@XZ");
936 SET(p_ostrstream_dtor
, "??1ostrstream@@UAE@XZ");
937 SET(p_ostrstream_vbase_dtor
, "??_Dostrstream@@QAEXXZ");
938 SET(p_ostrstream_assign
, "??4ostrstream@@QAEAAV0@ABV0@@Z");
939 SET(p_ostrstream_pcount
, "?pcount@ostrstream@@QBEHXZ");
941 SET(p_ofstream_copy_ctor
, "??0ofstream@@QAE@ABV0@@Z");
942 SET(p_ofstream_fd_ctor
, "??0ofstream@@QAE@H@Z");
943 SET(p_ofstream_buffer_ctor
, "??0ofstream@@QAE@HPADH@Z");
944 SET(p_ofstream_open_ctor
, "??0ofstream@@QAE@PBDHH@Z");
945 SET(p_ofstream_ctor
, "??0ofstream@@QAE@XZ");
946 SET(p_ofstream_dtor
, "??1ofstream@@UAE@XZ");
947 SET(p_ofstream_vbase_dtor
, "??_Dofstream@@QAEXXZ");
948 SET(p_ofstream_attach
, "?attach@ofstream@@QAEXH@Z");
949 SET(p_ofstream_close
, "?close@ofstream@@QAEXXZ");
950 SET(p_ofstream_fd
, "?fd@ofstream@@QBEHXZ");
951 SET(p_ofstream_is_open
, "?is_open@ofstream@@QBEHXZ");
952 SET(p_ofstream_open
, "?open@ofstream@@QAEXPBDHH@Z");
953 SET(p_ofstream_rdbuf
, "?rdbuf@ofstream@@QBEPAVfilebuf@@XZ");
954 SET(p_ofstream_setbuf
, "?setbuf@ofstream@@QAEPAVstreambuf@@PADH@Z");
955 SET(p_ofstream_setmode
, "?setmode@ofstream@@QAEHH@Z");
957 SET(p_istream_copy_ctor
, "??0istream@@IAE@ABV0@@Z");
958 SET(p_istream_ctor
, "??0istream@@IAE@XZ");
959 SET(p_istream_sb_ctor
, "??0istream@@QAE@PAVstreambuf@@@Z");
960 SET(p_istream_dtor
, "??1istream@@UAE@XZ");
961 SET(p_istream_assign_sb
, "??4istream@@IAEAAV0@PAVstreambuf@@@Z");
962 SET(p_istream_assign
, "??4istream@@IAEAAV0@ABV0@@Z");
963 SET(p_istream_vbase_dtor
, "??_Distream@@QAEXXZ");
964 SET(p_istream_eatwhite
, "?eatwhite@istream@@QAEXXZ");
965 SET(p_istream_ipfx
, "?ipfx@istream@@QAEHH@Z");
966 SET(p_istream_get_str_delim
, "?get@istream@@IAEAAV1@PADHH@Z");
967 SET(p_istream_get_str
, "?get@istream@@QAEAAV1@PADHD@Z");
968 SET(p_istream_get
, "?get@istream@@QAEHXZ");
969 SET(p_istream_get_char
, "?get@istream@@QAEAAV1@AAD@Z");
970 SET(p_istream_get_sb
, "?get@istream@@QAEAAV1@AAVstreambuf@@D@Z");
971 SET(p_istream_getline
, "?getline@istream@@QAEAAV1@PADHD@Z");
972 SET(p_istream_ignore
, "?ignore@istream@@QAEAAV1@HH@Z");
973 SET(p_istream_peek
, "?peek@istream@@QAEHXZ");
974 SET(p_istream_putback
, "?putback@istream@@QAEAAV1@D@Z");
975 SET(p_istream_read
, "?read@istream@@QAEAAV1@PADH@Z");
976 SET(p_istream_seekg
, "?seekg@istream@@QAEAAV1@J@Z");
977 SET(p_istream_seekg_offset
, "?seekg@istream@@QAEAAV1@JW4seek_dir@ios@@@Z");
978 SET(p_istream_sync
, "?sync@istream@@QAEHXZ");
979 SET(p_istream_tellg
, "?tellg@istream@@QAEJXZ");
980 SET(p_istream_getint
, "?getint@istream@@AAEHPAD@Z");
981 SET(p_istream_getdouble
, "?getdouble@istream@@AAEHPADH@Z");
982 SET(p_istream_read_char
, "??5istream@@QAEAAV0@AAD@Z");
983 SET(p_istream_read_str
, "??5istream@@QAEAAV0@PAD@Z");
984 SET(p_istream_read_short
, "??5istream@@QAEAAV0@AAF@Z");
985 SET(p_istream_read_unsigned_short
, "??5istream@@QAEAAV0@AAG@Z");
986 SET(p_istream_read_int
, "??5istream@@QAEAAV0@AAH@Z");
987 SET(p_istream_read_unsigned_int
, "??5istream@@QAEAAV0@AAI@Z");
988 SET(p_istream_read_long
, "??5istream@@QAEAAV0@AAJ@Z");
989 SET(p_istream_read_unsigned_long
, "??5istream@@QAEAAV0@AAK@Z");
990 SET(p_istream_read_float
, "??5istream@@QAEAAV0@AAM@Z");
991 SET(p_istream_read_double
, "??5istream@@QAEAAV0@AAN@Z");
992 SET(p_istream_read_long_double
, "??5istream@@QAEAAV0@AAO@Z");
993 SET(p_istream_read_streambuf
, "??5istream@@QAEAAV0@PAVstreambuf@@@Z");
995 SET(p_istream_withassign_sb_ctor
, "??0istream_withassign@@QAE@PAVstreambuf@@@Z");
996 SET(p_istream_withassign_copy_ctor
, "??0istream_withassign@@QAE@ABV0@@Z");
997 SET(p_istream_withassign_ctor
, "??0istream_withassign@@QAE@XZ");
998 SET(p_istream_withassign_dtor
, "??1istream_withassign@@UAE@XZ");
999 SET(p_istream_withassign_vbase_dtor
, "??_Distream_withassign@@QAEXXZ");
1000 SET(p_istream_withassign_assign_sb
, "??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z");
1001 SET(p_istream_withassign_assign_is
, "??4istream_withassign@@QAEAAVistream@@ABV1@@Z");
1002 SET(p_istream_withassign_assign
, "??4istream_withassign@@QAEAAV0@ABV0@@Z");
1004 SET(p_istrstream_copy_ctor
, "??0istrstream@@QAE@ABV0@@Z");
1005 SET(p_istrstream_str_ctor
, "??0istrstream@@QAE@PAD@Z");
1006 SET(p_istrstream_buffer_ctor
, "??0istrstream@@QAE@PADH@Z");
1007 SET(p_istrstream_dtor
, "??1istrstream@@UAE@XZ");
1008 SET(p_istrstream_vbase_dtor
, "??_Distrstream@@QAEXXZ");
1009 SET(p_istrstream_assign
, "??4istrstream@@QAEAAV0@ABV0@@Z");
1011 SET(p_iostream_copy_ctor
, "??0iostream@@IAE@ABV0@@Z");
1012 SET(p_iostream_sb_ctor
, "??0iostream@@QAE@PAVstreambuf@@@Z");
1013 SET(p_iostream_ctor
, "??0iostream@@IAE@XZ");
1014 SET(p_iostream_dtor
, "??1iostream@@UAE@XZ");
1015 SET(p_iostream_vbase_dtor
, "??_Diostream@@QAEXXZ");
1016 SET(p_iostream_assign_sb
, "??4iostream@@IAEAAV0@PAVstreambuf@@@Z");
1017 SET(p_iostream_assign
, "??4iostream@@IAEAAV0@AAV0@@Z");
1019 SET(p_ifstream_copy_ctor
, "??0ifstream@@QAE@ABV0@@Z");
1020 SET(p_ifstream_fd_ctor
, "??0ifstream@@QAE@H@Z");
1021 SET(p_ifstream_buffer_ctor
, "??0ifstream@@QAE@HPADH@Z");
1022 SET(p_ifstream_open_ctor
, "??0ifstream@@QAE@PBDHH@Z");
1023 SET(p_ifstream_ctor
, "??0ifstream@@QAE@XZ");
1024 SET(p_ifstream_dtor
, "??1ifstream@@UAE@XZ");
1025 SET(p_ifstream_vbase_dtor
, "??_Difstream@@QAEXXZ");
1026 SET(p_ifstream_attach
, "?attach@ifstream@@QAEXH@Z");
1027 SET(p_ifstream_close
, "?close@ifstream@@QAEXXZ");
1028 SET(p_ifstream_fd
, "?fd@ifstream@@QBEHXZ");
1029 SET(p_ifstream_is_open
, "?is_open@ifstream@@QBEHXZ");
1030 SET(p_ifstream_open
, "?open@ifstream@@QAEXPBDHH@Z");
1031 SET(p_ifstream_rdbuf
, "?rdbuf@ifstream@@QBEPAVfilebuf@@XZ");
1032 SET(p_ifstream_setbuf
, "?setbuf@ifstream@@QAEPAVstreambuf@@PADH@Z");
1033 SET(p_ifstream_setmode
, "?setmode@ifstream@@QAEHH@Z");
1035 SET(p_strstream_copy_ctor
, "??0strstream@@QAE@ABV0@@Z");
1036 SET(p_strstream_buffer_ctor
, "??0strstream@@QAE@PADHH@Z");
1037 SET(p_strstream_ctor
, "??0strstream@@QAE@XZ");
1038 SET(p_strstream_dtor
, "??1strstream@@UAE@XZ");
1039 SET(p_strstream_vbase_dtor
, "??_Dstrstream@@QAEXXZ");
1040 SET(p_strstream_assign
, "??4strstream@@QAEAAV0@AAV0@@Z");
1042 SET(p_stdiostream_copy_ctor
, "??0stdiostream@@QAE@ABV0@@Z");
1043 SET(p_stdiostream_file_ctor
, "??0stdiostream@@QAE@PAU_iobuf@@@Z");
1044 SET(p_stdiostream_dtor
, "??1stdiostream@@UAE@XZ");
1045 SET(p_stdiostream_vbase_dtor
, "??_Dstdiostream@@QAEXXZ");
1046 SET(p_stdiostream_assign
, "??4stdiostream@@QAEAAV0@AAV0@@Z");
1048 SET(p_fstream_open_ctor
, "??0fstream@@QAE@PBDHH@Z");
1049 SET(p_fstream_dtor
, "??1fstream@@UAE@XZ");
1050 SET(p_fstream_vbase_dtor
, "??_Dfstream@@QAEXXZ");
1052 SET(p_Iostream_init_ios_ctor
, "??0Iostream_init@@QAE@AAVios@@H@Z");
1054 SET(p_exception_ctor
, "??0exception@@QAE@ABQBD@Z");
1055 SET(p_exception_dtor
, "??1exception@@UAE@XZ");
1056 SET(p_exception_what
, "?what@exception@@UBEPBDXZ");
1058 SET(p_logic_error_ctor
, "??0logic_error@@QAE@ABQBD@Z");
1059 SET(p_logic_error_dtor
, "??1logic_error@@UAE@XZ");
1061 SET(p_ios_static_lock
, "?x_lockc@ios@@0U_CRT_CRITICAL_SECTION@@A");
1062 SET(p_ios_lockc
, "?lockc@ios@@KAXXZ");
1063 SET(p_ios_unlockc
, "?unlockc@ios@@KAXXZ");
1064 SET(p_ios_maxbit
, "?x_maxbit@ios@@0JA");
1065 SET(p_ios_bitalloc
, "?bitalloc@ios@@SAJXZ");
1066 SET(p_ios_curindex
, "?x_curindex@ios@@0HA");
1067 SET(p_ios_statebuf
, "?x_statebuf@ios@@0PAJA");
1068 SET(p_ios_xalloc
, "?xalloc@ios@@SAHXZ");
1069 SET(p_ios_sync_with_stdio
, "?sync_with_stdio@ios@@SAXXZ");
1070 SET(p_ios_sunk_with_stdio
, "?sunk_with_stdio@ios@@0HA");
1071 SET(p_ios_fLockcInit
, "?fLockcInit@ios@@0HA");
1072 SET(p_cin
, "?cin@@3Vistream_withassign@@A");
1073 SET(p_cout
, "?cout@@3Vostream_withassign@@A");
1074 SET(p_cerr
, "?cerr@@3Vostream_withassign@@A");
1075 SET(p_clog
, "?clog@@3Vostream_withassign@@A");
1077 SET(p__mtlock
, "_mtlock");
1078 SET(p__mtunlock
, "_mtunlock");
1080 init_thiscall_thunk();
1084 static int overflow_count
, underflow_count
;
1085 static streambuf
*test_this
;
1086 static char test_get_buffer
[24];
1087 static int buffer_pos
, get_end
;
1090 static int __thiscall
test_streambuf_overflow(int ch
)
1092 static int __thiscall
test_streambuf_overflow(streambuf
*this, int ch
)
1096 if (ch
== 'L') /* simulate a failure */
1098 if (!test_this
->unbuffered
)
1099 test_this
->pptr
= test_this
->pbase
+ 5;
1100 return (unsigned char)ch
;
1104 static int __thiscall
test_streambuf_underflow(void)
1106 static int __thiscall
test_streambuf_underflow(streambuf
*this)
1110 if (test_this
->unbuffered
) {
1111 return (buffer_pos
< 23) ? (unsigned char)test_get_buffer
[buffer_pos
++] : EOF
;
1112 } else if (test_this
->gptr
< test_this
->egptr
) {
1113 return (unsigned char)*test_this
->gptr
;
1115 return get_end
? EOF
: (unsigned char)*(test_this
->gptr
= test_this
->eback
);
1119 struct streambuf_lock_arg
1126 static DWORD WINAPI
lock_streambuf(void *arg
)
1128 struct streambuf_lock_arg
*lock_arg
= arg
;
1129 call_func1(p_streambuf_lock
, lock_arg
->sb
);
1130 SetEvent(lock_arg
->lock
[0]);
1131 WaitForSingleObject(lock_arg
->test
[0], INFINITE
);
1132 call_func1(p_streambuf_lock
, lock_arg
->sb
);
1133 SetEvent(lock_arg
->lock
[1]);
1134 WaitForSingleObject(lock_arg
->test
[1], INFINITE
);
1135 call_func1(p_streambuf_lock
, lock_arg
->sb
);
1136 SetEvent(lock_arg
->lock
[2]);
1137 WaitForSingleObject(lock_arg
->test
[2], INFINITE
);
1138 call_func1(p_streambuf_unlock
, lock_arg
->sb
);
1139 SetEvent(lock_arg
->lock
[3]);
1140 WaitForSingleObject(lock_arg
->test
[3], INFINITE
);
1141 call_func1(p_streambuf_unlock
, lock_arg
->sb
);
1145 static void test_streambuf(void)
1147 streambuf sb
, sb2
, sb3
, *psb
;
1148 vtable_ptr test_streambuf_vtbl
[11];
1149 struct streambuf_lock_arg lock_arg
;
1155 memset(&sb
, 0xab, sizeof(streambuf
));
1156 memset(&sb2
, 0xab, sizeof(streambuf
));
1157 memset(&sb3
, 0xab, sizeof(streambuf
));
1160 call_func1(p_streambuf_ctor
, &sb
);
1161 ok(sb
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", sb
.allocated
);
1162 ok(sb
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb
.unbuffered
);
1163 ok(sb
.base
== NULL
, "wrong base pointer, expected %p got %p\n", NULL
, sb
.base
);
1164 ok(sb
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, sb
.ebuf
);
1165 ok(sb
.lock
.LockCount
== -1, "wrong critical section state, expected -1 got %d\n", sb
.lock
.LockCount
);
1166 call_func3(p_streambuf_reserve_ctor
, &sb2
, reserve
, 16);
1167 ok(sb2
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", sb2
.allocated
);
1168 ok(sb2
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb2
.unbuffered
);
1169 ok(sb2
.base
== reserve
, "wrong base pointer, expected %p got %p\n", reserve
, sb2
.base
);
1170 ok(sb2
.ebuf
== reserve
+16, "wrong ebuf pointer, expected %p got %p\n", reserve
+16, sb2
.ebuf
);
1171 ok(sb
.lock
.LockCount
== -1, "wrong critical section state, expected -1 got %d\n", sb
.lock
.LockCount
);
1172 call_func1(p_streambuf_ctor
, &sb3
);
1173 ok(sb3
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", sb3
.allocated
);
1174 ok(sb3
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb3
.unbuffered
);
1175 ok(sb3
.base
== NULL
, "wrong base pointer, expected %p got %p\n", NULL
, sb3
.base
);
1176 ok(sb3
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, sb3
.ebuf
);
1178 memcpy(test_streambuf_vtbl
, sb
.vtable
, sizeof(test_streambuf_vtbl
));
1179 test_streambuf_vtbl
[7] = (vtable_ptr
)&test_streambuf_overflow
;
1180 test_streambuf_vtbl
[8] = (vtable_ptr
)&test_streambuf_underflow
;
1181 sb2
.vtable
= test_streambuf_vtbl
;
1182 sb3
.vtable
= test_streambuf_vtbl
;
1183 overflow_count
= underflow_count
= 0;
1184 strcpy(test_get_buffer
, "CompuGlobalHyperMegaNet");
1185 buffer_pos
= get_end
= 0;
1188 ok(sb
.do_lock
== -1, "expected do_lock value -1, got %d\n", sb
.do_lock
);
1189 call_func1(p_streambuf_setlock
, &sb
);
1190 ok(sb
.do_lock
== -2, "expected do_lock value -2, got %d\n", sb
.do_lock
);
1191 call_func1(p_streambuf_setlock
, &sb
);
1192 ok(sb
.do_lock
== -3, "expected do_lock value -3, got %d\n", sb
.do_lock
);
1194 call_func1(p_streambuf_setlock
, &sb
);
1195 ok(sb
.do_lock
== 2, "expected do_lock value 2, got %d\n", sb
.do_lock
);
1199 call_func1(p_streambuf_clrclock
, &sb
);
1200 ok(sb
.do_lock
== -1, "expected do_lock value -1, got %d\n", sb
.do_lock
);
1201 call_func1(p_streambuf_clrclock
, &sb
);
1202 ok(sb
.do_lock
== 0, "expected do_lock value 0, got %d\n", sb
.do_lock
);
1203 call_func1(p_streambuf_clrclock
, &sb
);
1204 ok(sb
.do_lock
== 1, "expected do_lock value 1, got %d\n", sb
.do_lock
);
1205 call_func1(p_streambuf_clrclock
, &sb
);
1206 ok(sb
.do_lock
== 1, "expected do_lock value 1, got %d\n", sb
.do_lock
);
1210 for (i
= 0; i
< 4; i
++) {
1211 lock_arg
.lock
[i
] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
1212 ok(lock_arg
.lock
[i
] != NULL
, "CreateEventW failed\n");
1213 lock_arg
.test
[i
] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
1214 ok(lock_arg
.test
[i
] != NULL
, "CreateEventW failed\n");
1218 thread
= CreateThread(NULL
, 0, lock_streambuf
, (void*)&lock_arg
, 0, NULL
);
1219 ok(thread
!= NULL
, "CreateThread failed\n");
1220 WaitForSingleObject(lock_arg
.lock
[0], INFINITE
);
1221 locked
= TryEnterCriticalSection(&sb
.lock
);
1222 ok(locked
!= 0, "could not lock the streambuf\n");
1223 LeaveCriticalSection(&sb
.lock
);
1226 SetEvent(lock_arg
.test
[0]);
1227 WaitForSingleObject(lock_arg
.lock
[1], INFINITE
);
1228 locked
= TryEnterCriticalSection(&sb
.lock
);
1229 ok(locked
!= 0, "could not lock the streambuf\n");
1230 LeaveCriticalSection(&sb
.lock
);
1233 SetEvent(lock_arg
.test
[1]);
1234 WaitForSingleObject(lock_arg
.lock
[2], INFINITE
);
1235 locked
= TryEnterCriticalSection(&sb
.lock
);
1236 ok(locked
== 0, "the streambuf was not locked before\n");
1239 SetEvent(lock_arg
.test
[2]);
1240 WaitForSingleObject(lock_arg
.lock
[3], INFINITE
);
1241 locked
= TryEnterCriticalSection(&sb
.lock
);
1242 ok(locked
== 0, "the streambuf was not locked before\n");
1247 call_func4(p_streambuf_setb
, &sb
, reserve
, reserve
+16, 0);
1248 ok(sb
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", sb
.unbuffered
);
1249 ok(sb
.base
== reserve
, "wrong base pointer, expected %p got %p\n", reserve
, sb
.base
);
1250 ok(sb
.ebuf
== reserve
+16, "wrong ebuf pointer, expected %p got %p\n", reserve
+16, sb
.ebuf
);
1251 call_func4(p_streambuf_setb
, &sb
, reserve
, reserve
+16, 4);
1252 ok(sb
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", sb
.unbuffered
);
1253 ok(sb
.allocated
== 4, "wrong allocate value, expected 4 got %d\n", sb
.allocated
);
1256 call_func4(p_streambuf_setb
, &sb
, NULL
, NULL
, 3);
1257 ok(sb
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb
.unbuffered
);
1258 ok(sb
.allocated
== 3, "wrong allocate value, expected 3 got %d\n", sb
.allocated
);
1262 psb
= call_func3(p_streambuf_setbuf
, &sb
, NULL
, 5);
1263 ok(psb
== &sb
, "wrong return value, expected %p got %p\n", &sb
, psb
);
1264 ok(sb
.allocated
== 3, "wrong allocate value, expected 3 got %d\n", sb
.allocated
);
1265 ok(sb
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", sb
.unbuffered
);
1266 ok(sb
.base
== NULL
, "wrong base pointer, expected %p got %p\n", NULL
, sb
.base
);
1267 ok(sb
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, sb
.ebuf
);
1268 psb
= call_func3(p_streambuf_setbuf
, &sb
, reserve
, 0);
1269 ok(psb
== &sb
, "wrong return value, expected %p got %p\n", &sb
, psb
);
1270 ok(sb
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", sb
.unbuffered
);
1271 ok(sb
.base
== NULL
, "wrong base pointer, expected %p got %p\n", NULL
, sb
.base
);
1272 ok(sb
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, sb
.ebuf
);
1273 psb
= call_func3(p_streambuf_setbuf
, &sb
, reserve
, 16);
1274 ok(psb
== &sb
, "wrong return value, expected %p got %p\n", &sb
, psb
);
1275 ok(sb
.allocated
== 3, "wrong allocate value, expected 3 got %d\n", sb
.allocated
);
1276 ok(sb
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb
.unbuffered
);
1277 ok(sb
.base
== reserve
, "wrong base pointer, expected %p got %p\n", reserve
, sb
.base
);
1278 ok(sb
.ebuf
== reserve
+16, "wrong ebuf pointer, expected %p got %p\n", reserve
+16, sb
.ebuf
);
1279 psb
= call_func3(p_streambuf_setbuf
, &sb
, NULL
, 8);
1280 ok(psb
== NULL
, "wrong return value, expected %p got %p\n", NULL
, psb
);
1281 ok(sb
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", sb
.unbuffered
);
1282 ok(sb
.base
== reserve
, "wrong base pointer, expected %p got %p\n", reserve
, sb
.base
);
1283 ok(sb
.ebuf
== reserve
+16, "wrong ebuf pointer, expected %p got %p\n", reserve
+16, sb
.ebuf
);
1286 ret
= (int) call_func1(p_streambuf_allocate
, &sb
);
1287 ok(ret
== 0, "wrong return value, expected 0 got %d\n", ret
);
1289 ret
= (int) call_func1(p_streambuf_allocate
, &sb
);
1290 ok(ret
== 1, "wrong return value, expected 1 got %d\n", ret
);
1291 ok(sb
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", sb
.allocated
);
1292 ok(sb
.ebuf
- sb
.base
== 512 , "wrong reserve area size, expected 512 got %p-%p\n", sb
.ebuf
, sb
.base
);
1295 ret
= (int) call_func1(p_streambuf_doallocate
, &sb2
);
1296 ok(ret
== 1, "doallocate failed, got %d\n", ret
);
1297 ok(sb2
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", sb2
.allocated
);
1298 ok(sb2
.ebuf
- sb2
.base
== 512 , "wrong reserve area size, expected 512 got %p-%p\n", sb2
.ebuf
, sb2
.base
);
1299 ret
= (int) call_func1(p_streambuf_doallocate
, &sb3
);
1300 ok(ret
== 1, "doallocate failed, got %d\n", ret
);
1301 ok(sb3
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", sb3
.allocated
);
1302 ok(sb3
.ebuf
- sb3
.base
== 512 , "wrong reserve area size, expected 512 got %p-%p\n", sb3
.ebuf
, sb3
.base
);
1304 /* sb: buffered, space available */
1305 sb
.eback
= sb
.gptr
= sb
.base
;
1306 sb
.egptr
= sb
.base
+ 256;
1307 sb
.pbase
= sb
.pptr
= sb
.base
+ 256;
1308 sb
.epptr
= sb
.base
+ 512;
1309 /* sb2: buffered, no space available */
1310 sb2
.eback
= sb2
.base
;
1311 sb2
.gptr
= sb2
.egptr
= sb2
.base
+ 256;
1312 sb2
.pbase
= sb2
.base
+ 256;
1313 sb2
.pptr
= sb2
.epptr
= sb2
.base
+ 512;
1314 /* sb3: unbuffered */
1318 call_func2(p_streambuf_gbump
, &sb
, 10);
1319 ok(sb
.gptr
== sb
.eback
+ 10, "advance get pointer failed, expected %p got %p\n", sb
.eback
+ 10, sb
.gptr
);
1320 call_func2(p_streambuf_gbump
, &sb
, -15);
1321 ok(sb
.gptr
== sb
.eback
- 5, "advance get pointer failed, expected %p got %p\n", sb
.eback
- 5, sb
.gptr
);
1325 call_func2(p_streambuf_pbump
, &sb
, -2);
1326 ok(sb
.pptr
== sb
.pbase
- 2, "advance put pointer failed, expected %p got %p\n", sb
.pbase
- 2, sb
.pptr
);
1327 call_func2(p_streambuf_pbump
, &sb
, 20);
1328 ok(sb
.pptr
== sb
.pbase
+ 18, "advance put pointer failed, expected %p got %p\n", sb
.pbase
+ 18, sb
.pptr
);
1332 ret
= (int) call_func1(p_streambuf_sync
, &sb
);
1333 ok(ret
== EOF
, "sync failed, expected EOF got %d\n", ret
);
1335 ret
= (int) call_func1(p_streambuf_sync
, &sb
);
1336 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1337 sb
.gptr
= sb
.egptr
+ 1;
1338 ret
= (int) call_func1(p_streambuf_sync
, &sb
);
1339 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1341 ret
= (int) call_func1(p_streambuf_sync
, &sb2
);
1342 ok(ret
== EOF
, "sync failed, expected EOF got %d\n", ret
);
1343 sb2
.pptr
= sb2
.pbase
;
1344 ret
= (int) call_func1(p_streambuf_sync
, &sb2
);
1345 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1346 sb2
.pptr
= sb2
.pbase
- 1;
1347 ret
= (int) call_func1(p_streambuf_sync
, &sb2
);
1348 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1349 sb2
.pptr
= sb2
.epptr
;
1350 ret
= (int) call_func1(p_streambuf_sync
, &sb3
);
1351 ok(ret
== 0, "sync failed, expected 0 got %d\n", ret
);
1354 strcpy(sb2
.eback
, "WorstTestEver");
1356 ret
= (int) call_func1(p_streambuf_sgetc
, &sb2
);
1357 ok(ret
== 'W', "expected 'W' got '%c'\n", ret
);
1358 ok(underflow_count
== 1, "expected call to underflow\n");
1359 ok(sb2
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb2
.stored_char
);
1361 ret
= (int) call_func1(p_streambuf_sgetc
, &sb2
);
1362 ok(ret
== 'o', "expected 'o' got '%c'\n", ret
);
1363 ok(underflow_count
== 2, "expected call to underflow\n");
1364 ok(sb2
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb2
.stored_char
);
1365 sb2
.gptr
= sb2
.egptr
;
1367 ret
= (int) call_func1(p_streambuf_sgetc
, &sb3
);
1368 ok(ret
== 'C', "expected 'C' got '%c'\n", ret
);
1369 ok(underflow_count
== 3, "expected call to underflow\n");
1370 ok(sb3
.stored_char
== 'C', "wrong stored character, expected 'C' got %c\n", sb3
.stored_char
);
1371 sb3
.stored_char
= 'b';
1372 ret
= (int) call_func1(p_streambuf_sgetc
, &sb3
);
1373 ok(ret
== 'b', "expected 'b' got '%c'\n", ret
);
1374 ok(underflow_count
== 3, "no call to underflow expected\n");
1375 ok(sb3
.stored_char
== 'b', "wrong stored character, expected 'b' got %c\n", sb3
.stored_char
);
1379 ret
= (int) call_func2(p_streambuf_sputc
, &sb
, 'c');
1380 ok(ret
== 'c', "wrong return value, expected 'c' got %d\n", ret
);
1381 ok(overflow_count
== 0, "no call to overflow expected\n");
1382 ok(*sb
.pbase
== 'c', "expected 'c' in the put area, got %c\n", *sb
.pbase
);
1383 ok(sb
.pptr
== sb
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", sb
.pbase
+ 1, sb
.pptr
);
1385 ret
= (int) call_func2(p_streambuf_sputc
, &sb
, 150);
1386 ok(ret
== 150, "wrong return value, expected 150 got %d\n", ret
);
1387 ok(overflow_count
== 0, "no call to overflow expected\n");
1388 ok((signed char)*sb
.pbase
== -106, "expected -106 in the put area, got %d\n", *sb
.pbase
);
1389 ok(sb
.pptr
== sb
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", sb
.pbase
+ 1, sb
.pptr
);
1391 ret
= (int) call_func2(p_streambuf_sputc
, &sb
, -50);
1392 ok(ret
== 206, "wrong return value, expected 206 got %d\n", ret
);
1393 ok(overflow_count
== 0, "no call to overflow expected\n");
1394 ok((signed char)*sb
.pbase
== -50, "expected -50 in the put area, got %d\n", *sb
.pbase
);
1395 ok(sb
.pptr
== sb
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", sb
.pbase
+ 1, sb
.pptr
);
1397 ret
= (int) call_func2(p_streambuf_sputc
, &sb2
, 'c');
1398 ok(ret
== 'c', "wrong return value, expected 'c' got %d\n", ret
);
1399 ok(overflow_count
== 1, "expected call to overflow\n");
1400 ok(sb2
.pptr
== sb2
.pbase
+ 5, "wrong put pointer, expected %p got %p\n", sb2
.pbase
+ 5, sb2
.pptr
);
1402 ret
= (int) call_func2(p_streambuf_sputc
, &sb3
, 'c');
1403 ok(ret
== 'c', "wrong return value, expected 'c' got %d\n", ret
);
1404 ok(overflow_count
== 2, "expected call to overflow\n");
1405 sb3
.pbase
= sb3
.pptr
= sb3
.base
;
1406 sb3
.epptr
= sb3
.ebuf
;
1407 ret
= (int) call_func2(p_streambuf_sputc
, &sb3
, 'c');
1408 ok(ret
== 'c', "wrong return value, expected 'c' got %d\n", ret
);
1409 ok(overflow_count
== 2, "no call to overflow expected\n");
1410 ok(*sb3
.pbase
== 'c', "expected 'c' in the put area, got %c\n", *sb3
.pbase
);
1411 sb3
.pbase
= sb3
.pptr
= sb3
.epptr
= NULL
;
1414 sb2
.gptr
= sb2
.egptr
= sb2
.eback
+ 13;
1416 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb2
, reserve
, 5);
1417 ok(ret
== 5, "wrong return value, expected 5 got %d\n", ret
);
1418 ok(!strncmp(reserve
, "Worst", 5), "expected 'Worst' got %s\n", reserve
);
1419 ok(sb2
.gptr
== sb2
.eback
+ 5, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 5, sb2
.gptr
);
1420 ok(underflow_count
== 4, "expected call to underflow\n");
1421 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb2
, reserve
, 4);
1422 ok(ret
== 4, "wrong return value, expected 4 got %d\n", ret
);
1423 ok(!strncmp(reserve
, "Test", 4), "expected 'Test' got %s\n", reserve
);
1424 ok(sb2
.gptr
== sb2
.eback
+ 9, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 9, sb2
.gptr
);
1425 ok(underflow_count
== 5, "expected call to underflow\n");
1427 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb2
, reserve
, 16);
1428 ok(ret
== 4, "wrong return value, expected 4 got %d\n", ret
);
1429 ok(!strncmp(reserve
, "Ever", 4), "expected 'Ever' got %s\n", reserve
);
1430 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1431 ok(underflow_count
== 7, "expected 2 calls to underflow, got %d\n", underflow_count
- 5);
1433 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb3
, reserve
, 11);
1434 ok(ret
== 11, "wrong return value, expected 11 got %d\n", ret
);
1435 ok(!strncmp(reserve
, "bompuGlobal", 11), "expected 'bompuGlobal' got %s\n", reserve
);
1436 ok(sb3
.stored_char
== 'H', "wrong stored character, expected 'H' got %c\n", sb3
.stored_char
);
1437 ok(underflow_count
== 18, "expected 11 calls to underflow, got %d\n", underflow_count
- 7);
1438 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb3
, reserve
, 16);
1439 ok(ret
== 12, "wrong return value, expected 12 got %d\n", ret
);
1440 ok(!strncmp(reserve
, "HyperMegaNet", 12), "expected 'HyperMegaNet' got %s\n", reserve
);
1441 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1442 ok(underflow_count
== 30, "expected 12 calls to underflow, got %d\n", underflow_count
- 18);
1443 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb3
, reserve
, 3);
1444 ok(ret
== 0, "wrong return value, expected 0 got %d\n", ret
);
1445 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1446 ok(underflow_count
== 31, "expected call to underflow\n");
1448 ret
= (int) call_func3(p_streambuf_xsgetn
, &sb3
, reserve
, 5);
1449 ok(ret
== 5, "wrong return value, expected 5 got %d\n", ret
);
1450 ok(!strncmp(reserve
, "Compu", 5), "expected 'Compu' got %s\n", reserve
);
1451 ok(sb3
.stored_char
== 'G', "wrong stored character, expected 'G' got %c\n", sb3
.stored_char
);
1452 ok(underflow_count
== 37, "expected 6 calls to underflow, got %d\n", underflow_count
- 31);
1455 ret
= (int) call_func3(p_streambuf_xsputn
, &sb
, "Test\0ing", 8);
1456 ok(ret
== 8, "wrong return value, expected 8 got %d\n", ret
);
1457 ok(sb
.pptr
== sb
.pbase
+ 9, "wrong put pointer, expected %p got %p\n", sb
.pbase
+ 9, sb
.pptr
);
1459 sb2
.pptr
= sb2
.epptr
- 7;
1460 ret
= (int) call_func3(p_streambuf_xsputn
, &sb2
, "Testing", 7);
1461 ok(ret
== 7, "wrong return value, expected 7 got %d\n", ret
);
1462 ok(sb2
.pptr
== sb2
.epptr
, "wrong put pointer, expected %p got %p\n", sb2
.epptr
, sb2
.pptr
);
1463 ok(overflow_count
== 2, "no call to overflow expected\n");
1464 sb2
.pptr
= sb2
.epptr
- 5;
1466 ret
= (int) call_func3(p_streambuf_xsputn
, &sb2
, "Testing", 7);
1467 ok(ret
== 7, "wrong return value, expected 7 got %d\n", ret
);
1468 ok(sb2
.pbase
[5] == 'g', "expected 'g' got %c\n", sb2
.pbase
[5]);
1469 ok(sb2
.pptr
== sb2
.pbase
+ 6, "wrong put pointer, expected %p got %p\n", sb2
.pbase
+ 6, sb2
.pptr
);
1470 ok(overflow_count
== 3, "expected call to overflow\n");
1471 sb2
.pptr
= sb2
.epptr
- 4;
1472 ret
= (int) call_func3(p_streambuf_xsputn
, &sb2
, "TestLing", 8);
1473 ok(ret
== 4, "wrong return value, expected 4 got %d\n", ret
);
1474 ok(sb2
.pptr
== sb2
.epptr
, "wrong put pointer, expected %p got %p\n", sb2
.epptr
, sb2
.pptr
);
1475 ok(overflow_count
== 4, "expected call to overflow\n");
1477 ret
= (int) call_func3(p_streambuf_xsputn
, &sb3
, "Testing", 7);
1478 ok(ret
== 7, "wrong return value, expected 7 got %d\n", ret
);
1479 ok(sb3
.stored_char
== 'G', "wrong stored character, expected 'G' got %c\n", sb3
.stored_char
);
1480 ok(overflow_count
== 11, "expected 7 calls to overflow, got %d\n", overflow_count
- 4);
1481 ret
= (int) call_func3(p_streambuf_xsputn
, &sb3
, "TeLephone", 9);
1482 ok(ret
== 2, "wrong return value, expected 2 got %d\n", ret
);
1483 ok(sb3
.stored_char
== 'G', "wrong stored character, expected 'G' got %c\n", sb3
.stored_char
);
1484 ok(overflow_count
== 14, "expected 3 calls to overflow, got %d\n", overflow_count
- 11);
1487 strcpy(sb
.eback
, "Test");
1488 ret
= (int) call_func1(p_streambuf_snextc
, &sb
);
1489 ok(ret
== 'e', "expected 'e' got '%c'\n", ret
);
1490 ok(sb
.gptr
== sb
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 1, sb
.gptr
);
1492 ret
= (int) call_func1(p_streambuf_snextc
, &sb
);
1493 ok(ret
== 206, "expected 206 got %d\n", ret
);
1494 ok(sb
.gptr
== sb
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 1, sb
.gptr
);
1496 ret
= (int) call_func1(p_streambuf_snextc
, &sb2
);
1497 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1498 ok(sb2
.gptr
== sb2
.egptr
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.egptr
+ 1, sb2
.gptr
);
1499 ok(underflow_count
== 39, "expected 2 calls to underflow, got %d\n", underflow_count
- 37);
1500 sb2
.gptr
= sb2
.egptr
- 1;
1501 ret
= (int) call_func1(p_streambuf_snextc
, &sb2
);
1502 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1503 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1504 ok(underflow_count
== 40, "expected call to underflow\n");
1506 ret
= (int) call_func1(p_streambuf_snextc
, &sb2
);
1507 ok(ret
== 'o', "expected 'o' got '%c'\n", ret
);
1508 ok(sb2
.gptr
== sb2
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 1, sb2
.gptr
);
1509 ok(underflow_count
== 41, "expected call to underflow\n");
1510 sb2
.gptr
= sb2
.egptr
- 1;
1511 ret
= (int) call_func1(p_streambuf_snextc
, &sb2
);
1512 ok(ret
== 'W', "expected 'W' got '%c'\n", ret
);
1513 ok(sb2
.gptr
== sb2
.eback
, "wrong get pointer, expected %p got %p\n", sb2
.eback
, sb2
.gptr
);
1514 ok(underflow_count
== 42, "expected call to underflow\n");
1515 sb2
.gptr
= sb2
.egptr
;
1517 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1518 ok(ret
== 'l', "expected 'l' got '%c'\n", ret
);
1519 ok(sb3
.stored_char
== 'l', "wrong stored character, expected 'l' got %c\n", sb3
.stored_char
);
1520 ok(underflow_count
== 43, "expected call to underflow\n");
1522 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1523 ok(ret
== 't', "expected 't' got '%c'\n", ret
);
1524 ok(sb3
.stored_char
== 't', "wrong stored character, expected 't' got %c\n", sb3
.stored_char
);
1525 ok(underflow_count
== 44, "expected call to underflow\n");
1526 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1527 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1528 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1529 ok(underflow_count
== 45, "expected call to underflow\n");
1531 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1532 ok(ret
== 'o', "expected 'o' got '%c'\n", ret
);
1533 ok(sb3
.stored_char
== 'o', "wrong stored character, expected 'o' got %c\n", sb3
.stored_char
);
1534 ok(underflow_count
== 47, "expected 2 calls to underflow, got %d\n", underflow_count
- 45);
1535 sb3
.stored_char
= EOF
;
1536 ret
= (int) call_func1(p_streambuf_snextc
, &sb3
);
1537 ok(ret
== 'p', "expected 'p' got '%c'\n", ret
);
1538 ok(sb3
.stored_char
== 'p', "wrong stored character, expected 'p' got %c\n", sb3
.stored_char
);
1539 ok(underflow_count
== 49, "expected 2 calls to underflow, got %d\n", underflow_count
- 47);
1543 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb
);
1544 ok(ret
== 'T', "expected 'T' got '%c'\n", ret
);
1545 ok(sb
.gptr
== sb
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 1, sb
.gptr
);
1546 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb
);
1547 ok(ret
== 206, "expected 206 got %d\n", ret
);
1548 ok(sb
.gptr
== sb
.eback
+ 2, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 2, sb
.gptr
);
1550 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb2
);
1551 ok(ret
== 'W', "expected 'W' got '%c'\n", ret
);
1552 ok(sb2
.gptr
== sb2
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 1, sb2
.gptr
);
1553 ok(underflow_count
== 50, "expected call to underflow\n");
1554 sb2
.gptr
= sb2
.egptr
- 1;
1556 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb2
);
1557 ok(ret
== 't', "expected 't' got '%c'\n", ret
);
1558 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1559 ok(underflow_count
== 50, "no call to underflow expected\n");
1561 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb2
);
1562 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1563 ok(sb2
.gptr
== sb2
.egptr
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.egptr
+ 1, sb2
.gptr
);
1564 ok(underflow_count
== 51, "expected call to underflow\n");
1565 sb2
.gptr
= sb2
.egptr
;
1567 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb3
);
1568 ok(ret
== 'p', "expected 'p' got '%c'\n", ret
);
1569 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1570 ok(underflow_count
== 51, "no call to underflow expected\n");
1571 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb3
);
1572 ok(ret
== 'u', "expected 'u' got '%c'\n", ret
);
1573 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1574 ok(underflow_count
== 52, "expected call to underflow\n");
1576 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb3
);
1577 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1578 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1579 ok(underflow_count
== 53, "expected call to underflow\n");
1581 ret
= (int) call_func1(p_streambuf_sbumpc
, &sb3
);
1582 ok(ret
== 'C', "expected 'C' got '%c'\n", ret
);
1583 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1584 ok(underflow_count
== 54, "expected call to underflow\n");
1587 call_func1(p_streambuf_stossc
, &sb
);
1588 ok(sb
.gptr
== sb
.eback
+ 3, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 3, sb
.gptr
);
1590 call_func1(p_streambuf_stossc
, &sb2
);
1591 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1592 ok(underflow_count
== 55, "expected call to underflow\n");
1594 call_func1(p_streambuf_stossc
, &sb2
);
1595 ok(sb2
.gptr
== sb2
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb2
.eback
+ 1, sb2
.gptr
);
1596 ok(underflow_count
== 56, "expected call to underflow\n");
1597 sb2
.gptr
= sb2
.egptr
- 1;
1598 call_func1(p_streambuf_stossc
, &sb2
);
1599 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1600 ok(underflow_count
== 56, "no call to underflow expected\n");
1602 call_func1(p_streambuf_stossc
, &sb3
);
1603 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1604 ok(underflow_count
== 57, "expected call to underflow\n");
1605 sb3
.stored_char
= 'a';
1606 call_func1(p_streambuf_stossc
, &sb3
);
1607 ok(sb3
.stored_char
== EOF
, "wrong stored character, expected EOF got %c\n", sb3
.stored_char
);
1608 ok(underflow_count
== 57, "no call to underflow expected\n");
1611 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb
, 'A');
1612 ok(ret
== 'A', "expected 'A' got '%c'\n", ret
);
1613 ok(sb
.gptr
== sb
.eback
+ 2, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 2, sb
.gptr
);
1614 ok(*sb
.gptr
== 'A', "expected 'A' in the get area, got %c\n", *sb
.gptr
);
1615 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb
, EOF
);
1616 ok(ret
== (char)EOF
, "expected EOF got %d\n", ret
);
1617 ok(sb
.gptr
== sb
.eback
+ 1, "wrong get pointer, expected %p got %p\n", sb
.eback
+ 1, sb
.gptr
);
1618 ok((signed char)*sb
.gptr
== EOF
, "expected EOF in the get area, got %c\n", *sb
.gptr
);
1620 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb
, 'Z');
1621 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1622 ok(sb
.gptr
== sb
.eback
, "wrong get pointer, expected %p got %p\n", sb
.eback
, sb
.gptr
);
1623 ok(*sb
.gptr
== 'T', "expected 'T' in the get area, got %c\n", *sb
.gptr
);
1624 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb
, EOF
);
1625 ok(ret
== EOF
, "expected EOF got '%c'\n", ret
);
1626 ok(sb
.gptr
== sb
.eback
, "wrong get pointer, expected %p got %p\n", sb
.eback
, sb
.gptr
);
1627 ok(*sb
.gptr
== 'T', "expected 'T' in the get area, got %c\n", *sb
.gptr
);
1628 sb2
.gptr
= sb2
.egptr
+ 1;
1629 ret
= (int) call_func2(p_streambuf_pbackfail
, &sb2
, 'X');
1630 ok(ret
== 'X', "expected 'X' got '%c'\n", ret
);
1631 ok(sb2
.gptr
== sb2
.egptr
, "wrong get pointer, expected %p got %p\n", sb2
.egptr
, sb2
.gptr
);
1632 ok(*sb2
.gptr
== 'X', "expected 'X' in the get area, got %c\n", *sb2
.gptr
);
1635 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1636 ok(ret
== 9, "expected 9 got %d\n", ret
);
1638 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1639 ok(ret
== 0, "expected 0 got %d\n", ret
);
1640 sb
.pptr
= sb
.pbase
- 1;
1641 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1642 ok(ret
== 0, "expected 0 got %d\n", ret
);
1644 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1645 ok(ret
== 0, "expected 0 got %d\n", ret
);
1648 ret
= (int) call_func1(p_streambuf_out_waiting
, &sb
);
1649 ok(ret
== (int)(sb
.pptr
- sb
.pbase
), "expected %d got %d\n", (int)(sb
.pptr
- sb
.pbase
), ret
);
1652 ret
= (int) call_func1(p_streambuf_in_avail
, &sb
);
1653 ok(ret
== 256, "expected 256 got %d\n", ret
);
1655 ret
= (int) call_func1(p_streambuf_in_avail
, &sb
);
1656 ok(ret
== 0, "expected 0 got %d\n", ret
);
1657 sb
.gptr
= sb
.egptr
+ 1;
1658 ret
= (int) call_func1(p_streambuf_in_avail
, &sb
);
1659 ok(ret
== 0, "expected 0 got %d\n", ret
);
1661 ret
= (int) call_func1(p_streambuf_in_avail
, &sb
);
1662 ok(ret
== 0, "expected 0 got %d\n", ret
);
1664 SetEvent(lock_arg
.test
[3]);
1665 WaitForSingleObject(thread
, INFINITE
);
1667 call_func1(p_streambuf_dtor
, &sb
);
1668 call_func1(p_streambuf_dtor
, &sb2
);
1669 call_func1(p_streambuf_dtor
, &sb3
);
1670 for (i
= 0; i
< 4; i
++) {
1671 CloseHandle(lock_arg
.lock
[i
]);
1672 CloseHandle(lock_arg
.test
[i
]);
1674 CloseHandle(thread
);
1677 struct filebuf_lock_arg
1679 filebuf
*fb1
, *fb2
, *fb3
;
1684 static DWORD WINAPI
lock_filebuf(void *arg
)
1686 struct filebuf_lock_arg
*lock_arg
= arg
;
1687 call_func1(p_streambuf_lock
, &lock_arg
->fb1
->base
);
1688 call_func1(p_streambuf_lock
, &lock_arg
->fb2
->base
);
1689 call_func1(p_streambuf_lock
, &lock_arg
->fb3
->base
);
1690 SetEvent(lock_arg
->lock
);
1691 WaitForSingleObject(lock_arg
->test
, INFINITE
);
1692 call_func1(p_streambuf_unlock
, &lock_arg
->fb1
->base
);
1693 call_func1(p_streambuf_unlock
, &lock_arg
->fb2
->base
);
1694 call_func1(p_streambuf_unlock
, &lock_arg
->fb3
->base
);
1698 static void test_filebuf(void)
1700 filebuf fb1
, fb2
, fb3
, *pret
;
1701 struct filebuf_lock_arg lock_arg
;
1703 const char filename1
[] = "test1";
1704 const char filename2
[] = "test2";
1705 const char filename3
[] = "test3";
1706 char read_buffer
[16];
1709 memset(&fb1
, 0xab, sizeof(filebuf
));
1710 memset(&fb2
, 0xab, sizeof(filebuf
));
1711 memset(&fb3
, 0xab, sizeof(filebuf
));
1714 call_func2(p_filebuf_fd_ctor
, &fb1
, 1);
1715 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1716 ok(fb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", fb1
.base
.unbuffered
);
1717 ok(fb1
.fd
== 1, "wrong fd, expected 1 got %d\n", fb1
.fd
);
1718 ok(fb1
.close
== 0, "wrong value, expected 0 got %d\n", fb1
.close
);
1719 call_func4(p_filebuf_fd_reserve_ctor
, &fb2
, 4, NULL
, 0);
1720 ok(fb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb2
.base
.allocated
);
1721 ok(fb2
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb2
.base
.unbuffered
);
1722 ok(fb2
.fd
== 4, "wrong fd, expected 4 got %d\n", fb2
.fd
);
1723 ok(fb2
.close
== 0, "wrong value, expected 0 got %d\n", fb2
.close
);
1724 call_func1(p_filebuf_ctor
, &fb3
);
1725 ok(fb3
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb3
.base
.allocated
);
1726 ok(fb3
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", fb3
.base
.unbuffered
);
1727 ok(fb3
.fd
== -1, "wrong fd, expected -1 got %d\n", fb3
.fd
);
1728 ok(fb3
.close
== 0, "wrong value, expected 0 got %d\n", fb3
.close
);
1730 lock_arg
.fb1
= &fb1
;
1731 lock_arg
.fb2
= &fb2
;
1732 lock_arg
.fb3
= &fb3
;
1733 lock_arg
.lock
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
1734 ok(lock_arg
.lock
!= NULL
, "CreateEventW failed\n");
1735 lock_arg
.test
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
1736 ok(lock_arg
.test
!= NULL
, "CreateEventW failed\n");
1737 thread
= CreateThread(NULL
, 0, lock_filebuf
, (void*)&lock_arg
, 0, NULL
);
1738 ok(thread
!= NULL
, "CreateThread failed\n");
1739 WaitForSingleObject(lock_arg
.lock
, INFINITE
);
1742 fb1
.base
.do_lock
= 0;
1743 fb1
.fd
= -1; /* closed */
1744 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1745 ok(fb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", fb1
.base
.unbuffered
);
1746 ok(fb1
.fd
== -1, "wrong fd, expected -1 got %d\n", fb1
.fd
);
1747 fb1
.base
.unbuffered
= 1;
1748 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
, 16);
1749 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1750 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1751 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1752 ok(fb1
.base
.base
== read_buffer
, "wrong buffer, expected %p got %p\n", read_buffer
, fb1
.base
.base
);
1753 ok(fb1
.base
.pbase
== NULL
, "wrong put area, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1754 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1755 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
+ 8, 8);
1756 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", NULL
, pret
);
1757 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1758 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1759 ok(fb1
.base
.base
== read_buffer
+ 8, "wrong buffer, expected %p got %p\n", read_buffer
+ 8, fb1
.base
.base
);
1760 ok(fb1
.base
.pbase
== NULL
, "wrong put area, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1761 fb1
.base
.unbuffered
= 0;
1762 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, NULL
, 0);
1763 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1764 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1765 ok(fb1
.base
.base
== read_buffer
+ 8, "wrong buffer, expected %p got %p\n", read_buffer
+ 8, fb1
.base
.base
);
1766 ok(fb1
.base
.pbase
== NULL
, "wrong put area, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1767 ok((int) call_func1(p_streambuf_doallocate
, &fb1
.base
) == 1, "failed to allocate buffer\n");
1768 ok(fb1
.base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", fb1
.base
.allocated
);
1769 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1770 ok(fb1
.base
.base
!= NULL
, "wrong buffer, expected not NULL got %p\n", fb1
.base
.base
);
1771 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
+ 2, 14);
1772 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1773 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1774 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1775 ok(fb1
.base
.base
== read_buffer
+ 2, "wrong buffer, expected %p got %p\n", read_buffer
+ 2, fb1
.base
.base
);
1776 ok(fb1
.base
.pbase
== NULL
, "wrong put area, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1777 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1778 fb1
.fd
= 1; /* opened */
1779 fb1
.base
.unbuffered
= 1;
1780 fb1
.base
.base
= fb1
.base
.ebuf
= NULL
;
1781 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
, 16);
1782 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1783 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1784 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1785 ok(fb1
.base
.base
== read_buffer
, "wrong buffer, expected %p got %p\n", read_buffer
, fb1
.base
.base
);
1786 ok(fb1
.base
.pbase
== NULL
, "wrong put area, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1787 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
+ 8, 8);
1788 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1789 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1790 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1791 ok(fb1
.base
.base
== read_buffer
, "wrong buffer, expected %p got %p\n", read_buffer
, fb1
.base
.base
);
1792 ok(fb1
.base
.pbase
== NULL
, "wrong put area, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1793 fb1
.base
.unbuffered
= 0;
1794 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, NULL
, 0);
1795 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1796 ok(fb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", fb1
.base
.unbuffered
);
1797 ok(fb1
.base
.base
== read_buffer
, "wrong buffer, expected %p got %p\n", read_buffer
, fb1
.base
.base
);
1798 ok(fb1
.base
.pbase
== NULL
, "wrong put area, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1799 fb1
.base
.unbuffered
= 1;
1800 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
;
1801 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1802 fb1
.base
.do_lock
= -1;
1803 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
, 16);
1804 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1805 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1806 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1807 ok(fb1
.base
.base
== read_buffer
, "wrong buffer, expected %p got %p\n", read_buffer
, fb1
.base
.base
);
1808 ok(fb1
.base
.pbase
== read_buffer
, "wrong put area, expected %p got %p\n", read_buffer
, fb1
.base
.pbase
);
1809 fb1
.base
.base
= fb1
.base
.ebuf
= NULL
;
1810 fb1
.base
.do_lock
= 0;
1811 fb1
.base
.unbuffered
= 0;
1812 pret
= (filebuf
*) call_func3(p_filebuf_setbuf
, &fb1
, read_buffer
, 0);
1813 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1814 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1815 ok(fb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", fb1
.base
.unbuffered
);
1816 ok(fb1
.base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, fb1
.base
.base
);
1817 ok(fb1
.base
.pbase
== read_buffer
, "wrong put area, expected %p got %p\n", read_buffer
, fb1
.base
.pbase
);
1818 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.epptr
= NULL
;
1819 fb1
.base
.unbuffered
= 0;
1820 fb1
.base
.do_lock
= -1;
1823 pret
= call_func2(p_filebuf_attach
, &fb1
, 2);
1824 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1825 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1826 ok(fb1
.fd
== 1, "wrong fd, expected 1 got %d\n", fb1
.fd
);
1828 fb2
.base
.do_lock
= 0;
1829 pret
= call_func2(p_filebuf_attach
, &fb2
, 3);
1830 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1831 ok(fb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb2
.base
.allocated
);
1832 ok(fb2
.fd
== 3, "wrong fd, expected 3 got %d\n", fb2
.fd
);
1833 fb2
.base
.do_lock
= -1;
1834 fb3
.base
.do_lock
= 0;
1835 pret
= call_func2(p_filebuf_attach
, &fb3
, 2);
1836 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
1837 ok(fb3
.base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", fb3
.base
.allocated
);
1838 ok(fb3
.fd
== 2, "wrong fd, expected 2 got %d\n", fb3
.fd
);
1839 fb3
.base
.do_lock
= -1;
1842 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
, filebuf_openprot
);
1843 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1845 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
,
1846 OPENMODE_ate
|OPENMODE_nocreate
|OPENMODE_noreplace
|OPENMODE_binary
, filebuf_openprot
);
1847 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1848 ok(fb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", fb1
.base
.allocated
);
1849 fb1
.base
.do_lock
= 0;
1850 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
, filebuf_openprot
);
1851 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1852 ok(fb1
.base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", fb1
.base
.allocated
);
1853 ok(_write(fb1
.fd
, "testing", 7) == 7, "_write failed\n");
1854 pret
= call_func1(p_filebuf_close
, &fb1
);
1855 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1856 ok(fb1
.fd
== -1, "wrong fd, expected -1 got %d\n", fb1
.fd
);
1857 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
, filebuf_openprot
);
1858 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1859 ok(_read(fb1
.fd
, read_buffer
, 1) == -1, "file should not be open for reading\n");
1860 pret
= call_func1(p_filebuf_close
, &fb1
);
1861 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1862 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_app
, filebuf_openprot
);
1863 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1864 ok(_read(fb1
.fd
, read_buffer
, 1) == -1, "file should not be open for reading\n");
1865 ok(_write(fb1
.fd
, "testing", 7) == 7, "_write failed\n");
1866 ok(_lseek(fb1
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1867 ok(_write(fb1
.fd
, "append", 6) == 6, "_write failed\n");
1868 pret
= call_func1(p_filebuf_close
, &fb1
);
1869 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1870 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
|OPENMODE_ate
, filebuf_openprot
);
1871 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1872 ok(_read(fb1
.fd
, read_buffer
, 1) == -1, "file should not be open for reading\n");
1873 ok(_lseek(fb1
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1874 ok(_write(fb1
.fd
, "ate", 3) == 3, "_write failed\n");
1875 pret
= call_func1(p_filebuf_close
, &fb1
);
1876 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1877 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_in
, filebuf_openprot
);
1878 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1879 ok(_read(fb1
.fd
, read_buffer
, 13) == 13, "read failed\n");
1880 read_buffer
[13] = 0;
1881 ok(!strncmp(read_buffer
, "atetingappend", 13), "wrong contents, expected 'atetingappend' got '%s'\n", read_buffer
);
1882 pret
= call_func1(p_filebuf_close
, &fb1
);
1883 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1884 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_in
|OPENMODE_trunc
, filebuf_openprot
);
1885 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1886 ok(_read(fb1
.fd
, read_buffer
, 1) == 0, "read failed\n");
1887 ok(_write(fb1
.fd
, "file1", 5) == 5, "_write failed\n");
1888 pret
= call_func1(p_filebuf_close
, &fb1
);
1889 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1890 pret
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_in
|OPENMODE_app
, filebuf_openprot
);
1891 ok(pret
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pret
);
1892 ok(_write(fb1
.fd
, "app", 3) == 3, "_write failed\n");
1893 ok(_read(fb1
.fd
, read_buffer
, 1) == 0, "read failed\n");
1894 ok(_lseek(fb1
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
1895 ok(_read(fb1
.fd
, read_buffer
, 8) == 8, "read failed\n");
1897 ok(!strncmp(read_buffer
, "file1app", 8), "wrong contents, expected 'file1app' got '%s'\n", read_buffer
);
1898 fb1
.base
.do_lock
= -1;
1901 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_out
|OPENMODE_nocreate
, filebuf_openprot
);
1902 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1903 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
|OPENMODE_nocreate
, filebuf_openprot
);
1904 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1905 fb2
.base
.do_lock
= 0;
1906 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
, filebuf_openprot
);
1907 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1908 ok(_read(fb1
.fd
, read_buffer
, 1) == 0, "read failed\n");
1909 pret
= call_func1(p_filebuf_close
, &fb2
);
1910 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1911 fb2
.base
.do_lock
= -1;
1912 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
|OPENMODE_noreplace
, filebuf_openprot
);
1913 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1914 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_trunc
|OPENMODE_noreplace
, filebuf_openprot
);
1915 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1916 pret
= call_func4(p_filebuf_open
, &fb2
, filename3
, OPENMODE_out
|OPENMODE_nocreate
|OPENMODE_noreplace
, filebuf_openprot
);
1917 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1919 /* open protection*/
1921 fb3
.base
.do_lock
= 0;
1922 pret
= call_func4(p_filebuf_open
, &fb3
, filename3
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
1923 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
1924 ok(_write(fb3
.fd
, "You wouldn't\nget this from\nany other guy", 40) == 40, "_write failed\n");
1925 fb2
.base
.do_lock
= 0;
1926 pret
= call_func4(p_filebuf_open
, &fb2
, filename3
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
1927 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1928 pret
= call_func1(p_filebuf_close
, &fb2
);
1929 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
1930 fb2
.base
.do_lock
= -1;
1931 pret
= call_func1(p_filebuf_close
, &fb3
);
1932 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
1933 pret
= call_func4(p_filebuf_open
, &fb3
, filename3
, OPENMODE_in
, filebuf_sh_none
);
1934 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
1935 pret
= call_func4(p_filebuf_open
, &fb2
, filename3
, OPENMODE_in
, filebuf_openprot
);
1936 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
1937 fb3
.base
.do_lock
= -1;
1940 fb1
.base
.do_lock
= 0;
1941 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
;
1942 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1943 ret
= (int) call_func2(p_filebuf_setmode
, &fb1
, filebuf_binary
);
1944 ok(ret
== filebuf_text
, "wrong return, expected %d got %d\n", filebuf_text
, ret
);
1945 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1946 ret
= (int) call_func2(p_filebuf_setmode
, &fb1
, filebuf_binary
);
1947 ok(ret
== filebuf_binary
, "wrong return, expected %d got %d\n", filebuf_binary
, ret
);
1948 fb1
.base
.do_lock
= -1;
1949 ret
= (int) call_func2(p_filebuf_setmode
, &fb1
, 0x9000);
1950 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
1951 fb2
.base
.do_lock
= 0;
1952 ret
= (int) call_func2(p_filebuf_setmode
, &fb2
, filebuf_text
);
1953 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
1954 fb2
.base
.do_lock
= -1;
1957 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1958 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1959 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
1960 fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
1961 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1962 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "We're no strangers to love\n", 27);
1963 ok(ret
== 27, "wrong return, expected 27 got %d\n", ret
);
1964 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1965 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
1966 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
1967 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1968 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.egptr
= NULL
;
1969 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
;
1970 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1971 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "You know the rules and so do I\n", 31);
1972 ok(ret
== 31, "wrong return, expected 31 got %d\n", ret
);
1973 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1974 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1975 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1976 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1977 fb1
.base
.eback
= fb1
.base
.base
;
1978 fb1
.base
.gptr
= fb1
.base
.base
+ 190;
1979 fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
1980 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1981 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1982 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1983 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
1984 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1985 ok(_tell(fb1
.fd
) == 0, "_tell failed\n");
1986 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
;
1987 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1988 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1989 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1990 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
1991 fb1
.base
.epptr
= fb1
.base
.ebuf
;
1992 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1993 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1994 ok(fb1
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb1
.base
.epptr
);
1995 fb1
.base
.pbase
= fb1
.base
.base
;
1996 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
1997 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
1998 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
1999 fb1
.base
.pbase
= fb1
.base
.base
;
2000 fb1
.base
.epptr
= fb1
.base
.ebuf
;
2001 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
2002 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
2003 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
2004 ok(fb1
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb1
.base
.epptr
);
2005 fb1
.base
.eback
= fb1
.base
.base
;
2006 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
2007 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
2008 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
2009 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
2010 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
2011 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
2012 ok(fb1
.base
.gptr
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
2013 fb1
.base
.gptr
= fb1
.base
.base
;
2014 fb1
.base
.egptr
= fb1
.base
.base
+ 100;
2015 fb1
.base
.pbase
= fb1
.base
.base
;
2016 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
2017 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
2018 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
2019 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 100, "wrong get base, expected %p got %p\n", fb1
.base
.base
+ 100, fb1
.base
.egptr
);
2020 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
2021 fb1
.base
.egptr
= NULL
;
2022 ret
= (int) call_func1(p_filebuf_sync
, &fb1
);
2023 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
2024 ok(fb1
.base
.gptr
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
2025 ok(fb1
.base
.egptr
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
2026 ret
= (int) call_func1(p_filebuf_sync
, &fb2
);
2027 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
2028 fb3
.base
.eback
= fb3
.base
.base
;
2029 fb3
.base
.gptr
= fb3
.base
.egptr
= fb3
.base
.pbase
= fb3
.base
.pptr
= fb3
.base
.base
+ 256;
2030 fb3
.base
.epptr
= fb3
.base
.ebuf
;
2031 ret
= (int) call_func3(p_streambuf_xsputn
, &fb3
.base
, "A full commitment's what I'm thinking of\n", 41);
2032 ok(ret
== 41, "wrong return, expected 41 got %d\n", ret
);
2033 ret
= (int) call_func1(p_filebuf_sync
, &fb3
);
2034 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
2035 ok(fb3
.base
.gptr
== fb3
.base
.base
+ 256, "wrong get pointer, expected %p got %p\n", fb3
.base
.base
+ 256, fb3
.base
.gptr
);
2036 ok(fb3
.base
.pptr
== fb3
.base
.base
+ 297, "wrong put pointer, expected %p got %p\n", fb3
.base
.base
+ 297, fb3
.base
.pptr
);
2037 fb3
.base
.eback
= fb3
.base
.base
;
2038 fb3
.base
.gptr
= fb3
.base
.egptr
= fb3
.base
.pbase
= fb3
.base
.pptr
= fb3
.base
.base
+ 256;
2039 fb3
.base
.epptr
= fb3
.base
.ebuf
;
2040 ret
= (int) call_func1(p_filebuf_sync
, &fb3
);
2041 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
2042 ok(fb3
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb3
.base
.gptr
);
2043 ok(fb3
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb3
.base
.pptr
);
2044 fb3
.base
.eback
= fb3
.base
.base
;
2045 fb3
.base
.gptr
= fb3
.base
.base
+ 216;
2046 fb3
.base
.egptr
= fb3
.base
.pbase
= fb3
.base
.pptr
= fb3
.base
.base
+ 256;
2047 fb3
.base
.epptr
= fb3
.base
.ebuf
;
2048 ok(_read(fb3
.fd
, fb3
.base
.gptr
, 42) == 40, "read failed\n");
2049 ret
= (int) call_func1(p_filebuf_sync
, &fb3
);
2050 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
2051 ok(fb3
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb3
.base
.gptr
);
2052 ok(fb3
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb3
.base
.pptr
);
2053 ok(_tell(fb3
.fd
) == 0, "_tell failed\n");
2054 fb3
.base
.eback
= fb3
.base
.gptr
= fb3
.base
.egptr
= NULL
;
2055 fb3
.base
.pbase
= fb3
.base
.pptr
= fb3
.base
.epptr
= NULL
;
2058 ret
= (int) call_func2(p_filebuf_overflow
, &fb1
, EOF
);
2059 ok(ret
== 1, "wrong return, expected 1 got %d\n", ret
);
2060 fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.epptr
= NULL
;
2061 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
2062 fb1
.base
.egptr
= fb1
.base
.ebuf
;
2063 ret
= (int) call_func2(p_filebuf_overflow
, &fb1
, 'a');
2064 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2065 fb1
.base
.gptr
= fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
2066 fb1
.base
.epptr
= fb1
.base
.ebuf
;
2067 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "I just want to tell you how I'm feeling", 39);
2068 ok(ret
== 39, "wrong return, expected 39 got %d\n", ret
);
2069 ret
= (int) call_func2(p_filebuf_overflow
, &fb1
, '\n');
2070 ok(ret
== 1, "wrong return, expected 1 got %d\n", ret
);
2071 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
2072 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
2073 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 1, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.pptr
);
2074 ok(fb1
.base
.epptr
== fb1
.base
.ebuf
, "wrong put end pointer, expected %p got %p\n", fb1
.base
.ebuf
, fb1
.base
.epptr
);
2075 ok(*fb1
.base
.pbase
== '\n', "wrong character, expected '\\n' got '%c'\n", *fb1
.base
.pbase
);
2076 ret
= (int) call_func2(p_filebuf_overflow
, &fb1
, EOF
);
2077 ok(ret
== 1, "wrong return, expected 1 got %d\n", ret
);
2078 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
2079 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
2080 ok(fb1
.base
.pptr
== fb1
.base
.base
, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pptr
);
2081 ok(fb1
.base
.epptr
== fb1
.base
.ebuf
, "wrong put end pointer, expected %p got %p\n", fb1
.base
.ebuf
, fb1
.base
.epptr
);
2082 ret
= (int) call_func2(p_filebuf_overflow
, &fb2
, EOF
);
2083 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2084 fb2
.base
.do_lock
= 0;
2085 pret
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
2086 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
2087 fb2
.base
.do_lock
= -1;
2088 ret
= (int) call_func2(p_filebuf_overflow
, &fb2
, EOF
);
2089 ok(ret
== 1, "wrong return, expected 1 got %d\n", ret
);
2092 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
2093 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2094 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
2095 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
2096 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
2097 fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
2098 fb1
.base
.epptr
= fb1
.base
.ebuf
;
2099 *fb1
.base
.gptr
= 'A';
2100 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
2101 ok(ret
== 'A', "wrong return, expected 'A' got %d\n", ret
);
2102 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
2103 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 256, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 256, fb1
.base
.pptr
);
2104 *fb1
.base
.gptr
= -50;
2105 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
2106 ok(ret
== 206, "wrong return, expected 206 got %d\n", ret
);
2107 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
2108 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 256, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 256, fb1
.base
.pptr
);
2109 fb1
.base
.gptr
= fb1
.base
.ebuf
;
2110 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
2111 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2112 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
2113 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
2114 ok(_lseek(fb1
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
2115 ret
= (int) call_func1(p_filebuf_underflow
, &fb1
);
2116 ok(ret
== 'f', "wrong return, expected 'f' got %d\n", ret
);
2117 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
2118 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
2119 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 106, "wrong get end pointer, expected %p got %p\n", fb1
.base
.base
+ 106, fb1
.base
.egptr
);
2120 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
2121 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
2122 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2123 ok(_write(fb2
.fd
, "A\n", 2) == 2, "_write failed\n");
2124 ok(_lseek(fb2
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
2125 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
2126 ok(ret
== 'A', "wrong return, expected 'A' got %d\n", ret
);
2127 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
2128 ok(ret
== '\n', "wrong return, expected '\\n' got %d\n", ret
);
2129 ok(_lseek(fb2
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
2130 ok(_write(fb2
.fd
, "\xCE\n", 2) == 2, "_write failed\n");
2131 ok(_lseek(fb2
.fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
2132 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
2133 ok(ret
== 206, "wrong return, expected 206 got %d\n", ret
);
2134 fb2
.base
.do_lock
= 0;
2135 pret
= call_func1(p_filebuf_close
, &fb2
);
2136 ok(pret
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pret
);
2137 fb2
.base
.do_lock
= -1;
2138 ret
= (int) call_func1(p_filebuf_underflow
, &fb2
);
2139 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2142 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 5, SEEKDIR_beg
, 0);
2143 ok(ret
== 5, "wrong return, expected 5 got %d\n", ret
);
2144 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
2145 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
2146 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
2147 fb1
.base
.egptr
= fb1
.base
.ebuf
;
2148 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 0, SEEKDIR_beg
, 0);
2149 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2150 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.egptr
= NULL
;
2151 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 10, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
2152 ok(ret
== 10, "wrong return, expected 10 got %d\n", ret
);
2153 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 0, SEEKDIR_cur
, 0);
2154 ok(ret
== 10, "wrong return, expected 10 got %d\n", ret
);
2155 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 200, SEEKDIR_cur
, OPENMODE_in
);
2156 ok(ret
== 210, "wrong return, expected 210 got %d\n", ret
);
2157 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, -60, SEEKDIR_cur
, 0);
2158 ok(ret
== 150, "wrong return, expected 150 got %d\n", ret
);
2159 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 0, SEEKDIR_end
, 0);
2160 ok(ret
== 106, "wrong return, expected 106 got %d\n", ret
);
2161 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 20, SEEKDIR_end
, OPENMODE_out
);
2162 ok(ret
== 126, "wrong return, expected 126 got %d\n", ret
);
2163 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, -150, SEEKDIR_end
, -1);
2164 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2165 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 10, 3, 0);
2166 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2167 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 16, SEEKDIR_beg
, 0);
2168 ok(ret
== 16, "wrong return, expected 16 got %d\n", ret
);
2171 ret
= (int) call_func2(p_streambuf_pbackfail
, &fb1
.base
, 'B');
2172 ok(ret
== 'B', "wrong return, expected 'B' got %d\n", ret
);
2173 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
2174 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
2175 ok(_tell(fb1
.fd
) == 15, "_tell failed\n");
2176 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
2177 fb1
.base
.egptr
= fb1
.base
.pbase
= fb1
.base
.pptr
= fb1
.base
.base
+ 256;
2178 fb1
.base
.epptr
= fb1
.base
.ebuf
;
2179 ret
= (int) call_func2(p_streambuf_pbackfail
, &fb1
.base
, 'C');
2180 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2181 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
2182 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
2183 ok(_tell(fb1
.fd
) == 15, "_tell failed\n");
2184 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
2185 fb1
.base
.egptr
= fb1
.base
.base
+ 2;
2186 ret
= (int) call_func2(p_streambuf_pbackfail
, &fb1
.base
, 'C');
2187 ok(ret
== 'C', "wrong return, expected 'C' got %d\n", ret
);
2188 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
2189 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
2190 ok(_tell(fb1
.fd
) == 12, "_tell failed\n");
2191 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
2192 fb1
.base
.egptr
= fb1
.base
.ebuf
;
2193 *fb1
.base
.gptr
++ = 'D';
2194 ret
= (int) call_func2(p_streambuf_pbackfail
, &fb1
.base
, 'C');
2195 ok(ret
== 'C', "wrong return, expected 'C' got %d\n", ret
);
2196 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
2197 ok(*fb1
.base
.gptr
== 'C', "wrong character, expected 'C' got '%c'\n", *fb1
.base
.gptr
);
2198 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
2199 ok(_tell(fb1
.fd
) == 12, "_tell failed\n");
2200 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.egptr
= NULL
;
2203 pret
= call_func1(p_filebuf_close
, &fb2
);
2204 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
2205 fb3
.base
.do_lock
= 0;
2206 pret
= call_func1(p_filebuf_close
, &fb3
);
2207 ok(pret
== &fb3
, "wrong return, expected %p got %p\n", &fb3
, pret
);
2208 ok(fb3
.fd
== -1, "wrong fd, expected -1 got %d\n", fb3
.fd
);
2210 pret
= call_func1(p_filebuf_close
, &fb3
);
2211 ok(pret
== NULL
, "wrong return, expected %p got %p\n", NULL
, pret
);
2212 ok(fb3
.fd
== 5, "wrong fd, expected 5 got %d\n", fb3
.fd
);
2213 fb3
.base
.do_lock
= -1;
2215 SetEvent(lock_arg
.test
);
2216 WaitForSingleObject(thread
, INFINITE
);
2219 call_func1(p_filebuf_dtor
, &fb1
);
2220 ok(fb1
.fd
== -1, "wrong fd, expected -1 got %d\n", fb1
.fd
);
2221 call_func1(p_filebuf_dtor
, &fb2
);
2222 call_func1(p_filebuf_dtor
, &fb3
);
2224 ok(_unlink(filename1
) == 0, "Couldn't unlink file named '%s'\n", filename1
);
2225 ok(_unlink(filename2
) == 0, "Couldn't unlink file named '%s'\n", filename2
);
2226 ok(_unlink(filename3
) == 0, "Couldn't unlink file named '%s'\n", filename3
);
2227 CloseHandle(lock_arg
.lock
);
2228 CloseHandle(lock_arg
.test
);
2229 CloseHandle(thread
);
2232 static void test_strstreambuf(void)
2234 strstreambuf ssb1
, ssb2
;
2236 char buffer
[64], *pbuffer
;
2239 memset(&ssb1
, 0xab, sizeof(strstreambuf
));
2240 memset(&ssb2
, 0xab, sizeof(strstreambuf
));
2242 /* constructors/destructor */
2243 call_func2(p_strstreambuf_dynamic_ctor
, &ssb1
, 64);
2244 ok(ssb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb1
.base
.allocated
);
2245 ok(ssb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb1
.base
.unbuffered
);
2246 ok(ssb1
.dynamic
== 1, "expected 1, got %d\n", ssb1
.dynamic
);
2247 ok(ssb1
.increase
== 64, "expected 64, got %d\n", ssb1
.increase
);
2248 ok(ssb1
.constant
== 0, "expected 0, got %d\n", ssb1
.constant
);
2249 ok(ssb1
.f_alloc
== NULL
, "expected %p, got %p\n", NULL
, ssb1
.f_alloc
);
2250 ok(ssb1
.f_free
== NULL
, "expected %p, got %p\n", NULL
, ssb1
.f_free
);
2251 call_func1(p_strstreambuf_dtor
, &ssb1
);
2252 call_func3(p_strstreambuf_funcs_ctor
, &ssb2
, (allocFunction
)p_operator_new
, p_operator_delete
);
2253 ok(ssb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb2
.base
.allocated
);
2254 ok(ssb2
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb2
.base
.unbuffered
);
2255 ok(ssb2
.dynamic
== 1, "expected 1, got %d\n", ssb2
.dynamic
);
2256 ok(ssb2
.increase
== 1, "expected 1, got %d\n", ssb2
.increase
);
2257 ok(ssb2
.constant
== 0, "expected 0, got %d\n", ssb2
.constant
);
2258 ok(ssb2
.f_alloc
== (allocFunction
)p_operator_new
, "expected %p, got %p\n", p_operator_new
, ssb2
.f_alloc
);
2259 ok(ssb2
.f_free
== p_operator_delete
, "expected %p, got %p\n", p_operator_delete
, ssb2
.f_free
);
2260 call_func1(p_strstreambuf_dtor
, &ssb2
);
2261 memset(&ssb1
, 0xab, sizeof(strstreambuf
));
2262 memset(&ssb2
, 0xab, sizeof(strstreambuf
));
2263 call_func4(p_strstreambuf_buffer_ctor
, &ssb1
, buffer
, 64, buffer
+ 20);
2264 ok(ssb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb1
.base
.allocated
);
2265 ok(ssb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb1
.base
.unbuffered
);
2266 ok(ssb1
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb1
.base
.base
);
2267 ok(ssb1
.base
.ebuf
== buffer
+ 64, "wrong buffer end, expected %p got %p\n", buffer
+ 64, ssb1
.base
.ebuf
);
2268 ok(ssb1
.base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, ssb1
.base
.eback
);
2269 ok(ssb1
.base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, ssb1
.base
.gptr
);
2270 ok(ssb1
.base
.egptr
== buffer
+ 20, "wrong get end, expected %p got %p\n", buffer
+ 20, ssb1
.base
.egptr
);
2271 ok(ssb1
.base
.pbase
== buffer
+ 20, "wrong put base, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pbase
);
2272 ok(ssb1
.base
.pptr
== buffer
+ 20, "wrong put pointer, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pptr
);
2273 ok(ssb1
.base
.epptr
== buffer
+ 64, "wrong put end, expected %p got %p\n", buffer
+ 64, ssb1
.base
.epptr
);
2274 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
2275 ok(ssb1
.constant
== 1, "expected 1, got %d\n", ssb1
.constant
);
2276 call_func1(p_strstreambuf_dtor
, &ssb1
);
2277 strcpy(buffer
, "Test");
2278 call_func4(p_strstreambuf_buffer_ctor
, &ssb2
, buffer
, 0, buffer
+ 20);
2279 ok(ssb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb2
.base
.allocated
);
2280 ok(ssb2
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb2
.base
.unbuffered
);
2281 ok(ssb2
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb2
.base
.base
);
2282 ok(ssb2
.base
.ebuf
== buffer
+ 4, "wrong buffer end, expected %p got %p\n", buffer
+ 4, ssb2
.base
.ebuf
);
2283 ok(ssb2
.base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, ssb2
.base
.eback
);
2284 ok(ssb2
.base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, ssb2
.base
.gptr
);
2285 ok(ssb2
.base
.egptr
== buffer
+ 20, "wrong get end, expected %p got %p\n", buffer
+ 20, ssb2
.base
.egptr
);
2286 ok(ssb2
.base
.pbase
== buffer
+ 20, "wrong put base, expected %p got %p\n", buffer
+ 20, ssb2
.base
.pbase
);
2287 ok(ssb2
.base
.pptr
== buffer
+ 20, "wrong put pointer, expected %p got %p\n", buffer
+ 20, ssb2
.base
.pptr
);
2288 ok(ssb2
.base
.epptr
== buffer
+ 4, "wrong put end, expected %p got %p\n", buffer
+ 4, ssb2
.base
.epptr
);
2289 ok(ssb2
.dynamic
== 0, "expected 0, got %d\n", ssb2
.dynamic
);
2290 ok(ssb2
.constant
== 1, "expected 1, got %d\n", ssb2
.constant
);
2291 call_func1(p_strstreambuf_dtor
, &ssb2
);
2292 memset(&ssb1
, 0xab, sizeof(strstreambuf
));
2293 memset(&ssb2
, 0xab, sizeof(strstreambuf
));
2294 call_func4(p_strstreambuf_buffer_ctor
, &ssb1
, NULL
, 16, buffer
+ 20);
2295 ok(ssb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb1
.base
.allocated
);
2296 ok(ssb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb1
.base
.unbuffered
);
2297 ok(ssb1
.base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, ssb1
.base
.base
);
2298 ok(ssb1
.base
.ebuf
== (char*)16, "wrong buffer end, expected %p got %p\n", (char*)16, ssb1
.base
.ebuf
);
2299 ok(ssb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, ssb1
.base
.eback
);
2300 ok(ssb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, ssb1
.base
.gptr
);
2301 ok(ssb1
.base
.egptr
== buffer
+ 20, "wrong get end, expected %p got %p\n", buffer
+ 20, ssb1
.base
.egptr
);
2302 ok(ssb1
.base
.pbase
== buffer
+ 20, "wrong put base, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pbase
);
2303 ok(ssb1
.base
.pptr
== buffer
+ 20, "wrong put pointer, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pptr
);
2304 ok(ssb1
.base
.epptr
== (char*)16, "wrong put end, expected %p got %p\n", (char*)16, ssb1
.base
.epptr
);
2305 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
2306 ok(ssb1
.constant
== 1, "expected 1, got %d\n", ssb1
.constant
);
2307 call_func1(p_strstreambuf_dtor
, &ssb1
);
2308 call_func4(p_strstreambuf_buffer_ctor
, &ssb2
, buffer
, 0, NULL
);
2309 ok(ssb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb2
.base
.allocated
);
2310 ok(ssb2
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb2
.base
.unbuffered
);
2311 ok(ssb2
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb2
.base
.base
);
2312 ok(ssb2
.base
.ebuf
== buffer
+ 4, "wrong buffer end, expected %p got %p\n", buffer
+ 4, ssb2
.base
.ebuf
);
2313 ok(ssb2
.base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, ssb2
.base
.eback
);
2314 ok(ssb2
.base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, ssb2
.base
.gptr
);
2315 ok(ssb2
.base
.egptr
== buffer
+ 4, "wrong get end, expected %p got %p\n", buffer
+ 4, ssb2
.base
.egptr
);
2316 ok(ssb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, ssb2
.base
.pbase
);
2317 ok(ssb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, ssb2
.base
.pptr
);
2318 ok(ssb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, ssb2
.base
.epptr
);
2319 ok(ssb2
.dynamic
== 0, "expected 0, got %d\n", ssb2
.dynamic
);
2320 ok(ssb2
.constant
== 1, "expected 1, got %d\n", ssb2
.constant
);
2321 call_func1(p_strstreambuf_dtor
, &ssb2
);
2322 memset(&ssb1
, 0xab, sizeof(strstreambuf
));
2323 memset(&ssb2
, 0xab, sizeof(strstreambuf
));
2324 call_func4(p_strstreambuf_buffer_ctor
, &ssb1
, buffer
, -5, buffer
+ 20);
2325 ok(ssb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb1
.base
.allocated
);
2326 ok(ssb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb1
.base
.unbuffered
);
2327 ok(ssb1
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb1
.base
.base
);
2328 ok(ssb1
.base
.ebuf
== (char *)((ULONG_PTR
)buffer
+ 0x7fffffff) || ssb1
.base
.ebuf
== (char*)-1,
2329 "wrong buffer end, expected %p + 0x7fffffff or -1, got %p\n", buffer
, ssb1
.base
.ebuf
);
2330 ok(ssb1
.base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, ssb1
.base
.eback
);
2331 ok(ssb1
.base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, ssb1
.base
.gptr
);
2332 ok(ssb1
.base
.egptr
== buffer
+ 20, "wrong get end, expected %p got %p\n", buffer
+ 20, ssb1
.base
.egptr
);
2333 ok(ssb1
.base
.pbase
== buffer
+ 20, "wrong put base, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pbase
);
2334 ok(ssb1
.base
.pptr
== buffer
+ 20, "wrong put pointer, expected %p got %p\n", buffer
+ 20, ssb1
.base
.pptr
);
2335 ok(ssb1
.base
.epptr
== (char *)((ULONG_PTR
)buffer
+ 0x7fffffff) || ssb1
.base
.epptr
== (char*)-1,
2336 "wrong put end, expected %p + 0x7fffffff or -1, got %p\n", buffer
, ssb1
.base
.epptr
);
2337 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
2338 ok(ssb1
.constant
== 1, "expected 1, got %d\n", ssb1
.constant
);
2339 call_func1(p_strstreambuf_ctor
, &ssb2
);
2340 ok(ssb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", ssb2
.base
.allocated
);
2341 ok(ssb2
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ssb2
.base
.unbuffered
);
2342 ok(ssb2
.dynamic
== 1, "expected 1, got %d\n", ssb2
.dynamic
);
2343 ok(ssb2
.increase
== 1, "expected 1, got %d\n", ssb2
.increase
);
2344 ok(ssb2
.constant
== 0, "expected 0, got %d\n", ssb2
.constant
);
2345 ok(ssb2
.f_alloc
== NULL
, "expected %p, got %p\n", NULL
, ssb2
.f_alloc
);
2346 ok(ssb2
.f_free
== NULL
, "expected %p, got %p\n", NULL
, ssb2
.f_free
);
2349 call_func2(p_strstreambuf_freeze
, &ssb1
, 0);
2350 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
2352 call_func2(p_strstreambuf_freeze
, &ssb1
, 0);
2353 ok(ssb1
.dynamic
== 1, "expected 1, got %d\n", ssb1
.dynamic
);
2354 call_func2(p_strstreambuf_freeze
, &ssb1
, 3);
2355 ok(ssb1
.dynamic
== 0, "expected 0, got %d\n", ssb1
.dynamic
);
2357 call_func2(p_strstreambuf_freeze
, &ssb2
, 5);
2358 ok(ssb2
.dynamic
== 0, "expected 0, got %d\n", ssb2
.dynamic
);
2359 call_func2(p_strstreambuf_freeze
, &ssb2
, 0);
2360 ok(ssb2
.dynamic
== 1, "expected 1, got %d\n", ssb2
.dynamic
);
2365 ret
= (int) call_func1(p_strstreambuf_doallocate
, &ssb2
);
2366 ok(ret
== 1, "return value %d\n", ret
);
2367 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 5, "expected %p, got %p\n", ssb2
.base
.base
+ 5, ssb2
.base
.ebuf
);
2368 ssb2
.base
.eback
= ssb2
.base
.base
;
2369 ssb2
.base
.gptr
= ssb2
.base
.base
+ 2;
2370 ssb2
.base
.egptr
= ssb2
.base
.base
+ 4;
2371 strcpy(ssb2
.base
.base
, "Check");
2372 ret
= (int) call_func1(p_strstreambuf_doallocate
, &ssb2
);
2373 ok(ret
== 1, "return value %d\n", ret
);
2374 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 10, "expected %p, got %p\n", ssb2
.base
.base
+ 10, ssb2
.base
.ebuf
);
2375 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2376 ok(ssb2
.base
.gptr
== ssb2
.base
.base
+ 2, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
+ 2, ssb2
.base
.gptr
);
2377 ok(ssb2
.base
.egptr
== ssb2
.base
.base
+ 4, "wrong get end, expected %p got %p\n", ssb2
.base
.base
+ 4, ssb2
.base
.egptr
);
2378 ok(!strncmp(ssb2
.base
.base
, "Check", 5), "strings are not equal\n");
2379 ssb2
.base
.pbase
= ssb2
.base
.pptr
= ssb2
.base
.base
+ 4;
2380 ssb2
.base
.epptr
= ssb2
.base
.ebuf
;
2382 ret
= (int) call_func1(p_strstreambuf_doallocate
, &ssb2
);
2383 ok(ret
== 1, "return value %d\n", ret
);
2384 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 11, "expected %p, got %p\n", ssb2
.base
.base
+ 11, ssb2
.base
.ebuf
);
2385 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 4, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 4, ssb2
.base
.pbase
);
2386 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 4, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 4, ssb2
.base
.pptr
);
2387 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 10, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 10, ssb2
.base
.epptr
);
2388 ok(!strncmp(ssb2
.base
.base
, "Check", 5), "strings are not equal\n");
2392 pret
= call_func3(p_strstreambuf_setbuf
, &ssb1
, buffer
+ 16, 16);
2393 ok(pret
== &ssb1
.base
, "expected %p got %p\n", &ssb1
.base
, pret
);
2394 ok(ssb1
.base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ssb1
.base
.base
);
2395 ok(ssb1
.increase
== 16, "expected 16, got %d\n", ssb1
.increase
);
2396 pret
= call_func3(p_strstreambuf_setbuf
, &ssb2
, NULL
, 2);
2397 ok(pret
== &ssb2
.base
, "expected %p got %p\n", &ssb2
.base
, pret
);
2398 ok(ssb2
.increase
== 2, "expected 2, got %d\n", ssb2
.increase
);
2399 pret
= call_func3(p_strstreambuf_setbuf
, &ssb2
, buffer
, 0);
2400 ok(pret
== &ssb2
.base
, "expected %p got %p\n", &ssb2
.base
, pret
);
2401 ok(ssb2
.increase
== 2, "expected 2, got %d\n", ssb2
.increase
);
2402 pret
= call_func3(p_strstreambuf_setbuf
, &ssb2
, NULL
, -2);
2403 ok(pret
== &ssb2
.base
, "expected %p got %p\n", &ssb2
.base
, pret
);
2404 ok(ssb2
.increase
== -2, "expected -2, got %d\n", ssb2
.increase
);
2407 ssb1
.base
.epptr
= ssb1
.base
.ebuf
= ssb1
.base
.base
+ 64;
2408 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2409 ok(ret
== 'T', "expected 'T' got %d\n", ret
);
2410 ssb1
.base
.gptr
= ssb1
.base
.egptr
;
2411 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2412 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2413 ret
= (int) call_func3(p_streambuf_xsputn
, &ssb1
.base
, "Gotta make you understand", 5);
2414 ok(ret
== 5, "expected 5 got %d\n", ret
);
2415 ok(ssb1
.base
.pptr
== buffer
+ 25, "wrong put pointer, expected %p got %p\n", buffer
+ 25, ssb1
.base
.pptr
);
2416 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2417 ok(ret
== 'G', "expected 'G' got %d\n", ret
);
2418 ok(ssb1
.base
.egptr
== buffer
+ 25, "wrong get end, expected %p got %p\n", buffer
+ 25, ssb1
.base
.egptr
);
2419 *ssb1
.base
.gptr
= -50;
2420 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2421 ok(ret
== 206, "expected 206 got %d\n", ret
);
2422 ok(ssb1
.base
.egptr
== buffer
+ 25, "wrong get end, expected %p got %p\n", buffer
+ 25, ssb1
.base
.egptr
);
2423 ssb1
.base
.gptr
= ssb1
.base
.egptr
= ssb1
.base
.pptr
= ssb1
.base
.epptr
;
2424 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb1
);
2425 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2426 ssb2
.base
.eback
= ssb2
.base
.gptr
= ssb2
.base
.egptr
= NULL
;
2427 ssb2
.base
.pbase
= ssb2
.base
.pptr
= ssb2
.base
.epptr
= NULL
;
2428 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2429 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2430 ssb2
.base
.pbase
= ssb2
.base
.pptr
= ssb2
.base
.base
;
2431 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2432 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2433 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2434 ok(ssb2
.base
.gptr
== ssb2
.base
.base
, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2435 ok(ssb2
.base
.egptr
== ssb2
.base
.base
, "wrong get end, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.egptr
);
2436 ssb2
.base
.pptr
= ssb2
.base
.base
+ 3;
2437 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2438 ok(ret
== 'C', "expected 'C' got %d\n", ret
);
2439 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2440 ok(ssb2
.base
.gptr
== ssb2
.base
.base
, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2441 ok(ssb2
.base
.egptr
== ssb2
.base
.base
+ 3, "wrong get end, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.egptr
);
2442 ssb2
.base
.gptr
= ssb2
.base
.base
+ 2;
2443 ssb2
.base
.egptr
= NULL
;
2444 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2445 ok(ret
== 'e', "expected 'e' got %d\n", ret
);
2446 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2447 ok(ssb2
.base
.gptr
== ssb2
.base
.base
+ 2, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2448 ok(ssb2
.base
.egptr
== ssb2
.base
.base
+ 3, "wrong get end, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.egptr
);
2449 ssb2
.base
.eback
= ssb2
.base
.egptr
= ssb2
.base
.base
+ 1;
2450 ssb2
.base
.gptr
= ssb2
.base
.base
+ 3;
2451 ssb2
.base
.pptr
= ssb2
.base
.base
+ 5;
2452 *(ssb2
.base
.base
+ 2) = -50;
2453 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2454 ok(ret
== 206, "expected 206 got %d\n", ret
);
2455 ok(ssb2
.base
.eback
== ssb2
.base
.base
, "wrong get base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.eback
);
2456 ok(ssb2
.base
.gptr
== ssb2
.base
.base
+ 2, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2457 ok(ssb2
.base
.egptr
== ssb2
.base
.base
+ 5, "wrong get end, expected %p got %p\n", ssb2
.base
.base
+ 5, ssb2
.base
.egptr
);
2458 ssb2
.base
.eback
= ssb2
.base
.base
;
2459 ssb2
.base
.gptr
= ssb2
.base
.egptr
= ssb2
.base
.ebuf
;
2460 ssb2
.base
.pbase
= ssb2
.base
.pptr
= NULL
;
2461 ret
= (int) call_func1(p_strstreambuf_underflow
, &ssb2
);
2462 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2465 ssb1
.base
.pptr
= ssb1
.base
.epptr
- 1;
2466 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb1
, EOF
);
2467 ok(ret
== 1, "expected 1 got %d\n", ret
);
2468 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb1
, 'A');
2469 ok(ret
== 1, "expected 1 got %d\n", ret
);
2470 ok(ssb1
.base
.pptr
== ssb1
.base
.epptr
, "wrong put pointer, expected %p got %p\n", ssb1
.base
.epptr
, ssb1
.base
.pptr
);
2471 ok(*(ssb1
.base
.pptr
- 1) == 'A', "expected 'A' got %d\n", *(ssb1
.base
.pptr
- 1));
2472 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb1
, 'B');
2473 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2474 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb1
, EOF
);
2475 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2477 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'C');
2478 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2480 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'C');
2481 ok(ret
== 1, "expected 1 got %d\n", ret
);
2482 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 12, "expected %p got %p\n", ssb2
.base
.base
+ 12, ssb2
.base
.ebuf
);
2483 ok(ssb2
.base
.gptr
== ssb2
.base
.base
+ 11, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
+ 11, ssb2
.base
.gptr
);
2484 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 11, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 11, ssb2
.base
.pbase
);
2485 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 12, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 12, ssb2
.base
.pptr
);
2486 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 12, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 12, ssb2
.base
.epptr
);
2487 ok(*(ssb2
.base
.pptr
- 1) == 'C', "expected 'C' got %d\n", *(ssb2
.base
.pptr
- 1));
2489 ssb2
.base
.eback
= ssb2
.base
.gptr
= ssb2
.base
.egptr
= NULL
;
2490 ssb2
.base
.pbase
= ssb2
.base
.pptr
= ssb2
.base
.epptr
= NULL
;
2491 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'D');
2492 ok(ret
== 1, "expected 1 got %d\n", ret
);
2493 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 16, "expected %p got %p\n", ssb2
.base
.base
+ 16, ssb2
.base
.ebuf
);
2494 ok(ssb2
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, ssb2
.base
.gptr
);
2495 ok(ssb2
.base
.pbase
== ssb2
.base
.base
, "wrong put base, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.pbase
);
2496 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 1, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 1, ssb2
.base
.pptr
);
2497 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 16, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 16, ssb2
.base
.epptr
);
2498 ok(*(ssb2
.base
.pptr
- 1) == 'D', "expected 'D' got %d\n", *(ssb2
.base
.pptr
- 1));
2499 ssb2
.base
.pbase
= ssb2
.base
.base
+ 3;
2500 ssb2
.base
.pptr
= ssb2
.base
.epptr
+ 5;
2501 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'E');
2502 ok(ret
== 1, "expected 1 got %d\n", ret
);
2503 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 20, "expected %p got %p\n", ssb2
.base
.base
+ 20, ssb2
.base
.ebuf
);
2504 ok(ssb2
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, ssb2
.base
.gptr
);
2505 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 3, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.pbase
);
2506 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 22, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 22, ssb2
.base
.pptr
);
2507 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 20, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 20, ssb2
.base
.epptr
);
2508 ok(*(ssb2
.base
.pptr
- 1) == 'E', "expected 'E' got %d\n", *(ssb2
.base
.pptr
- 1));
2509 ssb2
.base
.egptr
= ssb2
.base
.base
+ 2;
2510 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'F');
2511 ok(ret
== 1, "expected 1 got %d\n", ret
);
2512 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 24, "expected %p got %p\n", ssb2
.base
.base
+ 24, ssb2
.base
.ebuf
);
2513 ok(ssb2
.base
.gptr
!= NULL
, "wrong get pointer, expected != NULL\n");
2514 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 3, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.pbase
);
2515 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 23, ssb2
.base
.pptr
);
2516 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 24, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 24, ssb2
.base
.epptr
);
2517 ok(*(ssb2
.base
.pptr
- 1) == 'F', "expected 'F' got %d\n", *(ssb2
.base
.pptr
- 1));
2518 ssb2
.base
.eback
= ssb2
.base
.gptr
= ssb2
.base
.base
;
2519 ssb2
.base
.epptr
= NULL
;
2520 ret
= (int) call_func2(p_strstreambuf_overflow
, &ssb2
, 'G');
2521 ok(ret
== 1, "expected 1 got %d\n", ret
);
2522 ok(ssb2
.base
.ebuf
== ssb2
.base
.base
+ 28, "expected %p got %p\n", ssb2
.base
.base
+ 28, ssb2
.base
.ebuf
);
2523 ok(ssb2
.base
.gptr
== ssb2
.base
.base
, "wrong get pointer, expected %p got %p\n", ssb2
.base
.base
, ssb2
.base
.gptr
);
2524 ok(ssb2
.base
.pbase
== ssb2
.base
.base
+ 2, "wrong put base, expected %p got %p\n", ssb2
.base
.base
+ 2, ssb2
.base
.pbase
);
2525 ok(ssb2
.base
.pptr
== ssb2
.base
.base
+ 3, "wrong put pointer, expected %p got %p\n", ssb2
.base
.base
+ 3, ssb2
.base
.pptr
);
2526 ok(ssb2
.base
.epptr
== ssb2
.base
.base
+ 28, "wrong put end, expected %p got %p\n", ssb2
.base
.base
+ 28, ssb2
.base
.epptr
);
2527 ok(*(ssb2
.base
.pptr
- 1) == 'G', "expected 'G' got %d\n", *(ssb2
.base
.pptr
- 1));
2530 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 0, SEEKDIR_beg
, OPENMODE_in
);
2531 ok(ret
== 0, "expected 0 got %d\n", ret
);
2532 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
, ssb1
.base
.gptr
);
2533 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 3, SEEKDIR_beg
, OPENMODE_in
);
2534 ok(ret
== 3, "expected 3 got %d\n", ret
);
2535 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 3, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 3, ssb1
.base
.gptr
);
2536 ssb1
.base
.egptr
= ssb1
.base
.pbase
;
2537 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 25, SEEKDIR_beg
, OPENMODE_in
);
2538 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2539 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 3, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 3, ssb1
.base
.gptr
);
2540 ssb1
.base
.gptr
= ssb1
.base
.egptr
;
2541 ssb1
.base
.pptr
= ssb1
.base
.pbase
+ 10;
2542 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 25, SEEKDIR_beg
, OPENMODE_in
);
2543 ok(ret
== 25, "expected 25 got %d\n", ret
);
2544 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 25, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 25, ssb1
.base
.gptr
);
2545 ok(ssb1
.base
.egptr
== ssb1
.base
.pptr
, "wrong get end, expected %p got %p\n", ssb1
.base
.pptr
, ssb1
.base
.egptr
);
2546 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -24, SEEKDIR_cur
, OPENMODE_in
);
2547 ok(ret
== 1, "expected 1 got %d\n", ret
);
2548 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 1, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 1, ssb1
.base
.gptr
);
2549 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -5, SEEKDIR_cur
, OPENMODE_in
);
2550 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2551 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 1, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 1, ssb1
.base
.gptr
);
2552 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 0, SEEKDIR_end
, OPENMODE_in
);
2553 ok(ret
== 30, "expected 30 got %d\n", ret
);
2554 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
, ssb1
.base
.gptr
);
2555 ssb1
.base
.gptr
= ssb1
.base
.eback
;
2556 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -2, SEEKDIR_end
, OPENMODE_in
);
2557 ok(ret
== 28, "expected 28 got %d\n", ret
);
2558 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
- 2, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
- 2, ssb1
.base
.gptr
);
2559 ssb1
.base
.gptr
= ssb1
.base
.egptr
;
2560 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -5, SEEKDIR_end
, OPENMODE_in
);
2561 ok(ret
== 25, "expected 25 got %d\n", ret
);
2562 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
- 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
- 5, ssb1
.base
.gptr
);
2563 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 1, SEEKDIR_end
, OPENMODE_in
);
2564 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2565 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
- 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
- 5, ssb1
.base
.gptr
);
2566 ssb1
.base
.gptr
= ssb1
.base
.egptr
;
2567 ssb1
.base
.pptr
= ssb1
.base
.egptr
+ 5;
2568 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 1, SEEKDIR_end
, OPENMODE_in
);
2569 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2570 ok(ssb1
.base
.gptr
== ssb1
.base
.egptr
- 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.egptr
- 5, ssb1
.base
.gptr
);
2571 ok(ssb1
.base
.egptr
== ssb1
.base
.pptr
, "wrong get end, expected %p got %p\n", ssb1
.base
.pptr
, ssb1
.base
.egptr
);
2572 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 3, SEEKDIR_beg
, OPENMODE_out
);
2573 ok(ret
== 3, "expected 3 got %d\n", ret
);
2574 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 3, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 3, ssb1
.base
.pptr
);
2575 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -2, SEEKDIR_beg
, OPENMODE_out
);
2576 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2577 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 3, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 3, ssb1
.base
.pptr
);
2578 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 50, SEEKDIR_beg
, OPENMODE_out
);
2579 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2580 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 3, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 3, ssb1
.base
.pptr
);
2581 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 5, SEEKDIR_cur
, OPENMODE_out
);
2582 ok(ret
== 8, "expected 8 got %d\n", ret
);
2583 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 8, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 8, ssb1
.base
.pptr
);
2584 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, -2, SEEKDIR_end
, OPENMODE_out
);
2585 ok(ret
== 42, "expected 42 got %d\n", ret
);
2586 ok(ssb1
.base
.pptr
== ssb1
.base
.epptr
- 2, "wrong put pointer, expected %p got %p\n", ssb1
.base
.epptr
- 2, ssb1
.base
.pptr
);
2587 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 0, SEEKDIR_end
, OPENMODE_out
);
2588 ok(ret
== 44, "expected 44 got %d\n", ret
);
2589 ok(ssb1
.base
.pptr
== ssb1
.base
.epptr
, "wrong put pointer, expected %p got %p\n", ssb1
.base
.epptr
, ssb1
.base
.pptr
);
2590 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 5, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
2591 ok(ret
== 5, "expected 5 got %d\n", ret
);
2592 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 5, ssb1
.base
.gptr
);
2593 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 5, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 5, ssb1
.base
.pptr
);
2594 ssb1
.base
.egptr
= ssb1
.base
.pbase
;
2595 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 21, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
2596 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2597 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 5, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 5, ssb1
.base
.gptr
);
2598 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 5, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 5, ssb1
.base
.pptr
);
2599 ssb1
.base
.egptr
= ssb1
.base
.epptr
;
2600 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 50, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
2601 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2602 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 50, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 50, ssb1
.base
.gptr
);
2603 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 5, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 5, ssb1
.base
.pptr
);
2604 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb1
, 2, SEEKDIR_cur
, OPENMODE_in
|OPENMODE_out
);
2605 ok(ret
== 7, "expected 7 got %d\n", ret
);
2606 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 52, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 52, ssb1
.base
.gptr
);
2607 ok(ssb1
.base
.pptr
== ssb1
.base
.pbase
+ 7, "wrong put pointer, expected %p got %p\n", ssb1
.base
.pbase
+ 7, ssb1
.base
.pptr
);
2608 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, 0, SEEKDIR_beg
, OPENMODE_in
|OPENMODE_out
);
2609 ok(ret
== 0, "expected 0 got %d\n", ret
);
2610 ok(ssb2
.base
.gptr
== ssb2
.base
.eback
, "wrong get pointer, expected %p got %p\n", ssb2
.base
.eback
, ssb2
.base
.gptr
);
2611 ok(ssb2
.base
.pptr
== ssb2
.base
.pbase
, "wrong put pointer, expected %p got %p\n", ssb2
.base
.pbase
, ssb2
.base
.pptr
);
2612 ssb2
.base
.gptr
= ssb2
.base
.egptr
;
2613 ssb2
.base
.pptr
+= 10;
2614 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, 5, SEEKDIR_cur
, OPENMODE_in
|OPENMODE_out
);
2615 ok(ret
== 15, "expected 15 got %d\n", ret
);
2616 ok(ssb2
.base
.gptr
== ssb2
.base
.eback
+ 7, "wrong get pointer, expected %p got %p\n", ssb2
.base
.eback
+ 7, ssb2
.base
.gptr
);
2617 ok(ssb2
.base
.egptr
== ssb2
.base
.eback
+ 12, "wrong get end, expected %p got %p\n", ssb2
.base
.eback
+ 12, ssb2
.base
.egptr
);
2618 ok(ssb2
.base
.pptr
== ssb2
.base
.pbase
+ 15, "wrong put pointer, expected %p got %p\n", ssb2
.base
.pbase
+ 15, ssb2
.base
.pptr
);
2619 ssb2
.base
.pptr
= ssb2
.base
.epptr
;
2620 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, -1, SEEKDIR_cur
, OPENMODE_in
|OPENMODE_out
);
2621 ok(ret
== 25, "expected 25 got %d\n", ret
);
2622 ok(ssb2
.base
.gptr
== ssb2
.base
.eback
+ 6, "wrong get pointer, expected %p got %p\n", ssb2
.base
.eback
+ 6, ssb2
.base
.gptr
);
2623 ok(ssb2
.base
.pptr
== ssb2
.base
.pbase
+ 25, "wrong put pointer, expected %p got %p\n", ssb2
.base
.pbase
+ 25, ssb2
.base
.pptr
);
2624 pbuffer
= ssb2
.base
.pbase
;
2625 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, 50, SEEKDIR_beg
, OPENMODE_out
);
2626 ok(ret
== 50, "expected 50 got %d\n", ret
);
2627 ok(ssb2
.base
.gptr
== ssb2
.base
.eback
+ 6, "wrong get pointer, expected %p got %p\n", ssb2
.base
.eback
+ 6, ssb2
.base
.gptr
);
2628 ok(ssb2
.base
.pptr
== pbuffer
+ 50, "wrong put pointer, expected %p got %p\n", pbuffer
+ 50, ssb2
.base
.pptr
);
2629 ok(ssb2
.increase
== 50, "expected 50 got %d\n", ssb2
.increase
);
2630 ssb2
.base
.epptr
= NULL
;
2632 ret
= (int) call_func4(p_strstreambuf_seekoff
, &ssb2
, 0, SEEKDIR_end
, OPENMODE_out
);
2633 ok(ret
== 74, "expected 74 got %d\n", ret
);
2634 ok(ssb2
.base
.pptr
== ssb2
.base
.epptr
, "wrong put pointer, expected %p got %p\n", ssb2
.base
.epptr
, ssb2
.base
.pptr
);
2637 *(ssb1
.base
.gptr
-1) = 'A';
2638 ret
= (int) call_func2(p_streambuf_pbackfail
, &ssb1
.base
, 'X');
2639 ok(ret
== 'X', "wrong return, expected 'X' got %d\n", ret
);
2640 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
+ 51, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
+ 51, ssb1
.base
.gptr
);
2641 ok(*ssb1
.base
.gptr
== 'X', "expected 'X' got '%c'\n", *ssb1
.base
.gptr
);
2642 ssb1
.base
.gptr
= ssb1
.base
.eback
;
2643 ret
= (int) call_func2(p_streambuf_pbackfail
, &ssb1
.base
, 'Y');
2644 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
2645 ssb1
.base
.gptr
= ssb1
.base
.eback
+ 1;
2646 ret
= (int) call_func2(p_streambuf_pbackfail
, &ssb1
.base
, EOF
);
2647 ok(ret
== (char)EOF
, "wrong return, expected EOF got %d\n", ret
);
2648 ok(ssb1
.base
.gptr
== ssb1
.base
.eback
, "wrong get pointer, expected %p got %p\n", ssb1
.base
.eback
, ssb1
.base
.gptr
);
2649 ok((signed char)*ssb1
.base
.gptr
== EOF
, "expected EOF got '%c'\n", *ssb1
.base
.gptr
);
2651 call_func1(p_strstreambuf_dtor
, &ssb1
);
2652 call_func1(p_strstreambuf_dtor
, &ssb2
);
2655 static void test_stdiobuf(void)
2657 stdiobuf stb1
, stb2
;
2658 FILE *file1
, *file2
;
2659 const char filename1
[] = "stdiobuf_test1";
2660 const char filename2
[] = "stdiobuf_test2";
2664 memset(&stb1
, 0xab, sizeof(stdiobuf
));
2665 memset(&stb2
, 0xab, sizeof(stdiobuf
));
2667 file1
= fopen(filename1
, "w");
2668 fputs("Never gonna give you up, never gonna let you down", file1
);
2670 file1
= fopen(filename1
, "r");
2671 ok(file1
!= NULL
, "Couldn't open the file named '%s'\n", filename1
);
2672 file2
= fopen(filename2
, "w+");
2673 ok(file2
!= NULL
, "Couldn't open the file named '%s'\n", filename2
);
2675 /* constructors/destructor */
2676 call_func2(p_stdiobuf_file_ctor
, &stb1
, NULL
);
2677 ok(stb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", stb1
.base
.allocated
);
2678 ok(stb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", stb1
.base
.unbuffered
);
2679 ok(stb1
.file
== NULL
, "wrong file pointer, expected %p got %p\n", NULL
, stb1
.file
);
2680 call_func1(p_stdiobuf_dtor
, &stb1
);
2681 call_func2(p_stdiobuf_file_ctor
, &stb1
, file1
);
2682 ok(stb1
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", stb1
.base
.allocated
);
2683 ok(stb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", stb1
.base
.unbuffered
);
2684 ok(stb1
.file
== file1
, "wrong file pointer, expected %p got %p\n", file1
, stb1
.file
);
2685 call_func2(p_stdiobuf_file_ctor
, &stb2
, file2
);
2686 ok(stb2
.base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", stb2
.base
.allocated
);
2687 ok(stb2
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", stb2
.base
.unbuffered
);
2688 ok(stb2
.file
== file2
, "wrong file pointer, expected %p got %p\n", file2
, stb2
.file
);
2691 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, EOF
);
2692 ok(ret
== 1, "expected 1 got %d\n", ret
);
2693 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, 'a');
2694 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2695 stb1
.base
.unbuffered
= 0;
2696 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, 'a');
2697 ok(ret
== 1, "expected 1 got %d\n", ret
);
2698 ok(stb1
.base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", stb1
.base
.allocated
);
2699 ok(stb1
.base
.ebuf
== stb1
.base
.base
+ 512, "expected %p got %p\n", stb1
.base
.base
+ 512, stb1
.base
.ebuf
);
2700 ok(stb1
.base
.pbase
== stb1
.base
.base
+ 256, "wrong put base, expected %p got %p\n", stb1
.base
.base
+ 256, stb1
.base
.pbase
);
2701 ok(stb1
.base
.pptr
== stb1
.base
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
+ 1, stb1
.base
.pptr
);
2702 ok(stb1
.base
.epptr
== stb1
.base
.ebuf
, "wrong put end, expected %p got %p\n", stb1
.base
.ebuf
, stb1
.base
.epptr
);
2703 ok(*(stb1
.base
.pptr
-1) == 'a', "expected 'a', got '%c'\n", *(stb1
.base
.pptr
-1));
2704 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, EOF
);
2705 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2706 ok(stb1
.base
.pptr
== stb1
.base
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
+ 1, stb1
.base
.pptr
);
2707 stb1
.base
.pptr
= stb1
.base
.pbase
;
2708 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, EOF
);
2709 ok(ret
== 1, "expected 1 got %d\n", ret
);
2710 ok(stb1
.base
.pptr
== stb1
.base
.pbase
, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
, stb1
.base
.pptr
);
2711 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb1
, 'b');
2712 ok(ret
== 1, "expected 1 got %d\n", ret
);
2713 ok(stb1
.base
.pptr
== stb1
.base
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
+ 1, stb1
.base
.pptr
);
2714 ok(*(stb1
.base
.pptr
-1) == 'b', "expected 'b', got '%c'\n", *(stb1
.base
.pptr
-1));
2715 stb1
.base
.unbuffered
= 1;
2716 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, EOF
);
2717 ok(ret
== 1, "expected 1 got %d\n", ret
);
2718 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, 'a');
2719 ok(ret
== 'a', "expected 'a' got %d\n", ret
);
2720 stb2
.base
.unbuffered
= 0;
2721 stb2
.base
.base
= buffer
;
2722 stb2
.base
.pbase
= stb2
.base
.pptr
= buffer
+ 32;
2723 stb2
.base
.ebuf
= stb2
.base
.epptr
= buffer
+ 64;
2724 ret
= (int) call_func3(p_streambuf_xsputn
, &stb2
.base
, "Never gonna run around", 22);
2725 ok(ret
== 22, "expected 22 got %d\n", ret
);
2726 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, 'c');
2727 ok(ret
== 1, "expected 1 got %d\n", ret
);
2728 ok(stb2
.base
.pptr
== stb2
.base
.pbase
+ 1, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
+ 1, stb2
.base
.pptr
);
2729 ok(*(stb2
.base
.pptr
-1) == 'c', "expected 'c', got '%c'\n", *(stb2
.base
.pptr
-1));
2730 stb2
.base
.pbase
= stb2
.base
.pptr
+ 3;
2731 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, 'd');
2732 ok(ret
== 1, "expected 1 got %d\n", ret
);
2733 ok(stb2
.base
.pptr
== stb2
.base
.pbase
- 2, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
- 2, stb2
.base
.pptr
);
2734 ok(*(stb2
.base
.pptr
-1) == 'd', "expected 'd', got '%c'\n", *(stb2
.base
.pptr
-1));
2735 stb2
.base
.pbase
= stb2
.base
.pptr
= buffer
+ 32;
2736 stb2
.base
.epptr
= buffer
+ 30;
2737 ret
= (int) call_func2(p_stdiobuf_overflow
, &stb2
, 'd');
2738 ok(ret
== 'd', "expected 'd' got %d\n", ret
);
2739 ok(stb2
.base
.pptr
== stb2
.base
.pbase
, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
, stb2
.base
.pptr
);
2740 stb2
.base
.epptr
= buffer
+ 64;
2741 stb2
.base
.unbuffered
= 1;
2744 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2745 ok(ret
== 'N', "expected 'N' got %d\n", ret
);
2746 stb1
.base
.unbuffered
= 0;
2747 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2748 ok(ret
== 'e', "expected 'e' got %d\n", ret
);
2749 ok(stb1
.base
.eback
== stb1
.base
.base
, "wrong get base, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.eback
);
2750 ok(stb1
.base
.gptr
== stb1
.base
.egptr
- 47, "wrong get pointer, expected %p got %p\n", stb1
.base
.egptr
- 47, stb1
.base
.gptr
);
2751 ok(stb1
.base
.egptr
== stb1
.base
.base
+ 256, "wrong get end, expected %p got %p\n", stb1
.base
.base
+ 256, stb1
.base
.egptr
);
2752 ok(*stb1
.base
.gptr
== 'v', "expected 'v' got '%c'\n", *stb1
.base
.gptr
);
2753 stb1
.base
.pbase
= stb1
.base
.pptr
= stb1
.base
.epptr
= NULL
;
2754 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2755 ok(ret
== 'v', "expected 'v' got %d\n", ret
);
2756 ok(stb1
.base
.gptr
== stb1
.base
.egptr
- 46, "wrong get pointer, expected %p got %p\n", stb1
.base
.egptr
- 46, stb1
.base
.gptr
);
2757 *stb1
.base
.gptr
= -50;
2758 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2759 ok(ret
== 206, "expected 206 got %d\n", ret
);
2760 ok(stb1
.base
.gptr
== stb1
.base
.egptr
- 45, "wrong get pointer, expected %p got %p\n", stb1
.base
.egptr
- 45, stb1
.base
.gptr
);
2761 stb1
.base
.gptr
= stb1
.base
.egptr
;
2762 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2763 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2764 stb1
.base
.unbuffered
= 1;
2765 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb1
);
2766 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2768 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2769 ok(ret
== 'a', "expected 'a' got %d\n", ret
);
2770 stb2
.base
.unbuffered
= 0;
2771 stb2
.base
.eback
= stb2
.base
.gptr
= buffer
+ 16;
2772 stb2
.base
.egptr
= buffer
+ 32;
2773 strcpy(buffer
+ 16, "and desert you");
2774 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2775 ok(ret
== 'a', "expected 'a' got %d\n", ret
);
2776 ok(stb2
.base
.gptr
== buffer
+ 17, "wrong get pointer, expected %p got %p\n", buffer
+ 17, stb2
.base
.gptr
);
2777 stb2
.base
.eback
= buffer
;
2778 stb2
.base
.gptr
= stb2
.base
.egptr
;
2779 stb2
.base
.pbase
= stb2
.base
.pptr
= stb2
.base
.epptr
= NULL
;
2780 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2781 ok(ret
== 'N', "expected 'N' got %d\n", ret
);
2782 ok(stb2
.base
.gptr
== stb2
.base
.egptr
- 22, "wrong get pointer, expected %p got %p\n", stb2
.base
.egptr
- 22, stb2
.base
.gptr
);
2783 ok(ftell(stb2
.file
) == 24, "ftell failed\n");
2784 stb2
.base
.gptr
= stb2
.base
.egptr
;
2785 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2786 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2787 stb2
.base
.unbuffered
= 1;
2788 ret
= (int) call_func1(p_stdiobuf_underflow
, &stb2
);
2789 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2792 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2793 ok(ret
== 0, "expected 0 got %d\n", ret
);
2794 stb1
.base
.gptr
= stb1
.base
.eback
;
2795 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2796 ok(ret
== 0, "expected 0 got %d\n", ret
);
2797 stb1
.base
.unbuffered
= 0;
2798 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2799 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2800 ok(stb1
.base
.pbase
== stb1
.base
.base
+ 256, "wrong put base, expected %p got %p\n", stb1
.base
.base
+ 256, stb1
.base
.pbase
);
2801 ok(stb1
.base
.pptr
== stb1
.base
.base
+ 256, "wrong put pointer, expected %p got %p\n", stb1
.base
.base
+ 256, stb1
.base
.pptr
);
2802 ok(stb1
.base
.epptr
== stb1
.base
.base
+ 512, "wrong put end, expected %p got %p\n", stb1
.base
.base
+ 512, stb1
.base
.epptr
);
2803 stb1
.base
.gptr
= stb1
.base
.egptr
;
2804 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2805 ok(ret
== 0, "expected 0 got %d\n", ret
);
2806 stb1
.base
.eback
= stb1
.base
.gptr
= stb1
.base
.egptr
= NULL
;
2807 stb1
.base
.pptr
= stb1
.base
.epptr
;
2808 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2809 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2810 ok(stb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, stb1
.base
.gptr
);
2811 stb1
.base
.pptr
= stb1
.base
.pbase
;
2812 ret
= (int) call_func1(p_stdiobuf_sync
, &stb1
);
2813 ok(ret
== 0, "expected 0 got %d\n", ret
);
2814 ok(stb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, stb1
.base
.gptr
);
2815 stb1
.base
.unbuffered
= 1;
2816 stb2
.base
.unbuffered
= 0;
2817 stb2
.base
.egptr
= stb2
.base
.ebuf
;
2818 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2819 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2820 ok(stb2
.base
.pbase
== stb2
.base
.base
+ 32, "wrong put base, expected %p got %p\n", stb2
.base
.base
+ 32, stb2
.base
.pbase
);
2821 ok(stb2
.base
.pptr
== stb2
.base
.base
+ 32, "wrong put pointer, expected %p got %p\n", stb2
.base
.base
+ 32, stb2
.base
.pptr
);
2822 ok(stb2
.base
.epptr
== stb2
.base
.base
+ 64, "wrong put end, expected %p got %p\n", stb2
.base
.base
+ 64, stb2
.base
.epptr
);
2823 stb2
.base
.egptr
= stb2
.base
.pbase
;
2824 stb2
.base
.gptr
= stb2
.base
.egptr
- 25;
2825 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2826 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2827 ret
= (int) call_func3(p_streambuf_xsputn
, &stb2
.base
, "Never gonna make you cry", 24);
2828 ok(ret
== 24, "expected 24 got %d\n", ret
);
2829 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2830 ok(ret
== 0, "expected 0 got %d\n", ret
);
2831 ok(ftell(stb2
.file
) == 23, "ftell failed\n");
2832 ok(fseek(stb2
.file
, 3, SEEK_SET
) == 0, "fseek failed\n");
2833 stb2
.base
.gptr
= stb2
.base
.egptr
- 3;
2834 strcpy(stb2
.base
.gptr
, "a\nc");
2835 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2836 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2837 ok(stb2
.base
.gptr
== stb2
.base
.egptr
- 3, "wrong get pointer, expected %p got %p\n", stb2
.base
.egptr
- 3, stb2
.base
.gptr
);
2838 *(stb2
.base
.gptr
+1) = 'b';
2839 ret
= (int) call_func1(p_stdiobuf_sync
, &stb2
);
2840 ok(ret
== 0, "expected 0 got %d\n", ret
);
2841 ok(stb2
.base
.gptr
== stb2
.base
.egptr
, "wrong get pointer, expected %p got %p\n", stb2
.base
.egptr
, stb2
.base
.gptr
);
2842 stb2
.base
.unbuffered
= 1;
2845 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, 100, 60);
2846 ok(ret
== 1, "expected 1 got %d\n", ret
);
2847 ok(stb1
.base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", stb1
.base
.allocated
);
2848 ok(stb1
.base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", stb1
.base
.unbuffered
);
2849 ok(stb1
.base
.ebuf
== stb1
.base
.base
+ 160, "expected %p got %p\n", stb1
.base
.base
+ 160, stb1
.base
.ebuf
);
2850 ok(stb1
.base
.eback
== stb1
.base
.base
, "wrong get base, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.eback
);
2851 ok(stb1
.base
.gptr
== stb1
.base
.base
+ 100, "wrong get pointer, expected %p got %p\n", stb1
.base
.base
+ 100, stb1
.base
.gptr
);
2852 ok(stb1
.base
.egptr
== stb1
.base
.base
+ 100, "wrong get end, expected %p got %p\n", stb1
.base
.base
+ 100, stb1
.base
.egptr
);
2853 ok(stb1
.base
.pbase
== stb1
.base
.base
+ 100, "wrong put base, expected %p got %p\n", stb1
.base
.base
+ 100, stb1
.base
.pbase
);
2854 ok(stb1
.base
.pptr
== stb1
.base
.base
+ 100, "wrong put pointer, expected %p got %p\n", stb1
.base
.base
+ 100, stb1
.base
.pptr
);
2855 ok(stb1
.base
.epptr
== stb1
.base
.base
+ 160, "wrong put end, expected %p got %p\n", stb1
.base
.base
+ 160, stb1
.base
.epptr
);
2856 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, -1, 64);
2857 ok(ret
== 0 || ret
== 1, "expected 0 or 1, got %d\n", ret
);
2858 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, 32, -8);
2859 ok(ret
== 0 || ret
== 1, "expected 0 or 1, got %d\n", ret
);
2860 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, 0, 64);
2861 ok(ret
== 1, "expected 1 got %d\n", ret
);
2862 ok(stb1
.base
.ebuf
== stb1
.base
.base
+ 64, "expected %p got %p\n", stb1
.base
.base
+ 64, stb1
.base
.ebuf
);
2863 ok(stb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, stb1
.base
.eback
);
2864 ok(stb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, stb1
.base
.gptr
);
2865 ok(stb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, stb1
.base
.egptr
);
2866 ok(stb1
.base
.pbase
== stb1
.base
.base
, "wrong put base, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.pbase
);
2867 ok(stb1
.base
.pptr
== stb1
.base
.base
, "wrong put pointer, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.pptr
);
2868 ok(stb1
.base
.epptr
== stb1
.base
.base
+ 64, "wrong put end, expected %p got %p\n", stb1
.base
.base
+ 64, stb1
.base
.epptr
);
2869 ret
= (int) call_func3(p_stdiobuf_setrwbuf
, &stb1
, 0, 0);
2870 ok(ret
== 0, "expected 0 got %d\n", ret
);
2871 ok(stb1
.base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", stb1
.base
.unbuffered
);
2874 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 0, SEEKDIR_beg
, OPENMODE_in
);
2875 ok(ret
== 0, "expected 0 got %d\n", ret
);
2876 stb1
.base
.unbuffered
= 0;
2877 ret
= (int) call_func3(p_streambuf_xsputn
, &stb1
.base
, "Never gonna say goodbye", 22);
2878 ok(ret
== 22, "expected 22 got %d\n", ret
);
2879 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 5, SEEKDIR_beg
, OPENMODE_in
);
2880 ok(ret
== 5, "expected 5 got %d\n", ret
);
2881 ok(stb1
.base
.pptr
== stb1
.base
.pbase
+ 22, "wrong put pointer, expected %p got %p\n", stb1
.base
.pbase
+ 22, stb1
.base
.pptr
);
2882 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 300, SEEKDIR_beg
, OPENMODE_in
);
2883 ok(ret
== 300, "expected 300 got %d\n", ret
);
2884 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, -310, SEEKDIR_cur
, OPENMODE_in
);
2885 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2886 stb1
.base
.eback
= stb1
.base
.base
;
2887 stb1
.base
.gptr
= stb1
.base
.egptr
= stb1
.base
.pbase
= stb1
.base
.base
+ 10;
2888 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, -280, SEEKDIR_cur
, OPENMODE_in
);
2889 ok(ret
== 20, "expected 20 got %d\n", ret
);
2890 stb1
.base
.gptr
= stb1
.base
.eback
;
2891 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 80, SEEKDIR_cur
, OPENMODE_in
);
2892 ok(ret
== 100, "expected 100 got %d\n", ret
);
2893 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 0, SEEKDIR_end
, OPENMODE_in
);
2894 ok(ret
== 49, "expected 49 got %d\n", ret
);
2895 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, 1, SEEKDIR_end
, OPENMODE_in
);
2896 ok(ret
== 50, "expected 50 got %d\n", ret
);
2897 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, -60, SEEKDIR_end
, OPENMODE_in
);
2898 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2899 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb1
, -20, SEEKDIR_end
, OPENMODE_out
);
2900 ok(ret
== 29, "expected 29 got %d\n", ret
);
2901 stb1
.base
.eback
= stb1
.base
.gptr
= stb1
.base
.egptr
= NULL
;
2902 stb1
.base
.pptr
= stb1
.base
.pbase
;
2903 stb1
.base
.unbuffered
= 1;
2904 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, 0, SEEKDIR_beg
, OPENMODE_in
);
2905 ok(ret
== 0, "expected 0 got %d\n", ret
);
2906 stb2
.base
.pptr
+= 10;
2907 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, 20, SEEKDIR_beg
, OPENMODE_in
);
2908 ok(ret
== 20, "expected 20 got %d\n", ret
);
2909 ok(stb2
.base
.pptr
== stb2
.base
.pbase
+ 10, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
+ 10, stb2
.base
.pptr
);
2910 stb2
.base
.unbuffered
= 0;
2911 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, 10, SEEKDIR_cur
, OPENMODE_in
);
2912 ok(ret
== 40, "expected 40 got %d\n", ret
);
2913 ok(stb2
.base
.pptr
== stb2
.base
.pbase
, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
, stb2
.base
.pptr
);
2914 stb2
.base
.gptr
= stb2
.base
.eback
;
2915 stb2
.base
.pptr
+= 5;
2916 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, -50, SEEKDIR_cur
, OPENMODE_in
|OPENMODE_out
);
2917 ok(ret
== EOF
, "expected EOF got %d\n", ret
);
2918 ok(stb2
.base
.pptr
== stb2
.base
.pbase
, "wrong put pointer, expected %p got %p\n", stb2
.base
.pbase
, stb2
.base
.pptr
);
2919 stb2
.base
.pbase
= stb2
.base
.pptr
= stb2
.base
.epptr
= NULL
;
2920 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, 0, SEEKDIR_end
, OPENMODE_in
|OPENMODE_out
);
2921 ok(ret
== 48, "expected 48 got %d\n", ret
);
2922 ok(stb2
.base
.pbase
== stb2
.base
.base
+ 32, "wrong put pointer, expected %p got %p\n", stb2
.base
.base
+ 32, stb2
.base
.pbase
);
2923 ok(stb2
.base
.pptr
== stb2
.base
.base
+ 32, "wrong put pointer, expected %p got %p\n", stb2
.base
.base
+ 32, stb2
.base
.pptr
);
2924 ok(stb2
.base
.epptr
== stb2
.base
.ebuf
, "wrong put pointer, expected %p got %p\n", stb2
.base
.ebuf
, stb2
.base
.epptr
);
2925 ret
= (int) call_func4(p_stdiobuf_seekoff
, &stb2
, -28, SEEKDIR_end
, -1);
2926 ok(ret
== 20, "expected 20 got %d\n", ret
);
2927 stb2
.base
.gptr
= stb2
.base
.egptr
;
2928 stb2
.base
.unbuffered
= 1;
2931 last
= fgetc(stb1
.file
);
2932 ok(last
== 'r', "expected 'r' got %d\n", last
);
2933 ok(ftell(stb1
.file
) == 30, "ftell failed\n");
2934 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'i');
2935 ok(ret
== 'i', "expected 'i' got %d\n", ret
);
2936 ok(ftell(stb1
.file
) == 29, "ftell failed\n");
2937 last
= fgetc(stb1
.file
);
2938 ok(last
== 'r', "expected 'r' got %d\n", last
);
2939 ok(ftell(stb1
.file
) == 30, "ftell failed\n");
2940 stb1
.base
.eback
= stb1
.base
.base
;
2941 stb1
.base
.gptr
= stb1
.base
.egptr
= stb1
.base
.base
+ 9;
2942 strcpy(stb1
.base
.eback
, "pbackfail");
2943 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'j');
2944 ok(ret
== 'j', "expected 'j' got %d\n", ret
);
2945 ok(stb1
.base
.gptr
== stb1
.base
.base
+ 8, "wrong get pointer, expected %p got %p\n", stb1
.base
.base
+ 8, stb1
.base
.gptr
);
2946 ok(strncmp(stb1
.base
.eback
, "pbackfaij", 9) == 0, "strncmp failed\n");
2947 ok(ftell(stb1
.file
) == 30, "ftell failed\n");
2948 stb1
.base
.gptr
= stb1
.base
.eback
;
2949 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'k');
2950 ok(ret
== 'k', "expected 'k' got %d\n", ret
);
2951 ok(stb1
.base
.gptr
== stb1
.base
.base
, "wrong get pointer, expected %p got %p\n", stb1
.base
.base
, stb1
.base
.gptr
);
2952 ok(strncmp(stb1
.base
.eback
, "pbackfaij", 9) == 0, "strncmp failed\n");
2953 ok(ftell(stb1
.file
) == 29, "ftell failed\n");
2954 stb1
.base
.unbuffered
= 0;
2955 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'l');
2956 ok(ret
== 'l', "expected 'l' got %d\n", ret
);
2957 ok(strncmp(stb1
.base
.eback
, "lpbackfai", 9) == 0, "strncmp failed\n");
2958 ok(ftell(stb1
.file
) == 28, "ftell failed\n");
2959 stb1
.base
.egptr
= NULL
;
2960 ret
= (int) call_func2(p_stdiobuf_pbackfail
, &stb1
, 'm');
2961 ok(ret
== 'm', "expected 'm' got %d\n", ret
);
2962 ok(strncmp(stb1
.base
.eback
, "lpbackfai", 9) == 0, "strncmp failed\n");
2963 ok(ftell(stb1
.file
) == 27, "ftell failed\n");
2964 stb1
.base
.unbuffered
= 1;
2966 call_func1(p_stdiobuf_dtor
, &stb1
);
2967 call_func1(p_stdiobuf_dtor
, &stb2
);
2970 ok(_unlink(filename1
) == 0, "Couldn't unlink file named '%s'\n", filename1
);
2971 ok(_unlink(filename2
) == 0, "Couldn't unlink file named '%s'\n", filename2
);
2981 static DWORD WINAPI
lock_ios(void *arg
)
2983 struct ios_lock_arg
*lock_arg
= arg
;
2984 p_ios_lock(lock_arg
->ios_obj
);
2985 p_ios_lockbuf(lock_arg
->ios_obj
);
2987 SetEvent(lock_arg
->lock
);
2988 WaitForSingleObject(lock_arg
->release
[0], INFINITE
);
2990 WaitForSingleObject(lock_arg
->release
[1], INFINITE
);
2991 p_ios_unlockbuf(lock_arg
->ios_obj
);
2992 WaitForSingleObject(lock_arg
->release
[2], INFINITE
);
2993 p_ios_unlock(lock_arg
->ios_obj
);
2997 static void test_ios(void)
2999 ios ios_obj
, ios_obj2
;
3001 struct ios_lock_arg lock_arg
;
3004 LONG
*pret
, expected
, ret
;
3008 memset(&ios_obj
, 0xab, sizeof(ios
));
3009 memset(&ios_obj2
, 0xab, sizeof(ios
));
3010 psb
= p_operator_new(sizeof(streambuf
));
3011 ok(psb
!= NULL
, "failed to allocate streambuf object\n");
3012 call_func1(p_streambuf_ctor
, psb
);
3014 /* constructor/destructor */
3015 ok(*p_ios_fLockcInit
== 4, "expected 4 got %d\n", *p_ios_fLockcInit
);
3016 call_func2(p_ios_sb_ctor
, &ios_obj
, NULL
);
3017 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
3018 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
3019 ok(ios_obj
.special
[0] == 0, "expected 0 got %d\n", ios_obj
.special
[0]);
3020 ok(ios_obj
.special
[1] == 0, "expected 0 got %d\n", ios_obj
.special
[1]);
3021 ok(ios_obj
.delbuf
== 0, "expected 0 got %d\n", ios_obj
.delbuf
);
3022 ok(ios_obj
.tie
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.tie
);
3023 ok(ios_obj
.flags
== 0, "expected 0 got %x\n", ios_obj
.flags
);
3024 ok(ios_obj
.precision
== 6, "expected 6 got %d\n", ios_obj
.precision
);
3025 ok(ios_obj
.fill
== ' ', "expected ' ' got %d\n", ios_obj
.fill
);
3026 ok(ios_obj
.width
== 0, "expected 0 got %d\n", ios_obj
.width
);
3027 ok(ios_obj
.do_lock
== -1, "expected -1 got %d\n", ios_obj
.do_lock
);
3028 ok(ios_obj
.lock
.LockCount
== -1, "expected -1 got %d\n", ios_obj
.lock
.LockCount
);
3029 ok(*p_ios_fLockcInit
== 5, "expected 5 got %d\n", *p_ios_fLockcInit
);
3030 ios_obj
.state
= 0x8;
3031 call_func1(p_ios_dtor
, &ios_obj
);
3032 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
3033 ok(*p_ios_fLockcInit
== 4, "expected 4 got %d\n", *p_ios_fLockcInit
);
3034 memset(&ios_obj
, 0xab, sizeof(ios
));
3035 call_func2(p_ios_sb_ctor
, &ios_obj
, psb
);
3036 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
3037 ok(ios_obj
.state
== IOSTATE_goodbit
, "expected %x got %x\n", IOSTATE_goodbit
, ios_obj
.state
);
3038 ok(ios_obj
.special
[0] == 0, "expected 0 got %d\n", ios_obj
.special
[0]);
3039 ok(ios_obj
.special
[1] == 0, "expected 0 got %d\n", ios_obj
.special
[1]);
3040 ok(ios_obj
.delbuf
== 0, "expected 0 got %d\n", ios_obj
.delbuf
);
3041 ok(ios_obj
.tie
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.tie
);
3042 ok(ios_obj
.flags
== 0, "expected 0 got %x\n", ios_obj
.flags
);
3043 ok(ios_obj
.precision
== 6, "expected 6 got %d\n", ios_obj
.precision
);
3044 ok(ios_obj
.fill
== ' ', "expected ' ' got %d\n", ios_obj
.fill
);
3045 ok(ios_obj
.width
== 0, "expected 0 got %d\n", ios_obj
.width
);
3046 ok(ios_obj
.do_lock
== -1, "expected -1 got %d\n", ios_obj
.do_lock
);
3047 ok(*p_ios_fLockcInit
== 5, "expected 5 got %d\n", *p_ios_fLockcInit
);
3048 ios_obj
.state
= 0x8;
3049 call_func1(p_ios_dtor
, &ios_obj
);
3050 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
3051 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
3052 ok(*p_ios_fLockcInit
== 4, "expected 4 got %d\n", *p_ios_fLockcInit
);
3053 memset(&ios_obj
, 0xab, sizeof(ios
));
3054 call_func1(p_ios_ctor
, &ios_obj
);
3055 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
3056 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
3057 ok(ios_obj
.special
[0] == 0, "expected 0 got %d\n", ios_obj
.special
[0]);
3058 ok(ios_obj
.special
[1] == 0, "expected 0 got %d\n", ios_obj
.special
[1]);
3059 ok(ios_obj
.delbuf
== 0, "expected 0 got %d\n", ios_obj
.delbuf
);
3060 ok(ios_obj
.tie
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.tie
);
3061 ok(ios_obj
.flags
== 0, "expected 0 got %x\n", ios_obj
.flags
);
3062 ok(ios_obj
.precision
== 6, "expected 6 got %d\n", ios_obj
.precision
);
3063 ok(ios_obj
.fill
== ' ', "expected ' ' got %d\n", ios_obj
.fill
);
3064 ok(ios_obj
.width
== 0, "expected 0 got %d\n", ios_obj
.width
);
3065 ok(ios_obj
.do_lock
== -1, "expected -1 got %d\n", ios_obj
.do_lock
);
3066 ok(*p_ios_fLockcInit
== 5, "expected 5 got %d\n", *p_ios_fLockcInit
);
3069 ios_obj
.state
|= 0x8;
3070 call_func2(p_ios_init
, &ios_obj
, psb
);
3071 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
3072 ok(ios_obj
.state
== 0x8, "expected %x got %x\n", 0x8, ios_obj
.state
);
3073 call_func2(p_ios_init
, &ios_obj
, NULL
);
3074 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
3075 ok(ios_obj
.state
== (0x8|IOSTATE_badbit
), "expected %x got %x\n", (0x8|IOSTATE_badbit
), ios_obj
.state
);
3078 call_func2(p_ios_init
, &ios_obj
, psb
);
3079 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
3080 ok(ios_obj
.state
== 0x8, "expected %x got %x\n", 0x8, ios_obj
.state
);
3081 call_func1(p_ios_dtor
, &ios_obj
);
3083 /* copy constructor */
3084 memset(&ios_obj
, 0xcd, sizeof(ios
));
3085 call_func2(p_ios_copy_ctor
, &ios_obj
, &ios_obj2
);
3086 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
3087 ok(ios_obj
.state
== (ios_obj2
.state
|IOSTATE_badbit
), "expected %x got %x\n",
3088 ios_obj2
.state
|IOSTATE_badbit
, ios_obj
.state
);
3089 ok(ios_obj
.delbuf
== 0, "expected 0 got %d\n", ios_obj
.delbuf
);
3090 ok(ios_obj
.tie
== ios_obj2
.tie
, "expected %p got %p\n", ios_obj2
.tie
, ios_obj
.tie
);
3091 ok(ios_obj
.flags
== ios_obj2
.flags
, "expected %x got %x\n", ios_obj2
.flags
, ios_obj
.flags
);
3092 ok(ios_obj
.precision
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.precision
);
3093 ok(ios_obj
.fill
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.fill
);
3094 ok(ios_obj
.width
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.width
);
3095 ok(ios_obj
.do_lock
== -1, "expected -1 got %d\n", ios_obj
.do_lock
);
3096 ok(*p_ios_fLockcInit
== 5, "expected 5 got %d\n", *p_ios_fLockcInit
);
3099 ios_obj
.state
= 0xcdcdcdcd;
3100 ios_obj
.delbuf
= 0xcdcdcdcd;
3101 ios_obj
.tie
= (ostream
*) 0xcdcdcdcd;
3102 ios_obj
.flags
= 0xcdcdcdcd;
3103 ios_obj
.precision
= 0xcdcdcdcd;
3104 ios_obj
.fill
= 0xcd;
3105 ios_obj
.width
= 0xcdcdcdcd;
3106 ios_obj
.do_lock
= 0xcdcdcdcd;
3107 call_func2(p_ios_assign
, &ios_obj
, &ios_obj2
);
3108 ok(ios_obj
.sb
== NULL
, "expected %p got %p\n", NULL
, ios_obj
.sb
);
3109 ok(ios_obj
.state
== (ios_obj2
.state
|IOSTATE_badbit
), "expected %x got %x\n",
3110 ios_obj2
.state
|IOSTATE_badbit
, ios_obj
.state
);
3111 ok(ios_obj
.delbuf
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios_obj
.delbuf
);
3112 ok(ios_obj
.tie
== ios_obj2
.tie
, "expected %p got %p\n", ios_obj2
.tie
, ios_obj
.tie
);
3113 ok(ios_obj
.flags
== ios_obj2
.flags
, "expected %x got %x\n", ios_obj2
.flags
, ios_obj
.flags
);
3114 ok(ios_obj
.precision
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.precision
);
3115 ok(ios_obj
.fill
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.fill
);
3116 ok(ios_obj
.width
== (char)0xab, "expected %d got %d\n", (char)0xab, ios_obj
.width
);
3117 ok(ios_obj
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios_obj
.do_lock
);
3121 ios_obj
.do_lock
= 1;
3122 ios_obj
.sb
->do_lock
= 0;
3123 p_ios_clrlock(&ios_obj
);
3124 ok(ios_obj
.do_lock
== 1, "expected 1 got %d\n", ios_obj
.do_lock
);
3125 ok(ios_obj
.sb
->do_lock
== 1, "expected 1 got %d\n", ios_obj
.sb
->do_lock
);
3126 ios_obj
.do_lock
= 0;
3127 p_ios_clrlock(&ios_obj
);
3128 ok(ios_obj
.do_lock
== 1, "expected 1 got %d\n", ios_obj
.do_lock
);
3129 ok(ios_obj
.sb
->do_lock
== 1, "expected 1 got %d\n", ios_obj
.sb
->do_lock
);
3130 p_ios_setlock(&ios_obj
);
3131 ok(ios_obj
.do_lock
== 0, "expected 0 got %d\n", ios_obj
.do_lock
);
3132 ok(ios_obj
.sb
->do_lock
== 0, "expected 0 got %d\n", ios_obj
.sb
->do_lock
);
3133 ios_obj
.do_lock
= -1;
3134 p_ios_setlock(&ios_obj
);
3135 ok(ios_obj
.do_lock
== -2, "expected -2 got %d\n", ios_obj
.do_lock
);
3136 ok(ios_obj
.sb
->do_lock
== -1, "expected -1 got %d\n", ios_obj
.sb
->do_lock
);
3138 lock_arg
.ios_obj
= &ios_obj
;
3139 lock_arg
.lock
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
3140 ok(lock_arg
.lock
!= NULL
, "CreateEventW failed\n");
3141 lock_arg
.release
[0] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
3142 ok(lock_arg
.release
[0] != NULL
, "CreateEventW failed\n");
3143 lock_arg
.release
[1] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
3144 ok(lock_arg
.release
[1] != NULL
, "CreateEventW failed\n");
3145 lock_arg
.release
[2] = CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
3146 ok(lock_arg
.release
[2] != NULL
, "CreateEventW failed\n");
3147 thread
= CreateThread(NULL
, 0, lock_ios
, (void*)&lock_arg
, 0, NULL
);
3148 ok(thread
!= NULL
, "CreateThread failed\n");
3149 WaitForSingleObject(lock_arg
.lock
, INFINITE
);
3151 locked
= TryEnterCriticalSection(&ios_obj
.lock
);
3152 ok(locked
== 0, "the ios object was not locked before\n");
3153 locked
= TryEnterCriticalSection(&ios_obj
.sb
->lock
);
3154 ok(locked
== 0, "the streambuf was not locked before\n");
3155 locked
= TryEnterCriticalSection(p_ios_static_lock
);
3156 ok(locked
== 0, "the static critical section was not locked before\n");
3159 ios_obj
.flags
= 0x8000;
3160 ret
= (LONG
) call_func1(p_ios_flags_get
, &ios_obj
);
3161 ok(ret
== 0x8000, "expected %x got %x\n", 0x8000, ret
);
3162 ret
= (LONG
) call_func2(p_ios_flags_set
, &ios_obj
, 0x444);
3163 ok(ret
== 0x8000, "expected %x got %x\n", 0x8000, ret
);
3164 ok(ios_obj
.flags
== 0x444, "expected %x got %x\n", 0x444, ios_obj
.flags
);
3165 ret
= (LONG
) call_func2(p_ios_flags_set
, &ios_obj
, 0);
3166 ok(ret
== 0x444, "expected %x got %x\n", 0x444, ret
);
3167 ok(ios_obj
.flags
== 0, "expected %x got %x\n", 0, ios_obj
.flags
);
3170 ios_obj
.do_lock
= 0;
3171 ios_obj
.flags
= 0x8400;
3172 ret
= (LONG
) call_func2(p_ios_setf
, &ios_obj
, 0x444);
3173 ok(ret
== 0x8400, "expected %x got %x\n", 0x8400, ret
);
3174 ok(ios_obj
.flags
== 0x8444, "expected %x got %x\n", 0x8444, ios_obj
.flags
);
3175 ret
= (LONG
) call_func3(p_ios_setf_mask
, &ios_obj
, 0x111, 0);
3176 ok(ret
== 0x8444, "expected %x got %x\n", 0x8444, ret
);
3177 ok(ios_obj
.flags
== 0x8444, "expected %x got %x\n", 0x8444, ios_obj
.flags
);
3178 ret
= (LONG
) call_func3(p_ios_setf_mask
, &ios_obj
, 0x111, 0x105);
3179 ok(ret
== 0x8444, "expected %x got %x\n", 0x8444, ret
);
3180 ok(ios_obj
.flags
== 0x8541, "expected %x got %x\n", 0x8541, ios_obj
.flags
);
3183 ret
= (LONG
) call_func2(p_ios_unsetf
, &ios_obj
, 0x1111);
3184 ok(ret
== 0x8541, "expected %x got %x\n", 0x8541, ret
);
3185 ok(ios_obj
.flags
== 0x8440, "expected %x got %x\n", 0x8440, ios_obj
.flags
);
3186 ret
= (LONG
) call_func2(p_ios_unsetf
, &ios_obj
, 0x8008);
3187 ok(ret
== 0x8440, "expected %x got %x\n", 0x8440, ret
);
3188 ok(ios_obj
.flags
== 0x440, "expected %x got %x\n", 0x440, ios_obj
.flags
);
3189 ios_obj
.do_lock
= -1;
3192 ios_obj
.state
= 0x8;
3193 ret
= (LONG
) call_func1(p_ios_good
, &ios_obj
);
3194 ok(ret
== 0, "expected 0 got %d\n", ret
);
3195 ios_obj
.state
= IOSTATE_goodbit
;
3196 ret
= (LONG
) call_func1(p_ios_good
, &ios_obj
);
3197 ok(ret
== 1, "expected 1 got %d\n", ret
);
3198 ret
= (LONG
) call_func1(p_ios_bad
, &ios_obj
);
3199 ok(ret
== 0, "expected 0 got %d\n", ret
);
3200 ios_obj
.state
= (IOSTATE_eofbit
|IOSTATE_badbit
);
3201 ret
= (LONG
) call_func1(p_ios_bad
, &ios_obj
);
3202 ok(ret
== IOSTATE_badbit
, "expected 4 got %d\n", ret
);
3203 ret
= (LONG
) call_func1(p_ios_eof
, &ios_obj
);
3204 ok(ret
== IOSTATE_eofbit
, "expected 1 got %d\n", ret
);
3205 ios_obj
.state
= 0x8;
3206 ret
= (LONG
) call_func1(p_ios_eof
, &ios_obj
);
3207 ok(ret
== 0, "expected 0 got %d\n", ret
);
3208 ret
= (LONG
) call_func1(p_ios_fail
, &ios_obj
);
3209 ok(ret
== 0, "expected 0 got %d\n", ret
);
3210 ios_obj
.state
= IOSTATE_badbit
;
3211 ret
= (LONG
) call_func1(p_ios_fail
, &ios_obj
);
3212 ok(ret
== IOSTATE_badbit
, "expected 4 got %d\n", ret
);
3213 ios_obj
.state
= (IOSTATE_eofbit
|IOSTATE_failbit
);
3214 ret
= (LONG
) call_func1(p_ios_fail
, &ios_obj
);
3215 ok(ret
== IOSTATE_failbit
, "expected 2 got %d\n", ret
);
3216 ios_obj
.state
= (IOSTATE_eofbit
|IOSTATE_failbit
|IOSTATE_badbit
);
3217 ret
= (LONG
) call_func1(p_ios_fail
, &ios_obj
);
3218 ok(ret
== (IOSTATE_failbit
|IOSTATE_badbit
), "expected 6 got %d\n", ret
);
3219 ios_obj
.do_lock
= 0;
3220 call_func2(p_ios_clear
, &ios_obj
, 0);
3221 ok(ios_obj
.state
== IOSTATE_goodbit
, "expected 0 got %d\n", ios_obj
.state
);
3222 call_func2(p_ios_clear
, &ios_obj
, 0x8|IOSTATE_eofbit
);
3223 ok(ios_obj
.state
== (0x8|IOSTATE_eofbit
), "expected 9 got %d\n", ios_obj
.state
);
3224 ios_obj
.do_lock
= -1;
3226 SetEvent(lock_arg
.release
[0]);
3230 for (i
= 0; i
< 20; i
++) {
3231 ret
= p_ios_bitalloc();
3232 ok(ret
== expected
, "expected %x got %x\n", expected
, ret
);
3233 ok(*p_ios_maxbit
== expected
, "expected %x got %x\n", expected
, *p_ios_maxbit
);
3237 /* xalloc/pword/iword */
3238 ok(*p_ios_curindex
== -1, "expected -1 got %d\n", *p_ios_curindex
);
3240 for (i
= 0; i
< 8; i
++) {
3241 ret
= p_ios_xalloc();
3242 ok(ret
== expected
, "expected %d got %d\n", expected
, ret
);
3243 ok(*p_ios_curindex
== expected
, "expected %d got %d\n", expected
, *p_ios_curindex
);
3244 pret
= call_func2(p_ios_iword
, &ios_obj
, ret
);
3245 ok(pret
== &p_ios_statebuf
[ret
], "expected %p got %p\n", &p_ios_statebuf
[ret
], pret
);
3246 ok(*pret
== 0, "expected 0 got %d\n", *pret
);
3247 pret2
= call_func2(p_ios_pword
, &ios_obj
, ret
);
3248 ok(pret2
== (void**)&p_ios_statebuf
[ret
], "expected %p got %p\n", (void**)&p_ios_statebuf
[ret
], pret2
);
3251 ret
= p_ios_xalloc();
3252 ok(ret
== -1, "expected -1 got %d\n", ret
);
3253 ok(*p_ios_curindex
== 7, "expected 7 got %d\n", *p_ios_curindex
);
3255 SetEvent(lock_arg
.release
[1]);
3256 SetEvent(lock_arg
.release
[2]);
3257 WaitForSingleObject(thread
, INFINITE
);
3260 call_func1(p_ios_dtor
, &ios_obj
);
3261 ok(ios_obj
.state
== IOSTATE_badbit
, "expected %x got %x\n", IOSTATE_badbit
, ios_obj
.state
);
3262 ok(*p_ios_fLockcInit
== 4, "expected 4 got %d\n", *p_ios_fLockcInit
);
3263 CloseHandle(lock_arg
.lock
);
3264 CloseHandle(lock_arg
.release
[0]);
3265 CloseHandle(lock_arg
.release
[1]);
3266 CloseHandle(lock_arg
.release
[2]);
3267 CloseHandle(thread
);
3270 static void test_ostream(void) {
3271 ostream os1
, os2
, *pos
;
3272 filebuf fb1
, fb2
, *pfb
;
3273 const char filename1
[] = "test1";
3274 const char filename2
[] = "test2";
3277 memset(&os1
, 0xab, sizeof(ostream
));
3278 memset(&os2
, 0xab, sizeof(ostream
));
3279 memset(&fb1
, 0xab, sizeof(filebuf
));
3280 memset(&fb2
, 0xab, sizeof(filebuf
));
3282 /* constructors/destructors */
3283 pos
= call_func2(p_ostream_ctor
, &os1
, TRUE
);
3284 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3285 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
3286 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
3287 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
3288 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3289 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
3290 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3291 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3292 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
3293 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3294 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
3295 call_func1(p_ostream_vbase_dtor
, &os1
);
3296 memset(&os1
, 0xab, sizeof(ostream
));
3297 pos
= call_func3(p_ostream_sb_ctor
, &os1
, &fb1
.base
, TRUE
);
3298 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3299 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
3300 ok(os1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, os1
.base_ios
.sb
);
3301 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3302 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3303 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
3304 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3305 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3306 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
3307 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3308 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
3309 ok(fb1
.base
.allocated
== 0xabababab, "expected %d got %d\n", 0xabababab, fb1
.base
.allocated
);
3310 call_func1(p_ostream_vbase_dtor
, &os1
);
3311 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
3312 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
3313 memset(&os1
.base_ios
, 0xab, sizeof(ios
));
3314 os1
.unknown
= 0xabababab;
3315 os1
.base_ios
.state
= 0xabababab | IOSTATE_badbit
;
3316 pos
= call_func2(p_ostream_ctor
, &os1
, FALSE
);
3317 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3318 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
3319 ok(os1
.base_ios
.sb
== os2
.base_ios
.sb
, "expected %p got %p\n", os2
.base_ios
.sb
, os1
.base_ios
.sb
);
3320 ok(os1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
3321 0xabababab|IOSTATE_badbit
, os1
.base_ios
.state
);
3322 ok(os1
.base_ios
.delbuf
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.delbuf
);
3323 ok(os1
.base_ios
.tie
== os2
.base_ios
.tie
, "expected %p got %p\n", os2
.base_ios
.tie
, os1
.base_ios
.tie
);
3324 ok(os1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, os1
.base_ios
.flags
);
3325 ok(os1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.precision
);
3326 ok(os1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", os1
.base_ios
.fill
);
3327 ok(os1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.width
);
3328 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
3329 call_func1(p_ostream_dtor
, &os1
.base_ios
);
3330 os1
.unknown
= 0xabababab;
3331 os1
.base_ios
.delbuf
= 0;
3332 call_func1(p_filebuf_ctor
, &fb1
);
3333 pfb
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_out
, filebuf_openprot
);
3334 ok(pfb
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pfb
);
3335 ok(fb1
.base
.allocated
== 1, "expected %d got %d\n", 1, fb1
.base
.allocated
);
3336 pos
= call_func3(p_ostream_sb_ctor
, &os1
, &fb1
.base
, FALSE
);
3337 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3338 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
3339 ok(os1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, os1
.base_ios
.sb
);
3340 ok(os1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.state
);
3341 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3342 ok(os1
.base_ios
.tie
== os2
.base_ios
.tie
, "expected %p got %p\n", os2
.base_ios
.tie
, os1
.base_ios
.tie
);
3343 ok(os1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, os1
.base_ios
.flags
);
3344 ok(os1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.precision
);
3345 ok(os1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", os1
.base_ios
.fill
);
3346 ok(os1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.width
);
3347 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
3348 call_func1(p_ostream_dtor
, &os1
.base_ios
);
3349 memset(&os1
, 0xab, sizeof(ostream
));
3350 pos
= call_func3(p_ostream_sb_ctor
, &os1
, NULL
, TRUE
);
3351 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3352 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
3353 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
3354 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
3355 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3356 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
3357 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3358 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3359 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
3360 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3361 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
3362 call_func1(p_ostream_vbase_dtor
, &os1
);
3363 memset(&os1
.base_ios
, 0xcd, sizeof(ios
));
3364 os1
.unknown
= 0xcdcdcdcd;
3365 pos
= call_func3(p_ostream_copy_ctor
, &os2
, &os1
, TRUE
);
3366 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
3367 ok(os2
.unknown
== 0, "expected 0 got %d\n", os2
.unknown
);
3368 ok(os2
.base_ios
.sb
== os1
.base_ios
.sb
, "expected %p got %p\n", os1
.base_ios
.sb
, os2
.base_ios
.sb
);
3369 ok(os2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os2
.base_ios
.state
);
3370 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
3371 ok(os2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.tie
);
3372 ok(os2
.base_ios
.flags
== 0, "expected 0 got %x\n", os2
.base_ios
.flags
);
3373 ok(os2
.base_ios
.precision
== 6, "expected 6 got %d\n", os2
.base_ios
.precision
);
3374 ok(os2
.base_ios
.fill
== ' ', "expected 32 got %d\n", os2
.base_ios
.fill
);
3375 ok(os2
.base_ios
.width
== 0, "expected 0 got %d\n", os2
.base_ios
.width
);
3376 ok(os2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os2
.base_ios
.do_lock
);
3377 call_func1(p_ostream_vbase_dtor
, &os2
);
3378 memset(&os2
.base_ios
, 0xab, sizeof(ios
));
3379 os2
.unknown
= 0xabababab;
3380 os2
.base_ios
.state
= 0xabababab | IOSTATE_badbit
;
3381 os2
.base_ios
.delbuf
= 0;
3382 os2
.base_ios
.tie
= &os2
;
3383 pos
= call_func3(p_ostream_copy_ctor
, &os2
, &os1
, FALSE
);
3384 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
3385 ok(os2
.unknown
== 0, "expected 0 got %d\n", os2
.unknown
);
3386 ok(os2
.base_ios
.sb
== os1
.base_ios
.sb
, "expected %p got %p\n", os1
.base_ios
.sb
, os2
.base_ios
.sb
);
3387 ok(os2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.state
);
3388 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
3389 ok(os2
.base_ios
.tie
== &os2
, "expected %p got %p\n", &os2
, os2
.base_ios
.tie
);
3390 ok(os2
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, os2
.base_ios
.flags
);
3391 ok(os2
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.precision
);
3392 ok(os2
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", os2
.base_ios
.fill
);
3393 ok(os2
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.width
);
3394 ok(os2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.do_lock
);
3395 call_func1(p_ostream_dtor
, &os2
.base_ios
);
3396 os1
.base_ios
.sb
= NULL
;
3397 pos
= call_func3(p_ostream_copy_ctor
, &os2
, &os1
, TRUE
);
3398 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
3399 ok(os2
.unknown
== 0, "expected 0 got %d\n", os2
.unknown
);
3400 ok(os2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.sb
);
3401 ok(os2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os2
.base_ios
.state
);
3402 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
3403 ok(os2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.tie
);
3404 ok(os2
.base_ios
.flags
== 0, "expected 0 got %x\n", os2
.base_ios
.flags
);
3405 ok(os2
.base_ios
.precision
== 6, "expected 6 got %d\n", os2
.base_ios
.precision
);
3406 ok(os2
.base_ios
.fill
== ' ', "expected 32 got %d\n", os2
.base_ios
.fill
);
3407 ok(os2
.base_ios
.width
== 0, "expected 0 got %d\n", os2
.base_ios
.width
);
3408 ok(os2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os2
.base_ios
.do_lock
);
3411 pos
= call_func2(p_ostream_ctor
, &os1
, TRUE
);
3412 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3413 os1
.unknown
= 0xabababab;
3414 os1
.base_ios
.state
= 0xabababab;
3415 os1
.base_ios
.special
[0] = 0xabababab;
3416 os1
.base_ios
.delbuf
= 0xabababab;
3417 os1
.base_ios
.tie
= (ostream
*) 0xabababab;
3418 os1
.base_ios
.flags
= 0xabababab;
3419 os1
.base_ios
.precision
= 0xabababab;
3420 os1
.base_ios
.width
= 0xabababab;
3421 os1
.base_ios
.do_lock
= 0xabababab;
3422 pos
= call_func2(p_ostream_assign_sb
, &os1
, &fb1
.base
);
3423 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3424 ok(os1
.unknown
== 0xabababab, "expected 0 got %d\n", os1
.unknown
);
3425 ok(os1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, os1
.base_ios
.sb
);
3426 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3427 ok(os1
.base_ios
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.fill
);
3428 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3429 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
3430 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3431 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3432 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3433 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
3434 os1
.base_ios
.state
= 0x8000;
3435 pos
= call_func2(p_ostream_assign_sb
, &os1
, NULL
);
3436 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3437 ok(os1
.unknown
== 0xabababab, "expected 0 got %d\n", os1
.unknown
);
3438 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
3439 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
3440 ok(os1
.base_ios
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.fill
);
3441 ok(os1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os1
.base_ios
.delbuf
);
3442 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
3443 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
3444 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
3445 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3446 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
3447 os2
.unknown
= 0xcdcdcdcd;
3448 os2
.base_ios
.state
= 0xcdcdcdcd;
3449 os2
.base_ios
.special
[0] = 0xcdcdcdcd;
3450 os2
.base_ios
.delbuf
= 0xcdcdcdcd;
3451 os2
.base_ios
.tie
= (ostream
*) 0xcdcdcdcd;
3452 os2
.base_ios
.flags
= 0xcdcdcdcd;
3453 os2
.base_ios
.precision
= 0xcdcdcdcd;
3454 os2
.base_ios
.width
= 0xcdcdcdcd;
3455 os2
.base_ios
.do_lock
= 0xcdcdcdcd;
3456 pos
= call_func2(p_ostream_assign
, &os2
, &os1
);
3457 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
3458 ok(os2
.unknown
== 0xcdcdcdcd, "expected 0 got %d\n", os2
.unknown
);
3459 ok(os2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.sb
);
3460 ok(os2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os2
.base_ios
.state
);
3461 ok(os2
.base_ios
.special
[0] == 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, os2
.base_ios
.fill
);
3462 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
3463 ok(os2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.tie
);
3464 ok(os2
.base_ios
.flags
== 0, "expected 0 got %x\n", os2
.base_ios
.flags
);
3465 ok(os2
.base_ios
.precision
== 6, "expected 6 got %d\n", os2
.base_ios
.precision
);
3466 ok(os2
.base_ios
.width
== 0, "expected 0 got %d\n", os2
.base_ios
.width
);
3467 ok(os2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, os2
.base_ios
.do_lock
);
3470 if (0) /* crashes on native */
3471 pos
= call_func1(p_ostream_flush
, &os1
);
3472 os1
.base_ios
.sb
= &fb2
.base
;
3473 call_func1(p_filebuf_ctor
, &fb2
);
3474 pos
= call_func1(p_ostream_flush
, &os1
);
3475 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3476 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3477 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3478 os1
.base_ios
.sb
= &fb1
.base
;
3479 os1
.base_ios
.state
= IOSTATE_eofbit
;
3480 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "Never gonna tell a lie", 22);
3481 ok(ret
== 22, "expected 22 got %d\n", ret
);
3482 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3483 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 22, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 22, fb1
.base
.pptr
);
3484 pos
= call_func1(p_ostream_flush
, &os1
);
3485 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3486 ok(os1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, os1
.base_ios
.state
);
3487 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3488 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3489 os1
.base_ios
.tie
= &os2
;
3490 os2
.base_ios
.sb
= &fb2
.base
;
3491 os2
.base_ios
.state
= IOSTATE_goodbit
;
3492 pfb
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_out
, filebuf_openprot
);
3493 ok(pfb
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pfb
);
3494 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "and hurt you", 12);
3495 ok(ret
== 12, "expected 12 got %d\n", ret
);
3496 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
3497 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 12, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 12, fb2
.base
.pptr
);
3498 pos
= call_func1(p_ostream_flush
, &os1
);
3499 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3500 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
3501 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 12, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 12, fb2
.base
.pptr
);
3504 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3505 ok(ret
== 0, "expected 0 got %d\n", ret
);
3506 ok(os1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
3507 IOSTATE_eofbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3508 os1
.base_ios
.state
= IOSTATE_badbit
;
3509 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3510 ok(ret
== 0, "expected 0 got %d\n", ret
);
3511 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3512 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3513 os1
.base_ios
.sb
= &fb1
.base
;
3514 os1
.base_ios
.state
= IOSTATE_badbit
;
3515 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3516 ok(ret
== 0, "expected 0 got %d\n", ret
);
3517 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3518 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3519 os1
.base_ios
.state
= IOSTATE_failbit
;
3520 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3521 ok(ret
== 0, "expected 0 got %d\n", ret
);
3522 ok(os1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, os1
.base_ios
.state
);
3523 os1
.base_ios
.state
= IOSTATE_goodbit
;
3524 os1
.base_ios
.tie
= &os2
;
3525 os2
.base_ios
.sb
= NULL
;
3526 if (0) /* crashes on native */
3527 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3528 os2
.base_ios
.sb
= &fb2
.base
;
3529 os2
.base_ios
.state
= IOSTATE_badbit
;
3530 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "We've known each other", 22);
3531 ok(ret
== 22, "expected 22 got %d\n", ret
);
3532 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3533 ok(ret
== 1, "expected 1 got %d\n", ret
);
3534 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3535 ok(os2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os2
.base_ios
.state
);
3536 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3537 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 22, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 22, fb1
.base
.pptr
);
3538 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
3539 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
3542 os1
.base_ios
.state
= IOSTATE_badbit
;
3543 os1
.base_ios
.width
= 0xab;
3544 call_func1(p_ostream_osfx
, &os1
);
3545 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
3546 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3547 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3548 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 22, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 22, fb1
.base
.pptr
);
3549 os1
.base_ios
.state
= IOSTATE_goodbit
;
3550 ret
= (int) call_func1(p_ostream_opfx
, &os1
);
3551 ok(ret
== 1, "expected 1 got %d\n", ret
);
3552 os1
.base_ios
.sb
= NULL
;
3553 if (0) /* crashes on native */
3554 call_func1(p_ostream_osfx
, &os1
);
3555 os1
.base_ios
.sb
= &fb1
.base
;
3556 os1
.base_ios
.flags
= FLAGS_unitbuf
;
3557 call_func1(p_ostream_osfx
, &os1
);
3558 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3559 ok(os1
.base_ios
.flags
== FLAGS_unitbuf
, "expected %d got %d\n", FLAGS_unitbuf
, os1
.base_ios
.flags
);
3560 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3561 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3564 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "for so long", 11);
3565 ok(ret
== 11, "expected 11 got %d\n", ret
);
3566 os1
.base_ios
.state
= IOSTATE_badbit
;
3567 os1
.base_ios
.width
= 2;
3568 pos
= call_func2(p_ostream_put_char
, &os1
, 'a');
3569 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3570 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3571 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3572 ok(os1
.base_ios
.width
== 2, "expected 2 got %d\n", os1
.base_ios
.width
);
3573 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3574 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3575 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
3576 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 11, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 11, fb2
.base
.pptr
);
3577 os1
.base_ios
.state
= IOSTATE_goodbit
;
3578 pos
= call_func2(p_ostream_put_char
, &os1
, 'a');
3579 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3580 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3581 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3582 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3583 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3584 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
3585 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
3586 os1
.base_ios
.flags
= 0;
3587 pos
= call_func2(p_ostream_put_char
, &os1
, 'b');
3588 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3589 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3590 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3591 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 1, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.pptr
);
3592 os1
.base_ios
.sb
= NULL
;
3593 if (0) /* crashes on native */
3594 pos
= call_func2(p_ostream_put_char
, &os1
, 'c');
3595 os1
.base_ios
.sb
= &fb1
.base
;
3596 os1
.base_ios
.width
= 5;
3597 call_func1(p_filebuf_sync
, &fb1
);
3600 pos
= call_func2(p_ostream_put_char
, &os1
, 'c');
3601 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3602 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3603 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3604 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3605 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3606 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3610 pos
= call_func3(p_ostream_write_char
, &os1
, "Your", 4);
3611 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3612 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3613 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3614 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3615 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3616 os1
.base_ios
.state
= IOSTATE_goodbit
;
3617 os1
.base_ios
.width
= 1;
3618 pos
= call_func3(p_ostream_write_char
, &os1
, "heart's", 7);
3619 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3620 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3621 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3622 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3623 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 7, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 7, fb1
.base
.pptr
);
3624 os1
.base_ios
.sb
= NULL
;
3625 if (0) /* crashes on native */
3626 pos
= call_func3(p_ostream_write_char
, &os1
, "been", 4);
3627 os1
.base_ios
.sb
= &fb1
.base
;
3628 os1
.base_ios
.width
= 5;
3629 call_func1(p_filebuf_sync
, &fb1
);
3632 pos
= call_func3(p_ostream_write_char
, &os1
, "aching,", 7);
3633 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3634 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3635 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3636 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
3637 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3638 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3642 os1
.base_ios
.state
= IOSTATE_eofbit
;
3643 pos
= call_func3(p_ostream_seekp_offset
, &os1
, 0, SEEKDIR_beg
);
3644 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3645 ok(os1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, os1
.base_ios
.state
);
3646 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "but", 3);
3647 ok(ret
== 3, "expected 3 got %d\n", ret
);
3648 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3649 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 3, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 3, fb1
.base
.pptr
);
3650 pos
= call_func3(p_ostream_seekp_offset
, &os1
, 0, SEEKDIR_end
);
3651 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3652 ok(os1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, os1
.base_ios
.state
);
3653 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3654 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3655 pos
= call_func3(p_ostream_seekp_offset
, &os1
, -1, SEEKDIR_beg
);
3656 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3657 ok(os1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
3658 IOSTATE_eofbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3659 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "You're too shy", 14);
3660 ok(ret
== 14, "expected 14 got %d\n", ret
);
3661 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3662 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 14, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.pptr
);
3663 pos
= call_func2(p_ostream_seekp
, &os1
, 0);
3664 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3665 ok(os1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
3666 IOSTATE_eofbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3667 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3668 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3669 os1
.base_ios
.state
= IOSTATE_badbit
;
3670 pos
= call_func2(p_ostream_seekp
, &os1
, -1);
3671 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3672 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3673 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3676 ret
= (int) call_func1(p_ostream_tellp
, &os1
);
3677 ok(ret
== 0, "wrong return, expected 0 got %d\n", ret
);
3678 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3679 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3680 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "to say it", 9);
3681 ok(ret
== 9, "expected 9 got %d\n", ret
);
3682 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
3683 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 9, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.pptr
);
3684 ret
= (int) call_func1(p_ostream_tellp
, &os1
);
3685 ok(ret
== 9, "wrong return, expected 9 got %d\n", ret
);
3686 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3687 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3688 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
3689 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
3690 os1
.base_ios
.state
= IOSTATE_eofbit
;
3693 ret
= (int) call_func1(p_ostream_tellp
, &os1
);
3694 ok(ret
== EOF
, "wrong return, expected EOF got %d\n", ret
);
3695 ok(os1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
3696 IOSTATE_eofbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3700 os1
.base_ios
.state
= IOSTATE_eofbit
;
3701 os1
.base_ios
.flags
=
3702 FLAGS_right
|FLAGS_hex
|FLAGS_showbase
|FLAGS_showpoint
|FLAGS_showpos
|FLAGS_uppercase
|FLAGS_fixed
;
3703 os1
.base_ios
.fill
= 'z';
3704 os1
.base_ios
.width
= 9;
3705 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "b");
3706 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3707 ok(!strncmp(fb1
.base
.pptr
- 9, "zzzzzzzab", 9), "expected 'zzzzzzzab' got '%s'\n", fb1
.base
.pptr
- 9);
3708 pos
= call_func3(p_ostream_writepad
, &os1
, "aa", "bb");
3709 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3710 ok(!strncmp(fb1
.base
.pptr
- 9, "zzzzzaabb", 9), "expected 'zzzzzaabb' got '%s'\n", fb1
.base
.pptr
- 9);
3711 pos
= call_func3(p_ostream_writepad
, &os1
, "aaaaa", "bbbbb");
3712 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3713 ok(!strncmp(fb1
.base
.pptr
- 10, "aaaaabbbbb", 10), "expected 'aaaaabbbbb' got '%s'\n", fb1
.base
.pptr
- 10);
3714 os1
.base_ios
.flags
|= FLAGS_internal
;
3715 pos
= call_func3(p_ostream_writepad
, &os1
, "aa", "bb");
3716 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3717 ok(!strncmp(fb1
.base
.pptr
- 9, "aazzzzzbb", 9), "expected 'aazzzzzbb' got '%s'\n", fb1
.base
.pptr
- 9);
3718 os1
.base_ios
.flags
&= ~FLAGS_right
;
3719 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "b");
3720 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3721 ok(!strncmp(fb1
.base
.pptr
- 9, "azzzzzzzb", 9), "expected 'azzzzzzzb' got '%s'\n", fb1
.base
.pptr
- 9);
3722 os1
.base_ios
.width
= 6;
3723 pos
= call_func3(p_ostream_writepad
, &os1
, "1", "2");
3724 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3725 ok(!strncmp(fb1
.base
.pptr
- 6, "1zzzz2", 6), "expected '1zzzz2' got '%s'\n", fb1
.base
.pptr
- 6);
3726 pos
= call_func3(p_ostream_writepad
, &os1
, "12345678", "");
3727 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3728 ok(!strncmp(fb1
.base
.pptr
- 8, "12345678", 8), "expected '12345678' got '%s'\n", fb1
.base
.pptr
- 8);
3729 os1
.base_ios
.flags
|= FLAGS_left
;
3730 pos
= call_func3(p_ostream_writepad
, &os1
, "z1", "2z");
3731 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3732 ok(!strncmp(fb1
.base
.pptr
- 6, "z1zz2z", 6), "expected 'z1zz2z' got '%s'\n", fb1
.base
.pptr
- 6);
3733 os1
.base_ios
.flags
&= ~FLAGS_internal
;
3734 pos
= call_func3(p_ostream_writepad
, &os1
, "hell", "o");
3735 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3736 ok(!strncmp(fb1
.base
.pptr
- 6, "helloz", 6), "expected 'helloz' got '%s'\n", fb1
.base
.pptr
- 6);
3737 os1
.base_ios
.flags
|= FLAGS_right
;
3738 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "b");
3739 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3740 ok(!strncmp(fb1
.base
.pptr
- 6, "abzzzz", 6), "expected 'abzzzz' got '%s'\n", fb1
.base
.pptr
- 6);
3741 if (0) /* crashes on native */
3742 pos
= call_func3(p_ostream_writepad
, &os1
, NULL
, "o");
3743 pos
= call_func3(p_ostream_writepad
, &os1
, "", "hello");
3744 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3745 ok(!strncmp(fb1
.base
.pptr
- 6, "helloz", 6), "expected 'helloz' got '%s'\n", fb1
.base
.pptr
- 6);
3746 os1
.base_ios
.fill
= '*';
3747 pos
= call_func3(p_ostream_writepad
, &os1
, "", "");
3748 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3749 ok(!strncmp(fb1
.base
.pptr
- 6, "******", 6), "expected '******' got '%s'\n", fb1
.base
.pptr
- 6);
3750 pos
= call_func3(p_ostream_writepad
, &os1
, "aa", "");
3751 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3752 ok(!strncmp(fb1
.base
.pptr
- 6, "aa****", 6), "expected 'aa****' got '%s'\n", fb1
.base
.pptr
- 6);
3753 os1
.base_ios
.flags
= 0;
3754 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "b");
3755 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3756 ok(!strncmp(fb1
.base
.pptr
- 6, "****ab", 6), "expected '****ab' got '%s'\n", fb1
.base
.pptr
- 6);
3757 call_func1(p_filebuf_sync
, &fb1
);
3759 pos
= call_func3(p_ostream_writepad
, &os1
, "aa", "bb");
3760 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3761 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
), "expected %d got %d\n",
3762 IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
, os1
.base_ios
.state
);
3763 os1
.base_ios
.state
= IOSTATE_goodbit
;
3764 pos
= call_func3(p_ostream_writepad
, &os1
, "", "");
3765 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3766 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3767 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3768 os1
.base_ios
.state
= IOSTATE_goodbit
;
3769 os1
.base_ios
.width
= 0;
3770 pos
= call_func3(p_ostream_writepad
, &os1
, "", "");
3771 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3772 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
3773 pos
= call_func3(p_ostream_writepad
, &os1
, "a", "");
3774 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
3775 ok(os1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
3776 IOSTATE_badbit
|IOSTATE_failbit
, os1
.base_ios
.state
);
3779 call_func1(p_ostream_vbase_dtor
, &os1
);
3780 call_func1(p_ostream_vbase_dtor
, &os2
);
3781 call_func1(p_filebuf_dtor
, &fb1
);
3782 call_func1(p_filebuf_dtor
, &fb2
);
3783 ok(_unlink(filename1
) == 0, "Couldn't unlink file named '%s'\n", filename1
);
3784 ok(_unlink(filename2
) == 0, "Couldn't unlink file named '%s'\n", filename2
);
3787 static void test_ostream_print(void)
3789 const BOOL is_64
= (sizeof(void*) == 8);
3791 strstreambuf ssb
, ssb_test1
, ssb_test2
, ssb_test3
, *pssb
;
3792 LONG length
, expected_length
;
3795 char param_char
[] = {'a', '9', 'e'};
3796 const char* param_str
[] = {"Test", "800", "3.14159", " Test"};
3797 int param_int
[] = {0, 7, 10, 24 ,55, 1024, 1023, 65536, 2147483647, 2147483648u, 4294967295u, -20};
3798 float param_float
[] = {1.0f
, 0.0f
, 4.25f
, 3.999f
, 12.0005f
, 15.33582f
, 15.0f
, 15.22f
, 21.123f
, 0.1f
,
3799 13.14159f
, 0.00013f
, 0.000013f
, INFINITY
, -INFINITY
, NAN
};
3800 double param_double
[] = {1.0, 3.141592653589793238, 314.1592653589793238, 314.159265358979,
3801 1231314.269811862199, 9.961472e6
, 8.98846567431e307
, DBL_MAX
};
3802 void* param_ptr
[] = {NULL
, (void*) 0xdeadbeef, (void*) 0x1234cdef, (void*) 0x1, (void*) 0xffffffff};
3803 streambuf
* param_streambuf
[] = {NULL
, &ssb_test1
.base
, &ssb_test2
.base
, &ssb_test3
.base
};
3804 struct ostream_print_test
{
3805 enum { type_chr
, type_str
, type_int
, type_flt
, type_dbl
, type_ptr
, type_sbf
} type
;
3812 const char *expected_text
;
3813 ios_io_state expected_flags
;
3816 {type_chr
, /* 'a' */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3817 {type_chr
, /* 'a' */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3818 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0, "a", IOSTATE_goodbit
},
3819 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, 0, 6, ' ', 4, " a", IOSTATE_goodbit
},
3820 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, 0, 6, 'x', 3, "xxa", IOSTATE_goodbit
},
3821 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, FLAGS_left
, 6, ' ', 4, "a ", IOSTATE_goodbit
},
3822 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, FLAGS_left
|FLAGS_internal
, 6, ' ', 4, " a", IOSTATE_goodbit
},
3823 {type_chr
, /* 'a' */ 0, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 4, " a", IOSTATE_goodbit
},
3824 {type_chr
, /* '9' */ 1, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_showbase
|FLAGS_uppercase
, 6, 'i', 2, "i9", IOSTATE_goodbit
},
3825 {type_chr
, /* '9' */ 1, IOSTATE_goodbit
, FLAGS_showpos
|FLAGS_scientific
, 0, 'i', 2, "i9", IOSTATE_goodbit
},
3826 {type_chr
, /* 'e' */ 2, IOSTATE_goodbit
, FLAGS_left
|FLAGS_right
|FLAGS_uppercase
, 0, '*', 8, "e*******", IOSTATE_goodbit
},
3828 {type_str
, /* "Test" */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3829 {type_str
, /* "Test" */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3830 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0, "Test", IOSTATE_goodbit
},
3831 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, 0, 6, ' ', 6, " Test", IOSTATE_goodbit
},
3832 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, FLAGS_internal
, 6, 'x', 6, "xxTest", IOSTATE_goodbit
},
3833 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, FLAGS_left
, 6, ' ', 5, "Test ", IOSTATE_goodbit
},
3834 {type_str
, /* "Test" */ 0, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
|FLAGS_showpoint
, 6, '?', 6, "Test??", IOSTATE_goodbit
},
3835 {type_str
, /* "800" */ 1, IOSTATE_goodbit
, FLAGS_showbase
|FLAGS_showpos
, 6, ' ', 4, " 800", IOSTATE_goodbit
},
3836 {type_str
, /* "3.14159" */ 2, IOSTATE_goodbit
, FLAGS_scientific
, 2, 'x', 2, "3.14159", IOSTATE_goodbit
},
3837 {type_str
, /* " Test" */ 3, IOSTATE_goodbit
, FLAGS_skipws
, 6, 'x', 2, " Test", IOSTATE_goodbit
},
3839 {type_int
, /* 0 */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3840 {type_int
, /* 0 */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3841 {type_int
, /* 0 */ 0, IOSTATE_goodbit
, 0, 6, ' ', 4, " 0", IOSTATE_goodbit
},
3842 {type_int
, /* 7 */ 1, IOSTATE_goodbit
, 0, 6, '0', 3, "007", IOSTATE_goodbit
},
3843 {type_int
, /* 10 */ 2, IOSTATE_goodbit
, FLAGS_left
, 6, ' ', 5, "10 ", IOSTATE_goodbit
},
3844 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
, 6, ' ', 0, "18", IOSTATE_goodbit
},
3845 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 0, "0x18", IOSTATE_goodbit
},
3846 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_hex
|FLAGS_showbase
, 6, '*', 8, "0x****18", IOSTATE_goodbit
},
3847 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_showbase
, 6, '*', 4, "*030", IOSTATE_goodbit
},
3848 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_dec
|FLAGS_showbase
, 6, ' ', 0, "030", IOSTATE_goodbit
},
3849 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_dec
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 0, "0x18", IOSTATE_goodbit
},
3850 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_left
|FLAGS_oct
|FLAGS_hex
, 6, ' ', 5, "18 ", IOSTATE_goodbit
},
3851 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 0, "0x18", IOSTATE_goodbit
},
3852 {type_int
, /* 24 */ 3, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_showbase
, 6, ' ', 0, "24", IOSTATE_goodbit
},
3853 {type_int
, /* 55 */ 4, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_uppercase
, 6, ' ', 0, "0X37", IOSTATE_goodbit
},
3854 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_showpoint
|FLAGS_uppercase
, 6, ' ', 0, "0X400", IOSTATE_goodbit
},
3855 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_showpos
, 6, ' ', 0, "0x400", IOSTATE_goodbit
},
3856 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showpos
, 6, ' ', 0, "400", IOSTATE_goodbit
},
3857 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_showpos
, 6, ' ', 0, "2000", IOSTATE_goodbit
},
3858 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_oct
|FLAGS_showbase
, 6, 'x', 8, "0xxx2000", IOSTATE_goodbit
},
3859 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_showbase
|FLAGS_showpoint
|FLAGS_showpos
, 6, ' ', 0, "+1024", IOSTATE_goodbit
},
3860 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_showbase
|FLAGS_showpos
, 6, 'a', 6, "a+1024", IOSTATE_goodbit
},
3861 {type_int
, /* 1024 */ 5, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_showbase
|FLAGS_showpos
, 6, ' ', 8, "+ 1024", IOSTATE_goodbit
},
3862 {type_int
, /* 1023 */ 6, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_uppercase
, 6, ' ', 0, "0X3FF", IOSTATE_goodbit
},
3863 {type_int
, /* 1023 */ 6, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
|FLAGS_scientific
, 6, ' ', 0, "0x3ff", IOSTATE_goodbit
},
3864 {type_int
, /* 65536 */ 7, IOSTATE_goodbit
, FLAGS_right
|FLAGS_showpos
|FLAGS_fixed
, 6, ' ', 8, " +65536", IOSTATE_goodbit
},
3865 {type_int
, /* 2147483647 */ 8, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showbase
, 6, ' ', 0, "0x7fffffff", IOSTATE_goodbit
},
3866 {type_int
, /* 2147483648 */ 9, IOSTATE_goodbit
, FLAGS_dec
, 6, ' ', 0, "-2147483648", IOSTATE_goodbit
},
3867 {type_int
, /* 4294967295 */ 10, IOSTATE_goodbit
, FLAGS_internal
, 6, ' ', 8, " -1", IOSTATE_goodbit
},
3868 {type_int
, /* -20 */ 11, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_oct
|FLAGS_showbase
, 6, ' ', 8, "037777777754", IOSTATE_goodbit
},
3869 {type_int
, /* -20 */ 11, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_showpos
, 6, ' ', 0, "-20", IOSTATE_goodbit
},
3870 {type_int
, /* 0 */ 0, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_showpos
, 6, ' ', 8, " 0", IOSTATE_goodbit
},
3872 {type_flt
, /* 1.0f */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3873 {type_flt
, /* 1.0f */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3874 {type_flt
, /* 1.0f */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0, "1", IOSTATE_goodbit
},
3875 {type_flt
, /* 0.0f */ 1, IOSTATE_goodbit
, 0, 6, ' ', 0, "0", IOSTATE_goodbit
},
3876 {type_flt
, /* 4.25f */ 2, IOSTATE_goodbit
, 0, 6, ' ', 0, "4.25", IOSTATE_goodbit
},
3877 {type_flt
, /* 3.999f */ 3, IOSTATE_goodbit
, 0, 6, ' ', 0, "3.999", IOSTATE_goodbit
},
3878 {type_flt
, /* 3.999f */ 3, IOSTATE_goodbit
, 0, 3, ' ', 0, "4", IOSTATE_goodbit
},
3879 {type_flt
, /* 12.0005f */ 4, IOSTATE_goodbit
, 0, 6, ' ', 0, "12.0005", IOSTATE_goodbit
},
3880 {type_flt
, /* 12.0005f */ 4, IOSTATE_goodbit
, 0, 5, ' ', 0, "12", IOSTATE_goodbit
},
3881 {type_flt
, /* 15.33582f */ 5, IOSTATE_goodbit
, 0, 4, ' ', 0, "15.34", IOSTATE_goodbit
},
3882 {type_flt
, /* 15.0f */ 6, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_hex
|FLAGS_showbase
, 6, ' ', 4, " 15", IOSTATE_goodbit
},
3883 {type_flt
, /* 15.22f */ 7, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
|FLAGS_showbase
, 3, ' ', 6, "15.2 ", IOSTATE_goodbit
},
3884 {type_flt
, /* 15.22 */ 7, IOSTATE_goodbit
, FLAGS_internal
, 3, 'x', 6, "xx15.2", IOSTATE_goodbit
},
3885 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_showpoint
, 9, ' ', 0, "21.1230", IOSTATE_goodbit
},
3886 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_showpos
, 9, ' ', 0, "+21.123", IOSTATE_goodbit
},
3887 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_showpos
, 9, ' ', 8, "+ 21.123", IOSTATE_goodbit
},
3888 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_showpos
, 0, ' ', 0, "+2e+001", IOSTATE_goodbit
},
3889 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, 0, 1, ' ', 0, "2e+001", IOSTATE_goodbit
},
3890 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_showpos
, 2, ' ', 0, "+21", IOSTATE_goodbit
},
3891 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, 0, 4, ' ', 0, "21.12", IOSTATE_goodbit
},
3892 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
, 2, ' ', 0, "2.11e+001", IOSTATE_goodbit
},
3893 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
, 4, ' ', 0, "2.1123e+001", IOSTATE_goodbit
},
3894 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
, 6, ' ', 0, "2.112300e+001", IOSTATE_goodbit
},
3895 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
|FLAGS_uppercase
, 2, ' ', 0, "2.11E+001", IOSTATE_goodbit
},
3896 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_scientific
|FLAGS_uppercase
, 2, '*', 10, "*2.11E+001", IOSTATE_goodbit
},
3897 {type_flt
, /* 21.123f */ 8, IOSTATE_goodbit
, FLAGS_fixed
, 6, ' ', 0, "21.122999", IOSTATE_goodbit
},
3898 {type_flt
, /* 0.1f */ 9, IOSTATE_goodbit
, FLAGS_fixed
, 6, ' ', 0, "0.100000", IOSTATE_goodbit
},
3899 {type_flt
, /* 0.1f */ 9, IOSTATE_goodbit
, FLAGS_scientific
, 6, ' ', 0, "1.000000e-001", IOSTATE_goodbit
},
3900 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_fixed
, 3, ' ', 0, "13.142", IOSTATE_goodbit
},
3901 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_fixed
, 8, ' ', 0, "13.141590", IOSTATE_goodbit
},
3902 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_fixed
|FLAGS_showpoint
, 8, ' ', 0, "13.141590", IOSTATE_goodbit
},
3903 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_scientific
|FLAGS_fixed
, 8, ' ', 0, "13.1416", IOSTATE_goodbit
},
3904 {type_flt
, /* 13.14159f */ 10, IOSTATE_goodbit
, FLAGS_scientific
|FLAGS_fixed
, 2, ' ', 0, "13", IOSTATE_goodbit
},
3905 {type_flt
, /* 0.00013f */ 11, IOSTATE_goodbit
, 0, -1, ' ', 0, "0.00013", IOSTATE_goodbit
},
3906 {type_flt
, /* 0.00013f */ 11, IOSTATE_goodbit
, 0, -1, ' ', 0, "0.00013", IOSTATE_goodbit
},
3907 {type_flt
, /* 0.00013f */ 11, IOSTATE_goodbit
, 0, -1, ' ', 0, "0.00013", IOSTATE_goodbit
},
3908 {type_flt
, /* 0.000013f */ 12, IOSTATE_goodbit
, 0, 4, ' ', 0, "1.3e-005", IOSTATE_goodbit
},
3909 {type_flt
, /* 0.000013f */ 12, IOSTATE_goodbit
, FLAGS_showpoint
, 4, ' ', 0, "1.300e-005", IOSTATE_goodbit
},
3910 {type_flt
, /* 0.000013f */ 12, IOSTATE_goodbit
, FLAGS_showpoint
, 6, ' ', 0, "1.30000e-005", IOSTATE_goodbit
},
3911 {type_flt
, /* INFINITY */ 13, IOSTATE_goodbit
, 0, 6, ' ', 0, "1.#INF", IOSTATE_goodbit
},
3912 {type_flt
, /* INFINITY */ 13, IOSTATE_goodbit
, 0, 4, ' ', 0, "1.#IO", IOSTATE_goodbit
},
3913 {type_flt
, /* -INFINITY */ 14, IOSTATE_goodbit
, 0, 6, ' ', 0, "-1.#INF", IOSTATE_goodbit
},
3914 {type_flt
, /* NAN */ 15, IOSTATE_goodbit
, 0, 6, ' ', 0, "1.#QNAN", IOSTATE_goodbit
},
3916 {type_dbl
, /* 1.0 */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0, "1", IOSTATE_goodbit
},
3917 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 6, ' ', 0, "3.14159", IOSTATE_goodbit
},
3918 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 9, ' ', 0, "3.14159265", IOSTATE_goodbit
},
3919 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 12, ' ', 0, "3.14159265359", IOSTATE_goodbit
},
3920 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 15, ' ', 0, "3.14159265358979", IOSTATE_goodbit
},
3921 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, 0, 16, ' ', 0, "3.14159265358979", IOSTATE_goodbit
},
3922 {type_dbl
, /* 314.1592653589793238 */ 2, IOSTATE_goodbit
, 0, 16, ' ', 0, "314.159265358979", IOSTATE_goodbit
},
3923 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, FLAGS_scientific
, 16, ' ', 0, "3.141592653589793e+000", IOSTATE_goodbit
},
3924 {type_dbl
, /* 314.1592653589793238 */ 2, IOSTATE_goodbit
, FLAGS_scientific
, 16, ' ', 0, "3.141592653589793e+002", IOSTATE_goodbit
},
3925 {type_dbl
, /* 3.141592653589793238 */ 1, IOSTATE_goodbit
, FLAGS_fixed
, -1, ' ', 0, "3.141592653589793", IOSTATE_goodbit
},
3926 {type_dbl
, /* 314.159265358979 */ 3, IOSTATE_goodbit
, FLAGS_fixed
, 12, ' ', 0, "314.159265358979", IOSTATE_goodbit
},
3927 {type_dbl
, /* 1231314.269811862199 */ 4, IOSTATE_goodbit
, FLAGS_fixed
, 10, ' ', 0, "1231314.2698118621", IOSTATE_goodbit
},
3928 {type_dbl
, /* 9.961472e6 */ 5, IOSTATE_goodbit
, FLAGS_fixed
, 500, ' ', 0, "9961472.000000000000000", IOSTATE_goodbit
},
3929 /* crashes on XP/2k3 {type_dbl, 8.98846567431e307 6, IOSTATE_goodbit, FLAGS_fixed, 500, ' ', 0, "", IOSTATE_goodbit}, */
3930 /* crashes on XP/2k3 {type_dbl, DBL_MAX 7, IOSTATE_goodbit, FLAGS_fixed|FLAGS_showpos, 500, ' ', 5, " ", IOSTATE_goodbit}, */
3931 {type_dbl
, /* DBL_MAX */ 7, IOSTATE_goodbit
, FLAGS_showpoint
, 500, ' ', 0, "1.79769313486232e+308", IOSTATE_goodbit
},
3933 {type_ptr
, /* NULL */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3934 {type_ptr
, /* NULL */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3935 {type_ptr
, /* NULL */ 0, IOSTATE_goodbit
, 0, 6, ' ', 0,
3936 is_64
? "0x0000000000000000" : "0x00000000", IOSTATE_goodbit
},
3937 {type_ptr
, /* 0xdeadbeef */ 1, IOSTATE_goodbit
, 0, 6, ' ', 0,
3938 is_64
? "0x00000000DEADBEEF" : "0xDEADBEEF", IOSTATE_goodbit
},
3939 {type_ptr
, /* 0xdeadbeef */ 1, IOSTATE_goodbit
, 0, 6, '*', 12,
3940 is_64
? "0x00000000DEADBEEF" : "**0xDEADBEEF", IOSTATE_goodbit
},
3941 {type_ptr
, /* 0xdeadbeef */ 1, IOSTATE_goodbit
, FLAGS_internal
, 6, ' ', 14,
3942 is_64
? "0x00000000DEADBEEF" : "0x DEADBEEF", IOSTATE_goodbit
},
3943 {type_ptr
, /* 0xdeadbeef */ 1, IOSTATE_goodbit
, FLAGS_left
, 6, 'x', 11,
3944 is_64
? "0x00000000DEADBEEF" : "0xDEADBEEFx", IOSTATE_goodbit
},
3945 {type_ptr
, /* 0x1234cdef */ 2, IOSTATE_goodbit
, FLAGS_dec
|FLAGS_showpos
, 6, ' ', 0,
3946 is_64
? "0x000000001234CDEF" : "0x1234CDEF", IOSTATE_goodbit
},
3947 {type_ptr
, /* 0x1 */ 3, IOSTATE_goodbit
, FLAGS_oct
|FLAGS_showbase
, 6, ' ', 0,
3948 is_64
? "0x0000000000000001" : "0x00000001", IOSTATE_goodbit
},
3949 {type_ptr
, /* 0xffffffff */ 4, IOSTATE_goodbit
, FLAGS_hex
|FLAGS_showpoint
, 6, ' ', 0,
3950 is_64
? "0x00000000FFFFFFFF" : "0xFFFFFFFF", IOSTATE_goodbit
},
3951 {type_ptr
, /* 0xffffffff */ 4, IOSTATE_goodbit
, FLAGS_uppercase
|FLAGS_fixed
, 6, ' ', 0,
3952 is_64
? "0X00000000FFFFFFFF" : "0XFFFFFFFF", IOSTATE_goodbit
},
3953 {type_ptr
, /* 0x1 */ 3, IOSTATE_goodbit
, FLAGS_uppercase
, 6, ' ', 0,
3954 is_64
? "0X0000000000000001" : "0X00000001", IOSTATE_goodbit
},
3955 {type_ptr
, /* NULL */ 0, IOSTATE_goodbit
, FLAGS_uppercase
, 6, ' ', 0,
3956 is_64
? "0x0000000000000000" : "0x00000000", IOSTATE_goodbit
},
3957 {type_ptr
, /* NULL */ 0, IOSTATE_goodbit
, FLAGS_uppercase
|FLAGS_showbase
, 12, 'x', 12,
3958 is_64
? "0x0000000000000000" : "xx0x00000000", IOSTATE_goodbit
},
3959 {type_ptr
, /* NULL */ 0, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_uppercase
|FLAGS_showbase
, 6, '?', 20,
3960 is_64
? "0x??0000000000000000" : "0x??????????00000000", IOSTATE_goodbit
},
3962 {type_sbf
, /* NULL */ 0, IOSTATE_badbit
, 0, 6, ' ', 0, "", IOSTATE_badbit
|IOSTATE_failbit
},
3963 {type_sbf
, /* NULL */ 0, IOSTATE_eofbit
, 0, 6, ' ', 0, "", IOSTATE_eofbit
|IOSTATE_failbit
},
3964 /* crashes on native {STREAMBUF, NULL 0, IOSTATE_goodbit, 0, 6, ' ', 0, "", IOSTATE_goodbit}, */
3965 {type_sbf
, /* &ssb_test1.base */ 1, IOSTATE_goodbit
, FLAGS_skipws
|FLAGS_showpos
|FLAGS_uppercase
,
3966 6, ' ', 0, " we both know what's been going on ", IOSTATE_goodbit
},
3967 {type_sbf
, /* &ssb_test1.base */ 2, IOSTATE_goodbit
, FLAGS_left
|FLAGS_hex
|FLAGS_showbase
,
3968 6, '*', 50, "123 We know the game and", IOSTATE_goodbit
},
3969 {type_sbf
, /* &ssb_test1.base */ 3, IOSTATE_goodbit
, FLAGS_internal
|FLAGS_scientific
|FLAGS_showpoint
,
3970 6, '*', 50, "we're gonna play it 3.14159", IOSTATE_goodbit
}
3973 pssb
= call_func1(p_strstreambuf_ctor
, &ssb
);
3974 ok(pssb
== &ssb
, "wrong return, expected %p got %p\n", &ssb
, pssb
);
3975 pos
= call_func3(p_ostream_sb_ctor
, &os
, &ssb
.base
, TRUE
);
3976 ok(pos
== &os
, "wrong return, expected %p got %p\n", &os
, pos
);
3977 pssb
= call_func1(p_strstreambuf_ctor
, &ssb_test1
);
3978 ok(pssb
== &ssb_test1
, "wrong return, expected %p got %p\n", &ssb_test1
, pssb
);
3979 ret
= (int) call_func3(p_streambuf_xsputn
, &ssb_test1
.base
, " we both know what's been going on ", 36);
3980 ok(ret
== 36, "expected 36 got %d\n", ret
);
3981 pssb
= call_func1(p_strstreambuf_ctor
, &ssb_test2
);
3982 ok(pssb
== &ssb_test2
, "wrong return, expected %p got %p\n", &ssb_test2
, pssb
);
3983 ret
= (int) call_func3(p_streambuf_xsputn
, &ssb_test2
.base
, "123 We know the game and", 24);
3984 ok(ret
== 24, "expected 24 got %d\n", ret
);
3985 pssb
= call_func1(p_strstreambuf_ctor
, &ssb_test3
);
3986 ok(pssb
== &ssb_test3
, "wrong return, expected %p got %p\n", &ssb_test3
, pssb
);
3987 ret
= (int) call_func3(p_streambuf_xsputn
, &ssb_test3
.base
, "we're gonna play it 3.14159", 27);
3988 ok(ret
== 27, "expected 27 got %d\n", ret
);
3990 for (i
= 0; i
< ARRAY_SIZE(tests
); i
++) {
3991 os
.base_ios
.state
= tests
[i
].state
;
3992 os
.base_ios
.flags
= tests
[i
].flags
;
3993 os
.base_ios
.precision
= tests
[i
].precision
;
3994 os
.base_ios
.fill
= tests
[i
].fill
;
3995 os
.base_ios
.width
= tests
[i
].width
;
3996 ssb
.base
.pptr
= ssb
.base
.pbase
;
3998 switch (tests
[i
].type
) {
4000 pos
= call_func2(p_ostream_print_char
, &os
, (int) param_char
[tests
[i
].param_index
]); break;
4002 pos
= call_func2(p_ostream_print_str
, &os
, param_str
[tests
[i
].param_index
]); break;
4004 pos
= call_func2(p_ostream_print_int
, &os
, param_int
[tests
[i
].param_index
]); break;
4006 pos
= call_func2_ptr_flt(p_ostream_print_float
, &os
, param_float
[tests
[i
].param_index
]); break;
4008 pos
= call_func2_ptr_dbl(p_ostream_print_double
, &os
, param_double
[tests
[i
].param_index
]); break;
4010 pos
= call_func2(p_ostream_print_ptr
, &os
, param_ptr
[tests
[i
].param_index
]); break;
4012 pos
= call_func2(p_ostream_print_streambuf
, &os
, param_streambuf
[tests
[i
].param_index
]); break;
4015 length
= ssb
.base
.pptr
- ssb
.base
.pbase
;
4016 expected_length
= strlen(tests
[i
].expected_text
);
4017 ok(pos
== &os
, "Test %d: wrong return, expected %p got %p\n", i
, &os
, pos
);
4018 ok(os
.base_ios
.state
== tests
[i
].expected_flags
, "Test %d: expected %d got %d\n", i
,
4019 tests
[i
].expected_flags
, os
.base_ios
.state
);
4020 ok(os
.base_ios
.width
== 0, "Test %d: expected 0 got %d\n", i
, os
.base_ios
.width
);
4021 ok(expected_length
== length
, "Test %d: wrong output length, expected %d got %d\n", i
, expected_length
, length
);
4022 ok(!strncmp(tests
[i
].expected_text
, ssb
.base
.pbase
, length
),
4023 "Test %d: wrong output, expected '%s' got '%s'\n", i
, tests
[i
].expected_text
, ssb
.base
.pbase
);
4026 call_func1(p_ostream_vbase_dtor
, &os
);
4027 call_func1(p_strstreambuf_dtor
, &ssb
);
4028 call_func1(p_strstreambuf_dtor
, &ssb_test1
);
4029 call_func1(p_strstreambuf_dtor
, &ssb_test2
);
4030 call_func1(p_strstreambuf_dtor
, &ssb_test3
);
4033 static void test_ostream_withassign(void)
4035 ostream osa1
, osa2
, *posa
, *pos
;
4038 memset(&osa1
, 0xab, sizeof(ostream
));
4039 memset(&osa2
, 0xab, sizeof(ostream
));
4041 /* constructors/destructors */
4042 posa
= call_func3(p_ostream_withassign_sb_ctor
, &osa1
, NULL
, TRUE
);
4043 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4044 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
4045 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
4046 ok(osa1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, osa1
.base_ios
.state
);
4047 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4048 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
4049 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
4050 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
4051 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
4052 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
4053 ok(osa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa1
.base_ios
.do_lock
);
4054 call_func1(p_ostream_withassign_vbase_dtor
, &osa1
);
4055 osa1
.unknown
= 0xabababab;
4056 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
4057 osa1
.base_ios
.delbuf
= 0;
4058 posa
= call_func3(p_ostream_withassign_sb_ctor
, &osa1
, NULL
, FALSE
);
4059 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4060 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
4061 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
4062 ok(osa1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
4063 0xabababab|IOSTATE_badbit
, osa1
.base_ios
.state
);
4064 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4065 ok(osa1
.base_ios
.tie
== osa2
.base_ios
.tie
, "expected %p got %p\n", osa2
.base_ios
.tie
, osa1
.base_ios
.tie
);
4066 ok(osa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, osa1
.base_ios
.flags
);
4067 ok(osa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.precision
);
4068 ok(osa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", osa1
.base_ios
.fill
);
4069 ok(osa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.width
);
4070 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
4071 call_func1(p_ostream_withassign_dtor
, &osa1
.base_ios
);
4072 osa1
.unknown
= 0xabababab;
4073 osa1
.base_ios
.sb
= (streambuf
*) 0xabababab;
4074 posa
= call_func3(p_ostream_withassign_sb_ctor
, &osa1
, &sb
, TRUE
);
4075 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4076 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
4077 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
4078 ok(osa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, osa1
.base_ios
.state
);
4079 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4080 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
4081 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
4082 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
4083 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
4084 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
4085 ok(osa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa1
.base_ios
.do_lock
);
4086 call_func1(p_ostream_withassign_vbase_dtor
, &osa1
);
4087 osa1
.unknown
= 0xabababab;
4088 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
4089 osa1
.base_ios
.state
|= IOSTATE_badbit
;
4090 osa1
.base_ios
.delbuf
= 0;
4091 posa
= call_func3(p_ostream_withassign_sb_ctor
, &osa1
, &sb
, FALSE
);
4092 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4093 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
4094 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
4095 ok(osa1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.state
);
4096 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4097 ok(osa1
.base_ios
.tie
== osa2
.base_ios
.tie
, "expected %p got %p\n", osa2
.base_ios
.tie
, osa1
.base_ios
.tie
);
4098 ok(osa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, osa1
.base_ios
.flags
);
4099 ok(osa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.precision
);
4100 ok(osa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", osa1
.base_ios
.fill
);
4101 ok(osa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.width
);
4102 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
4103 call_func1(p_ostream_withassign_dtor
, &osa1
.base_ios
);
4104 posa
= call_func2(p_ostream_withassign_ctor
, &osa2
, TRUE
);
4105 ok(posa
== &osa2
, "wrong return, expected %p got %p\n", &osa2
, posa
);
4106 ok(osa2
.unknown
== 0, "expected 0 got %d\n", osa2
.unknown
);
4107 ok(osa2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa2
.base_ios
.sb
);
4108 ok(osa2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, osa2
.base_ios
.state
);
4109 ok(osa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa2
.base_ios
.delbuf
);
4110 ok(osa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa2
.base_ios
.tie
);
4111 ok(osa2
.base_ios
.flags
== 0, "expected 0 got %x\n", osa2
.base_ios
.flags
);
4112 ok(osa2
.base_ios
.precision
== 6, "expected 6 got %d\n", osa2
.base_ios
.precision
);
4113 ok(osa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa2
.base_ios
.fill
);
4114 ok(osa2
.base_ios
.width
== 0, "expected 0 got %d\n", osa2
.base_ios
.width
);
4115 ok(osa2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa2
.base_ios
.do_lock
);
4116 call_func1(p_ostream_withassign_vbase_dtor
, &osa2
);
4117 osa2
.unknown
= 0xcdcdcdcd;
4118 memset(&osa2
.base_ios
, 0xcd, sizeof(ios
));
4119 osa2
.base_ios
.delbuf
= 0;
4120 psb
= osa2
.base_ios
.sb
;
4121 pos
= osa2
.base_ios
.tie
;
4122 posa
= call_func2(p_ostream_withassign_ctor
, &osa2
, FALSE
);
4123 ok(posa
== &osa2
, "wrong return, expected %p got %p\n", &osa2
, posa
);
4124 ok(osa2
.unknown
== 0, "expected 0 got %d\n", osa2
.unknown
);
4125 ok(osa2
.base_ios
.sb
== psb
, "expected %p got %p\n", psb
, osa2
.base_ios
.sb
);
4126 ok(osa2
.base_ios
.state
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa2
.base_ios
.state
);
4127 ok(osa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa2
.base_ios
.delbuf
);
4128 ok(osa2
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, osa2
.base_ios
.tie
);
4129 ok(osa2
.base_ios
.flags
== 0xcdcdcdcd, "expected %d got %x\n", 0xcdcdcdcd, osa2
.base_ios
.flags
);
4130 ok(osa2
.base_ios
.precision
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa2
.base_ios
.precision
);
4131 ok(osa2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", osa2
.base_ios
.fill
);
4132 ok(osa2
.base_ios
.width
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa2
.base_ios
.width
);
4133 ok(osa2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa2
.base_ios
.do_lock
);
4134 call_func1(p_ostream_withassign_dtor
, &osa2
.base_ios
);
4135 osa1
.unknown
= 0xabababab;
4136 osa2
.unknown
= osa2
.base_ios
.delbuf
= 0xcdcdcdcd;
4137 posa
= call_func3(p_ostream_withassign_copy_ctor
, &osa1
, &osa2
, TRUE
);
4138 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4139 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
4140 ok(osa1
.base_ios
.sb
== osa2
.base_ios
.sb
, "expected %p got %p\n", osa2
.base_ios
.sb
, osa1
.base_ios
.sb
);
4141 ok(osa1
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, osa1
.base_ios
.state
);
4142 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4143 ok(osa1
.base_ios
.tie
== osa2
.base_ios
.tie
, "expected %p got %p\n", osa2
.base_ios
.tie
, osa1
.base_ios
.tie
);
4144 ok(osa1
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, osa1
.base_ios
.flags
);
4145 ok(osa1
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.precision
);
4146 ok(osa1
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.fill
);
4147 ok(osa1
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.width
);
4148 ok(osa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa1
.base_ios
.do_lock
);
4149 call_func1(p_ostream_withassign_vbase_dtor
, &osa1
);
4150 osa1
.unknown
= 0xabababab;
4151 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
4152 osa1
.base_ios
.state
|= IOSTATE_badbit
;
4153 osa1
.base_ios
.delbuf
= 0;
4154 pos
= osa1
.base_ios
.tie
;
4155 posa
= call_func3(p_ostream_withassign_copy_ctor
, &osa1
, &osa2
, FALSE
);
4156 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4157 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
4158 ok(osa1
.base_ios
.sb
== osa2
.base_ios
.sb
, "expected %p got %p\n", osa2
.base_ios
.sb
, osa1
.base_ios
.sb
);
4159 ok(osa1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.state
);
4160 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4161 ok(osa1
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, osa1
.base_ios
.tie
);
4162 ok(osa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, osa1
.base_ios
.flags
);
4163 ok(osa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.precision
);
4164 ok(osa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", osa1
.base_ios
.fill
);
4165 ok(osa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.width
);
4166 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
4167 call_func1(p_ostream_withassign_dtor
, &osa1
.base_ios
);
4168 osa1
.unknown
= 0xabababab;
4169 osa2
.base_ios
.sb
= NULL
;
4170 posa
= call_func3(p_ostream_withassign_copy_ctor
, &osa1
, &osa2
, TRUE
);
4171 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4172 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
4173 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
4174 ok(osa1
.base_ios
.state
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, osa1
.base_ios
.state
);
4175 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4176 ok(osa1
.base_ios
.tie
== osa2
.base_ios
.tie
, "expected %p got %p\n", osa2
.base_ios
.tie
, osa1
.base_ios
.tie
);
4177 ok(osa1
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, osa1
.base_ios
.flags
);
4178 ok(osa1
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.precision
);
4179 ok(osa1
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.fill
);
4180 ok(osa1
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", osa1
.base_ios
.width
);
4181 ok(osa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", osa1
.base_ios
.do_lock
);
4182 call_func1(p_ostream_withassign_vbase_dtor
, &osa1
);
4183 osa1
.unknown
= 0xabababab;
4184 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
4185 osa1
.base_ios
.delbuf
= 0;
4186 posa
= call_func3(p_ostream_withassign_copy_ctor
, &osa1
, &osa2
, FALSE
);
4187 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4188 ok(osa1
.unknown
== 0, "expected 0 got %d\n", osa1
.unknown
);
4189 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
4190 ok(osa1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
4191 0xabababab|IOSTATE_badbit
, osa1
.base_ios
.state
);
4192 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4193 ok(osa1
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, osa1
.base_ios
.tie
);
4194 ok(osa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, osa1
.base_ios
.flags
);
4195 ok(osa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.precision
);
4196 ok(osa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", osa1
.base_ios
.fill
);
4197 ok(osa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.width
);
4198 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
4199 call_func1(p_ostream_withassign_dtor
, &osa1
.base_ios
);
4202 osa1
.unknown
= 0xabababab;
4203 osa1
.base_ios
.sb
= (streambuf
*) 0xabababab;
4204 if (0) /* crashes on native */
4205 osa1
.base_ios
.delbuf
= 0xabababab;
4206 posa
= call_func2(p_ostream_withassign_assign_sb
, &osa1
, &sb
);
4207 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4208 ok(osa1
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.unknown
);
4209 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
4210 ok(osa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, osa1
.base_ios
.state
);
4211 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4212 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
4213 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
4214 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
4215 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
4216 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
4217 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
4218 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
4219 osa1
.base_ios
.delbuf
= 0;
4220 posa
= call_func2(p_ostream_withassign_assign_sb
, &osa1
, NULL
);
4221 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4222 ok(osa1
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.unknown
);
4223 ok(osa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.sb
);
4224 ok(osa1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, osa1
.base_ios
.state
);
4225 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4226 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
4227 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
4228 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
4229 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
4230 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
4231 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
4232 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
4233 osa1
.base_ios
.delbuf
= 0;
4234 osa2
.base_ios
.sb
= &sb
;
4235 posa
= call_func2(p_ostream_withassign_assign_os
, &osa1
, &osa2
);
4236 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4237 ok(osa1
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.unknown
);
4238 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
4239 ok(osa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, osa1
.base_ios
.state
);
4240 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4241 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
4242 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
4243 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
4244 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
4245 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
4246 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
4247 memset(&osa1
.base_ios
, 0xab, sizeof(ios
));
4248 osa1
.base_ios
.delbuf
= 0;
4249 posa
= call_func2(p_ostream_withassign_assign
, &osa1
, &osa2
);
4250 ok(posa
== &osa1
, "wrong return, expected %p got %p\n", &osa1
, posa
);
4251 ok(osa1
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.unknown
);
4252 ok(osa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, osa1
.base_ios
.sb
);
4253 ok(osa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, osa1
.base_ios
.state
);
4254 ok(osa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", osa1
.base_ios
.delbuf
);
4255 ok(osa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, osa1
.base_ios
.tie
);
4256 ok(osa1
.base_ios
.flags
== 0, "expected 0 got %x\n", osa1
.base_ios
.flags
);
4257 ok(osa1
.base_ios
.precision
== 6, "expected 6 got %d\n", osa1
.base_ios
.precision
);
4258 ok(osa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", osa1
.base_ios
.fill
);
4259 ok(osa1
.base_ios
.width
== 0, "expected 0 got %d\n", osa1
.base_ios
.width
);
4260 ok(osa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, osa1
.base_ios
.do_lock
);
4263 static void test_ostrstream(void)
4265 ostream os1
, os2
, *pos
, *pos2
;
4270 memset(&os1
, 0xab, sizeof(ostream
));
4271 memset(&os2
, 0xab, sizeof(ostream
));
4273 /* constructors/destructors */
4274 pos
= call_func2(p_ostrstream_ctor
, &os1
, TRUE
);
4275 pssb
= (strstreambuf
*) os1
.base_ios
.sb
;
4276 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
4277 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
4278 ok(os1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, os1
.base_ios
.sb
);
4279 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
4280 ok(os1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", os1
.base_ios
.delbuf
);
4281 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
4282 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
4283 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
4284 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
4285 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
4286 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
4287 ok(pssb
->dynamic
== 1, "expected 1, got %d\n", pssb
->dynamic
);
4288 ok(pssb
->increase
== 1, "expected 1, got %d\n", pssb
->increase
);
4289 ok(pssb
->constant
== 0, "expected 0, got %d\n", pssb
->constant
);
4290 ok(pssb
->f_alloc
== NULL
, "expected %p, got %p\n", NULL
, pssb
->f_alloc
);
4291 ok(pssb
->f_free
== NULL
, "expected %p, got %p\n", NULL
, pssb
->f_free
);
4292 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
4293 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
4294 ok(pssb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pssb
->base
.base
);
4295 ok(pssb
->base
.ebuf
== NULL
, "wrong buffer end, expected %p got %p\n", NULL
, pssb
->base
.ebuf
);
4296 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
4297 call_func1(p_ostrstream_vbase_dtor
, &os1
);
4298 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
4299 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
4300 os1
.unknown
= 0xabababab;
4301 memset(&os1
.base_ios
, 0xab, sizeof(ios
));
4302 os1
.base_ios
.delbuf
= 0;
4303 pos
= call_func2(p_ostrstream_ctor
, &os1
, FALSE
);
4304 pssb
= (strstreambuf
*) os1
.base_ios
.sb
;
4305 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
4306 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
4307 ok(os1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, os1
.base_ios
.sb
);
4308 ok(os1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.state
);
4309 ok(os1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", os1
.base_ios
.delbuf
);
4310 ok(os1
.base_ios
.tie
== os2
.base_ios
.tie
, "expected %p got %p\n", os2
.base_ios
.tie
, os1
.base_ios
.tie
);
4311 ok(os1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, os1
.base_ios
.flags
);
4312 ok(os1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.precision
);
4313 ok(os1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", os1
.base_ios
.fill
);
4314 ok(os1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.width
);
4315 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
4316 ok(pssb
->dynamic
== 1, "expected 1, got %d\n", pssb
->dynamic
);
4317 ok(pssb
->increase
== 1, "expected 1, got %d\n", pssb
->increase
);
4318 ok(pssb
->constant
== 0, "expected 0, got %d\n", pssb
->constant
);
4319 ok(pssb
->f_alloc
== NULL
, "expected %p, got %p\n", NULL
, pssb
->f_alloc
);
4320 ok(pssb
->f_free
== NULL
, "expected %p, got %p\n", NULL
, pssb
->f_free
);
4321 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
4322 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
4323 ok(pssb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pssb
->base
.base
);
4324 ok(pssb
->base
.ebuf
== NULL
, "wrong buffer end, expected %p got %p\n", NULL
, pssb
->base
.ebuf
);
4325 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
4326 call_func1(p_ostrstream_dtor
, &os1
.base_ios
);
4327 ok(os1
.base_ios
.sb
== &pssb
->base
, "expected %p got %p\n", &pssb
->base
, os1
.base_ios
.sb
);
4328 ok(os1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.state
);
4329 call_func1(p_strstreambuf_dtor
, pssb
);
4330 p_operator_delete(pssb
);
4332 memset(&os1
, 0xab, sizeof(ostream
));
4333 pos
= call_func5(p_ostrstream_buffer_ctor
, &os1
, buffer
, 32, OPENMODE_in
|OPENMODE_out
, TRUE
);
4334 pssb
= (strstreambuf
*) os1
.base_ios
.sb
;
4335 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
4336 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
4337 ok(os1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, os1
.base_ios
.sb
);
4338 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
4339 ok(os1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", os1
.base_ios
.delbuf
);
4340 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
4341 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
4342 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
4343 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
4344 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
4345 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
4346 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
4347 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
4348 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
4349 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
4350 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
4351 ok(pssb
->base
.ebuf
== buffer
+ 32, "wrong buffer end, expected %p got %p\n", buffer
+ 32, pssb
->base
.ebuf
);
4352 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
4353 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
4354 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
4355 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
4356 ok(pssb
->base
.pptr
== buffer
, "wrong put pointer, expected %p got %p\n", buffer
, pssb
->base
.pptr
);
4357 ok(pssb
->base
.epptr
== buffer
+ 32, "wrong put end, expected %p got %p\n", buffer
+ 32, pssb
->base
.epptr
);
4358 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
4359 call_func1(p_ostrstream_vbase_dtor
, &os1
);
4360 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
4361 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
4362 strcpy(buffer
, "Test");
4363 memset(&os1
, 0xab, sizeof(ostream
));
4364 pos
= call_func5(p_ostrstream_buffer_ctor
, &os1
, buffer
, 16, OPENMODE_ate
, TRUE
);
4365 pssb
= (strstreambuf
*) os1
.base_ios
.sb
;
4366 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
4367 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
4368 ok(os1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, os1
.base_ios
.sb
);
4369 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
4370 ok(os1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", os1
.base_ios
.delbuf
);
4371 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
4372 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
4373 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
4374 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
4375 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
4376 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
4377 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
4378 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
4379 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
4380 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
4381 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
4382 ok(pssb
->base
.ebuf
== buffer
+ 16, "wrong buffer end, expected %p got %p\n", buffer
+ 16, pssb
->base
.ebuf
);
4383 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
4384 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
4385 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
4386 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
4387 ok(pssb
->base
.pptr
== buffer
+ 4, "wrong put pointer, expected %p got %p\n", buffer
+ 4, pssb
->base
.pptr
);
4388 ok(pssb
->base
.epptr
== buffer
+ 16, "wrong put end, expected %p got %p\n", buffer
+ 16, pssb
->base
.epptr
);
4389 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
4390 call_func1(p_ostrstream_vbase_dtor
, &os1
);
4391 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
4392 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
4393 os1
.unknown
= 0xabababab;
4394 memset(&os1
.base_ios
, 0xab, sizeof(ios
));
4395 os1
.base_ios
.delbuf
= 0;
4396 pos
= call_func5(p_ostrstream_buffer_ctor
, &os1
, buffer
, -1, OPENMODE_app
, FALSE
);
4397 pssb
= (strstreambuf
*) os1
.base_ios
.sb
;
4398 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
4399 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
4400 ok(os1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, os1
.base_ios
.sb
);
4401 ok(os1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.state
);
4402 ok(os1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", os1
.base_ios
.delbuf
);
4403 ok(os1
.base_ios
.tie
== os2
.base_ios
.tie
, "expected %p got %p\n", os2
.base_ios
.tie
, os1
.base_ios
.tie
);
4404 ok(os1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, os1
.base_ios
.flags
);
4405 ok(os1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.precision
);
4406 ok(os1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", os1
.base_ios
.fill
);
4407 ok(os1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.width
);
4408 ok(os1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.do_lock
);
4409 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
4410 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
4411 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
4412 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
4413 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
4414 ok(pssb
->base
.ebuf
== (char *)((ULONG_PTR
)buffer
+ 0x7fffffff) || pssb
->base
.ebuf
== (char*) -1,
4415 "wrong buffer end, expected %p + 0x7fffffff or -1, got %p\n", buffer
, pssb
->base
.ebuf
);
4416 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
4417 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
4418 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
4419 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
4420 ok(pssb
->base
.pptr
== buffer
+ 4, "wrong put pointer, expected %p got %p\n", buffer
+ 4, pssb
->base
.pptr
);
4421 ok(pssb
->base
.epptr
== (char *)((ULONG_PTR
)buffer
+ 0x7fffffff) || pssb
->base
.epptr
== (char*) -1,
4422 "wrong buffer end, expected %p + 0x7fffffff or -1, got %p\n", buffer
, pssb
->base
.epptr
);
4423 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
4424 call_func1(p_ostrstream_dtor
, &os1
.base_ios
);
4425 ok(os1
.base_ios
.sb
== &pssb
->base
, "expected %p got %p\n", &pssb
->base
, os1
.base_ios
.sb
);
4426 ok(os1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, os1
.base_ios
.state
);
4427 call_func1(p_strstreambuf_dtor
, pssb
);
4428 p_operator_delete(pssb
);
4429 memset(&os1
, 0xab, sizeof(ostream
));
4430 pos
= call_func5(p_ostrstream_buffer_ctor
, &os1
, buffer
, 0, OPENMODE_trunc
, TRUE
);
4431 pssb
= (strstreambuf
*) os1
.base_ios
.sb
;
4432 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
4433 ok(os1
.unknown
== 0, "expected 0 got %d\n", os1
.unknown
);
4434 ok(os1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, os1
.base_ios
.sb
);
4435 ok(os1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os1
.base_ios
.state
);
4436 ok(os1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", os1
.base_ios
.delbuf
);
4437 ok(os1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.tie
);
4438 ok(os1
.base_ios
.flags
== 0, "expected 0 got %x\n", os1
.base_ios
.flags
);
4439 ok(os1
.base_ios
.precision
== 6, "expected 6 got %d\n", os1
.base_ios
.precision
);
4440 ok(os1
.base_ios
.fill
== ' ', "expected 32 got %d\n", os1
.base_ios
.fill
);
4441 ok(os1
.base_ios
.width
== 0, "expected 0 got %d\n", os1
.base_ios
.width
);
4442 ok(os1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os1
.base_ios
.do_lock
);
4443 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
4444 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
4445 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
4446 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
4447 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
4448 ok(pssb
->base
.ebuf
== buffer
+ 4, "wrong buffer end, expected %p got %p\n", buffer
+ 4, pssb
->base
.ebuf
);
4449 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
4450 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
4451 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
4452 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
4453 ok(pssb
->base
.pptr
== buffer
, "wrong put pointer, expected %p got %p\n", buffer
, pssb
->base
.pptr
);
4454 ok(pssb
->base
.epptr
== buffer
+ 4, "wrong put end, expected %p got %p\n", buffer
+ 4, pssb
->base
.epptr
);
4455 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
4456 call_func1(p_ostrstream_vbase_dtor
, &os1
);
4457 ok(os1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os1
.base_ios
.sb
);
4458 ok(os1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os1
.base_ios
.state
);
4460 os1
.unknown
= 0xcdcdcdcd;
4461 memset(&os1
.base_ios
, 0xcd, sizeof(ios
));
4462 pos
= call_func3(p_ostrstream_copy_ctor
, &os2
, &os1
, TRUE
);
4463 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
4464 ok(os2
.unknown
== 0, "expected 0 got %d\n", os2
.unknown
);
4465 ok(os2
.base_ios
.sb
== os1
.base_ios
.sb
, "expected %p got %p\n", os1
.base_ios
.sb
, os2
.base_ios
.sb
);
4466 ok(os2
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, os2
.base_ios
.state
);
4467 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
4468 ok(os2
.base_ios
.tie
== os1
.base_ios
.tie
, "expected %p got %p\n", os1
.base_ios
.tie
, os2
.base_ios
.tie
);
4469 ok(os2
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, os2
.base_ios
.flags
);
4470 ok(os2
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", os2
.base_ios
.precision
);
4471 ok(os2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", os2
.base_ios
.fill
);
4472 ok(os2
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", os2
.base_ios
.width
);
4473 ok(os2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os2
.base_ios
.do_lock
);
4474 call_func1(p_ostrstream_vbase_dtor
, &os2
);
4475 ok(os2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.sb
);
4476 ok(os2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os2
.base_ios
.state
);
4477 os2
.unknown
= 0xabababab;
4478 memset(&os2
.base_ios
, 0xab, sizeof(ios
));
4479 os2
.base_ios
.delbuf
= 0;
4480 pos2
= os2
.base_ios
.tie
;
4481 pos
= call_func3(p_ostrstream_copy_ctor
, &os2
, &os1
, FALSE
);
4482 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
4483 ok(os2
.unknown
== 0, "expected 0 got %d\n", os2
.unknown
);
4484 ok(os2
.base_ios
.sb
== os1
.base_ios
.sb
, "expected %p got %p\n", os1
.base_ios
.sb
, os2
.base_ios
.sb
);
4485 ok(os2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.state
);
4486 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
4487 ok(os2
.base_ios
.tie
== pos2
, "expected %p got %p\n", pos2
, os2
.base_ios
.tie
);
4488 ok(os2
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, os2
.base_ios
.flags
);
4489 ok(os2
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.precision
);
4490 ok(os2
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", os2
.base_ios
.fill
);
4491 ok(os2
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.width
);
4492 ok(os2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.do_lock
);
4493 call_func1(p_ostrstream_dtor
, &os2
.base_ios
);
4494 os1
.base_ios
.sb
= NULL
;
4495 memset(&os2
, 0xab, sizeof(ostream
));
4496 pos
= call_func3(p_ostrstream_copy_ctor
, &os2
, &os1
, TRUE
);
4497 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
4498 ok(os2
.unknown
== 0, "expected 0 got %d\n", os2
.unknown
);
4499 ok(os2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.sb
);
4500 ok(os2
.base_ios
.state
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, os2
.base_ios
.state
);
4501 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
4502 ok(os2
.base_ios
.tie
== os1
.base_ios
.tie
, "expected %p got %p\n", os1
.base_ios
.tie
, os2
.base_ios
.tie
);
4503 ok(os2
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, os2
.base_ios
.flags
);
4504 ok(os2
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", os2
.base_ios
.precision
);
4505 ok(os2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", os2
.base_ios
.fill
);
4506 ok(os2
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", os2
.base_ios
.width
);
4507 ok(os2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", os2
.base_ios
.do_lock
);
4508 call_func1(p_ostrstream_vbase_dtor
, &os2
);
4511 os2
.unknown
= 0xabababab;
4512 memset(&os2
.base_ios
, 0xab, sizeof(ios
));
4513 os2
.base_ios
.delbuf
= 0;
4514 pos
= call_func2(p_ostrstream_assign
, &os2
, &os1
);
4515 ok(pos
== &os2
, "wrong return, expected %p got %p\n", &os2
, pos
);
4516 ok(os2
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.unknown
);
4517 ok(os2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.sb
);
4518 ok(os2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, os2
.base_ios
.state
);
4519 ok(os2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", os2
.base_ios
.delbuf
);
4520 ok(os2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, os2
.base_ios
.tie
);
4521 ok(os2
.base_ios
.flags
== 0, "expected %x got %x\n", 0, os2
.base_ios
.flags
);
4522 ok(os2
.base_ios
.precision
== 6, "expected 6 got %d\n", os2
.base_ios
.precision
);
4523 ok(os2
.base_ios
.fill
== ' ', "expected 32 got %d\n", os2
.base_ios
.fill
);
4524 ok(os2
.base_ios
.width
== 0, "expected 0 got %d\n", os2
.base_ios
.width
);
4525 ok(os2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, os2
.base_ios
.do_lock
);
4528 pos
= call_func2(p_ostrstream_ctor
, &os1
, TRUE
);
4529 ok(pos
== &os1
, "wrong return, expected %p got %p\n", &os1
, pos
);
4530 ret
= (int) call_func1(p_ostrstream_pcount
, &os1
);
4531 ok(ret
== 0, "expected 0 got %d\n", ret
);
4532 pssb
= (strstreambuf
*) os1
.base_ios
.sb
;
4533 pssb
->base
.pptr
= (char*) 5;
4534 ret
= (int) call_func1(p_ostrstream_pcount
, &os1
);
4535 ok(ret
== 5, "expected 5 got %d\n", ret
);
4536 pssb
->base
.pbase
= (char*) 2;
4537 ret
= (int) call_func1(p_ostrstream_pcount
, &os1
);
4538 ok(ret
== 3, "expected 3 got %d\n", ret
);
4539 pssb
->base
.pptr
= NULL
;
4540 ret
= (int) call_func1(p_ostrstream_pcount
, &os1
);
4541 ok(ret
== 0, "expected 0 got %d\n", ret
);
4542 if (0) /* crashes on native */
4543 os1
.base_ios
.sb
= NULL
;
4544 pssb
->base
.pptr
= (char*) 1;
4545 ret
= (int) call_func1(p_ostrstream_pcount
, &os1
);
4546 ok(ret
== 0, "expected 0 got %d\n", ret
);
4547 call_func1(p_ostrstream_vbase_dtor
, &os1
);
4550 static void test_ofstream(void)
4552 const char *filename
= "ofstream_test";
4553 ostream ofs
, ofs_copy
, *pofs
;
4560 memset(&ofs
, 0xab, sizeof(ostream
));
4562 /* constructors/destructors */
4563 pofs
= call_func2(p_ofstream_ctor
, &ofs
, TRUE
);
4564 pfb
= (filebuf
*) ofs
.base_ios
.sb
;
4565 ok(pofs
== &ofs
, "wrong return, expected %p got %p\n", &ofs
, pofs
);
4566 ok(ofs
.unknown
== 0, "expected 0 got %d\n", ofs
.unknown
);
4567 ok(ofs
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ofs
.base_ios
.sb
);
4568 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4569 ok(ofs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ofs
.base_ios
.delbuf
);
4570 ok(ofs
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ofs
.base_ios
.tie
);
4571 ok(ofs
.base_ios
.flags
== 0x0, "expected %x got %x\n", 0x0, ofs
.base_ios
.flags
);
4572 ok(ofs
.base_ios
.precision
== 6, "expected 6 got %d\n", ofs
.base_ios
.precision
);
4573 ok(ofs
.base_ios
.fill
== ' ', "expected 32 got %d\n", ofs
.base_ios
.fill
);
4574 ok(ofs
.base_ios
.width
== 0, "expected 0 got %d\n", ofs
.base_ios
.width
);
4575 ok(ofs
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ofs
.base_ios
.do_lock
);
4576 ok(pfb
->fd
== -1, "wrong fd, expected -1 got %d\n", pfb
->fd
);
4577 ok(pfb
->close
== 0, "wrong value, expected 0 got %d\n", pfb
->close
);
4578 ok(pfb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb
->base
.allocated
);
4579 ok(pfb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb
->base
.unbuffered
);
4580 ok(pfb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pfb
->base
.base
);
4581 ok(pfb
->base
.ebuf
== NULL
, "wrong ebuf, expected %p got %p\n", NULL
, pfb
->base
.ebuf
);
4582 ok(pfb
->fd
== -1, "wrong fd, expected 0 got %d\n", pfb
->fd
);
4583 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4585 pofs
= call_func3(p_ofstream_fd_ctor
, &ofs
, 42, TRUE
);
4586 pfb
= (filebuf
*) ofs
.base_ios
.sb
;
4587 ok(pofs
== &ofs
, "wrong return, expected %p got %p\n", &ofs
, pofs
);
4588 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4589 ok(ofs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ofs
.base_ios
.delbuf
);
4590 ok(pfb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb
->base
.allocated
);
4591 ok(pfb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb
->base
.unbuffered
);
4592 ok(pfb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pfb
->base
.base
);
4593 ok(pfb
->base
.ebuf
== NULL
, "wrong ebuf, expected %p got %p\n", NULL
, pfb
->base
.ebuf
);
4594 ok(pfb
->fd
== 42, "wrong fd, expected 42 got %d\n", pfb
->fd
);
4595 ok(pfb
->close
== 0, "wrong value, expected 0 got %d\n", pfb
->close
);
4597 pofs
= call_func3(p_ofstream_copy_ctor
, &ofs_copy
, &ofs
, TRUE
);
4598 pfb
= (filebuf
*) ofs_copy
.base_ios
.sb
;
4599 ok(pofs
== &ofs_copy
, "wrong return, expected %p got %p\n", &ofs_copy
, pofs
);
4600 ok(ofs_copy
.base_ios
.sb
== ofs
.base_ios
.sb
, "expected shared streambuf\n");
4601 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4602 ok(ofs_copy
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs_copy
.base_ios
.state
);
4604 call_func1(p_ofstream_vbase_dtor
, &ofs_copy
);
4605 call_func1(p_ofstream_dtor
, &ofs
.base_ios
);
4607 pofs
= call_func5(p_ofstream_buffer_ctor
, &ofs
, 53, buffer
, ARRAY_SIZE(buffer
), TRUE
);
4608 pfb
= (filebuf
*) ofs
.base_ios
.sb
;
4609 ok(ofs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ofs
.base_ios
.delbuf
);
4610 ok(pofs
== &ofs
, "wrong return, expected %p got %p\n", &ofs
, pofs
);
4611 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4612 ok(pfb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb
->base
.allocated
);
4613 ok(pfb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb
->base
.unbuffered
);
4614 ok(pfb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pfb
->base
.base
);
4615 ok(pfb
->base
.ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), pfb
->base
.ebuf
);
4616 ok(pfb
->fd
== 53, "wrong fd, expected 53 got %d\n", pfb
->fd
);
4617 ok(pfb
->close
== 0, "wrong value, expected 0 got %d\n", pfb
->close
);
4618 call_func1(p_ofstream_dtor
, &ofs
.base_ios
);
4620 pofs
= call_func5(p_ofstream_buffer_ctor
, &ofs
, 64, NULL
, 0, TRUE
);
4621 pfb
= (filebuf
*) ofs
.base_ios
.sb
;
4622 ok(ofs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ofs
.base_ios
.delbuf
);
4623 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4624 ok(pofs
== &ofs
, "wrong return, expected %p got %p\n", &ofs
, pofs
);
4625 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4626 ok(pfb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb
->base
.allocated
);
4627 ok(pfb
->base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", pfb
->base
.unbuffered
);
4628 ok(pfb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pfb
->base
.base
);
4629 ok(pfb
->base
.ebuf
== NULL
, "wrong ebuf, expected %p got %p\n", NULL
, pfb
->base
.ebuf
);
4630 ok(pfb
->fd
== 64, "wrong fd, expected 64 got %d\n", pfb
->fd
);
4631 ok(pfb
->close
== 0, "wrong value, expected 0 got %d\n", pfb
->close
);
4632 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4634 pofs
= call_func5(p_ofstream_open_ctor
, &ofs
, filename
, OPENMODE_out
, filebuf_openprot
, TRUE
);
4635 pfb
= (filebuf
*) ofs
.base_ios
.sb
;
4636 ok(ofs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ofs
.base_ios
.delbuf
);
4637 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4638 ok(pofs
== &ofs
, "wrong return, expected %p got %p\n", &ofs
, pofs
);
4639 ok(pfb
->base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", pfb
->base
.allocated
);
4640 ok(pfb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb
->base
.unbuffered
);
4641 ok(pfb
->base
.base
!= NULL
, "wrong buffer, expected not %p got %p\n", NULL
, pfb
->base
.base
);
4642 ok(pfb
->base
.ebuf
!= NULL
, "wrong ebuf, expected not %p got %p\n", NULL
, pfb
->base
.ebuf
);
4643 ok(pfb
->fd
!= -1, "wrong fd, expected not -1 got %d\n", pfb
->fd
);
4645 ok(pfb
->close
== 1, "wrong value, expected 1 got %d\n", pfb
->close
);
4646 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4647 ok(_close(fd
) == -1, "expected ofstream to close opened file\n");
4648 ok(_unlink(filename
) == 0, "Couldn't unlink file named '%s'\n", filename
);
4651 call_func5(p_ofstream_buffer_ctor
, &ofs
, -1, NULL
, 0, TRUE
);
4652 ok(ofs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ofs
.base_ios
.sb
->base
);
4653 ok(ofs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ofs
.base_ios
.sb
->ebuf
);
4654 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", pfb
->base
.unbuffered
);
4655 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4657 psb
= call_func3(p_ofstream_setbuf
, &ofs
, buffer
, ARRAY_SIZE(buffer
));
4658 ok(psb
== ofs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ofs
.base_ios
.sb
, psb
);
4659 ok(ofs
.base_ios
.sb
->base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ofs
.base_ios
.sb
->base
);
4660 ok(ofs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ofs
.base_ios
.sb
->ebuf
);
4661 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4662 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4663 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4665 psb
= call_func3(p_ofstream_setbuf
, &ofs
, NULL
, 0);
4666 ok(psb
== ofs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ofs
.base_ios
.sb
, psb
);
4667 ok(ofs
.base_ios
.sb
->base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ofs
.base_ios
.sb
->base
);
4668 ok(ofs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ofs
.base_ios
.sb
->ebuf
);
4669 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4670 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4671 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4672 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4674 call_func2(p_ofstream_ctor
, &ofs
, TRUE
);
4675 ok(ofs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ofs
.base_ios
.sb
->base
);
4676 ok(ofs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ofs
.base_ios
.sb
->ebuf
);
4677 ok(ofs
.base_ios
.sb
->unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4678 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4679 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4681 psb
= call_func3(p_ofstream_setbuf
, &ofs
, buffer
, ARRAY_SIZE(buffer
));
4682 ok(psb
== ofs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ofs
.base_ios
.sb
, psb
);
4683 ok(ofs
.base_ios
.sb
->base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ofs
.base_ios
.sb
->base
);
4684 ok(ofs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ofs
.base_ios
.sb
->ebuf
);
4685 ok(ofs
.base_ios
.sb
->unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4686 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4687 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4689 psb
= call_func3(p_ofstream_setbuf
, &ofs
, NULL
, 0);
4690 ok(psb
== ofs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ofs
.base_ios
.sb
, psb
);
4691 ok(ofs
.base_ios
.sb
->base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ofs
.base_ios
.sb
->base
);
4692 ok(ofs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ofs
.base_ios
.sb
->ebuf
);
4693 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4694 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4695 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4697 psb
= call_func3(p_ofstream_setbuf
, &ofs
, buffer
+ 8, ARRAY_SIZE(buffer
) - 8);
4698 ok(psb
== ofs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ofs
.base_ios
.sb
, psb
);
4699 ok(ofs
.base_ios
.sb
->base
== buffer
+ 8, "wrong buffer, expected %p got %p\n", buffer
+ 8, ofs
.base_ios
.sb
->base
);
4700 ok(ofs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ofs
.base_ios
.sb
->ebuf
);
4701 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4702 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4703 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4705 psb
= call_func3(p_ofstream_setbuf
, &ofs
, buffer
+ 8, 0);
4706 ok(psb
== ofs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ofs
.base_ios
.sb
, psb
);
4707 ok(ofs
.base_ios
.sb
->base
== buffer
+ 8, "wrong buffer, expected %p got %p\n", buffer
+ 8, ofs
.base_ios
.sb
->base
);
4708 ok(ofs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ofs
.base_ios
.sb
->ebuf
);
4709 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4710 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4711 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4713 psb
= call_func3(p_ofstream_setbuf
, &ofs
, buffer
+ 4, ARRAY_SIZE(buffer
) - 4);
4714 ok(psb
== ofs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ofs
.base_ios
.sb
, psb
);
4715 ok(ofs
.base_ios
.sb
->base
== buffer
+ 4, "wrong buffer, expected %p got %p\n", buffer
+ 4, ofs
.base_ios
.sb
->base
);
4716 ok(ofs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ofs
.base_ios
.sb
->ebuf
);
4717 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4718 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4719 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4721 psb
= call_func3(p_ofstream_setbuf
, &ofs
, NULL
, 5);
4722 ok(psb
== ofs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ofs
.base_ios
.sb
, psb
);
4723 ok(ofs
.base_ios
.sb
->base
== buffer
+ 4, "wrong buffer, expected %p got %p\n", buffer
+ 4, ofs
.base_ios
.sb
->base
);
4724 ok(ofs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ofs
.base_ios
.sb
->ebuf
);
4725 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4726 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4727 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4728 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4730 /* setbuf - seems to be a nop and always return NULL in those other cases */
4731 pofs
= call_func5(p_ofstream_buffer_ctor
, &ofs
, 42, NULL
, 0, TRUE
);
4732 ok(ofs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ofs
.base_ios
.sb
->base
);
4733 ok(ofs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ofs
.base_ios
.sb
->ebuf
);
4734 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4735 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4737 ofs
.base_ios
.state
= IOSTATE_eofbit
;
4738 psb
= call_func3(p_ofstream_setbuf
, &ofs
, buffer
, ARRAY_SIZE(buffer
));
4739 ok(psb
== NULL
, "wrong return, expected NULL got %p\n", psb
);
4740 ok(ofs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ofs
.base_ios
.sb
->base
);
4741 ok(ofs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ofs
.base_ios
.sb
->ebuf
);
4742 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4743 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4744 ok(ofs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
4746 ofs
.base_ios
.state
= IOSTATE_eofbit
;
4747 psb
= call_func3(p_ofstream_setbuf
, &ofs
, NULL
, 0);
4748 ok(psb
== NULL
, "wrong return, expected NULL got %p\n", psb
);
4749 ok(ofs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ofs
.base_ios
.sb
->base
);
4750 ok(ofs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ofs
.base_ios
.sb
->ebuf
);
4751 ok(ofs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4752 ok(ofs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ofs
.base_ios
.sb
->allocated
);
4753 ok(ofs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
4754 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4756 pofs
= call_func5(p_ofstream_open_ctor
, &ofs
, filename
, OPENMODE_out
, filebuf_openprot
, TRUE
);
4757 ofs
.base_ios
.state
= IOSTATE_eofbit
;
4758 psb
= call_func3(p_ofstream_setbuf
, &ofs
, NULL
, 0);
4759 ok(psb
== NULL
, "wrong return, expected NULL got %p\n", psb
);
4760 ok(ofs
.base_ios
.sb
->base
!= NULL
, "wrong base value, expected NULL got %p\n", ofs
.base_ios
.sb
->base
);
4761 ok(ofs
.base_ios
.sb
->ebuf
!= NULL
, "wrong ebuf value, expected NULL got %p\n", ofs
.base_ios
.sb
->ebuf
);
4762 ok(ofs
.base_ios
.sb
->unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4763 ok(ofs
.base_ios
.sb
->allocated
== 1, "wrong allocated value, expected 1 got %d\n", ofs
.base_ios
.sb
->allocated
);
4764 ok(ofs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
4766 ofs
.base_ios
.state
= IOSTATE_eofbit
;
4767 psb
= call_func3(p_ofstream_setbuf
, &ofs
, buffer
, ARRAY_SIZE(buffer
));
4768 ok(psb
== NULL
, "wrong return, expected NULL got %p\n", psb
);
4769 ok(ofs
.base_ios
.sb
->base
!= NULL
, "wrong base value, expected NULL got %p\n", ofs
.base_ios
.sb
->base
);
4770 ok(ofs
.base_ios
.sb
->base
!= buffer
, "wrong base value, expected not %p got %p\n", buffer
, ofs
.base_ios
.sb
->base
);
4771 ok(ofs
.base_ios
.sb
->unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ofs
.base_ios
.sb
->unbuffered
);
4772 ok(ofs
.base_ios
.sb
->allocated
== 1, "wrong allocated value, expected 1 got %d\n", ofs
.base_ios
.sb
->allocated
);
4773 ok(ofs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
4774 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4775 ok(_unlink(filename
) == 0, "Couldn't unlink file named '%s'\n", filename
);
4778 pofs
= call_func2(p_ofstream_ctor
, &ofs
, TRUE
);
4779 pfb
= (filebuf
*) ofs
.base_ios
.sb
;
4780 ok(pofs
== &ofs
, "wrong return, expected %p got %p\n", &ofs
, pofs
);
4781 call_func2(p_ofstream_attach
, &ofs
, 42);
4782 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "attaching on vanilla stream set some state bits\n");
4783 fd
= (int) call_func1(p_ofstream_fd
, &ofs
);
4784 ok(fd
== 42, "wrong fd, expected 42 got %d\n", fd
);
4785 ok(pfb
->close
== 0, "wrong close value, expected 0 got %d\n", pfb
->close
);
4786 ofs
.base_ios
.state
= IOSTATE_eofbit
;
4787 call_func2(p_ofstream_attach
, &ofs
, 53);
4788 ok(ofs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
4789 ok(fd
== 42, "wrong fd, expected 42 got %d\n", fd
);
4790 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4793 pofs
= call_func2(p_ofstream_ctor
, &ofs
, TRUE
);
4794 pfb
= (filebuf
*) ofs
.base_ios
.sb
;
4795 ok(pofs
== &ofs
, "wrong return, expected %p got %p\n", &ofs
, pofs
);
4796 fd
= (int) call_func1(p_ofstream_fd
, &ofs
);
4797 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4798 ok(fd
== -1, "wrong fd, expected -1 but got %d\n", fd
);
4799 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4801 pofs
= call_func5(p_ofstream_open_ctor
, &ofs
, filename
, OPENMODE_out
, filebuf_openprot
, TRUE
);
4802 pfb
= (filebuf
*) ofs
.base_ios
.sb
;
4803 ok(pofs
== &ofs
, "wrong return, expected %p got %p\n", &ofs
, pofs
);
4804 fd
= (int) call_func1(p_ofstream_fd
, &ofs
);
4805 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4806 ok(fd
== pfb
->fd
, "wrong fd, expected %d but got %d\n", pfb
->fd
, fd
);
4809 pfb
= (filebuf
*) call_func1(p_ofstream_rdbuf
, &ofs
);
4810 ok((streambuf
*) pfb
== ofs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ofs
.base_ios
.sb
, pfb
);
4811 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4814 ret
= (int) call_func2(p_ofstream_setmode
, &ofs
, filebuf_binary
);
4815 ok(ret
== filebuf_text
, "wrong return, expected %d got %d\n", filebuf_text
, ret
);
4816 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4817 ret
= (int) call_func2(p_ofstream_setmode
, &ofs
, filebuf_binary
);
4818 ok(ret
== filebuf_binary
, "wrong return, expected %d got %d\n", filebuf_binary
, ret
);
4819 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4820 ret
= (int) call_func2(p_ofstream_setmode
, &ofs
, filebuf_text
);
4821 ok(ret
== filebuf_binary
, "wrong return, expected %d got %d\n", filebuf_binary
, ret
);
4822 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4823 ret
= (int) call_func2(p_ofstream_setmode
, &ofs
, 0x9000);
4824 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
4825 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ofs
.base_ios
.state
);
4827 /* close && is_open */
4828 ok((int) call_func1(p_ofstream_is_open
, &ofs
) == 1, "expected ofstream to be open\n");
4829 ofs
.base_ios
.state
= IOSTATE_eofbit
| IOSTATE_failbit
;
4830 call_func1(p_ofstream_close
, &ofs
);
4831 ok(ofs
.base_ios
.state
== IOSTATE_goodbit
, "close did not clear state = %d\n", ofs
.base_ios
.state
);
4832 ofs
.base_ios
.state
= IOSTATE_eofbit
;
4833 call_func1(p_ofstream_close
, &ofs
);
4834 ok(ofs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "close on a closed stream did not set failbit\n");
4835 ok((int) call_func1(p_ofstream_is_open
, &ofs
) == 0, "expected ofstream to not be open\n");
4836 ok(_close(fd
) == -1, "expected close to close the opened file\n");
4839 ofs
.base_ios
.state
= IOSTATE_eofbit
;
4840 call_func4(p_ofstream_open
, &ofs
, filename
, OPENMODE_out
, filebuf_openprot
);
4841 fd
= (int) call_func1(p_ofstream_fd
, &ofs
);
4842 ok(fd
!= -1, "wrong fd, expected not -1 got %d\n", fd
);
4843 ok(ofs
.base_ios
.state
== IOSTATE_eofbit
, "open did not succeed\n");
4844 call_func4(p_ofstream_open
, &ofs
, filename
, OPENMODE_out
, filebuf_openprot
);
4845 ok(ofs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "second open did not set failbit\n");
4846 call_func1(p_ofstream_close
, &ofs
);
4848 /* integration with parent ostream - writing */
4849 ofs
.base_ios
.state
= IOSTATE_goodbit
; /* open doesn't clear the state */
4850 call_func4(p_ofstream_open
, &ofs
, filename
, OPENMODE_in
, filebuf_openprot
); /* make sure that OPENMODE_out is implicit */
4851 pofs
= call_func2(p_ostream_print_str
, &ofs
, "test ");
4852 ok(pofs
== &ofs
, "stream operation returned wrong pointer, expected %p got %p\n", &ofs
, pofs
);
4853 pofs
= call_func2(p_ostream_print_int
, &ofs
, 12);
4854 ok(pofs
== &ofs
, "stream operation returned wrong pointer, expected %p got %p\n", &ofs
, pofs
);
4855 call_func1(p_ofstream_close
, &ofs
);
4857 /* read what we wrote */
4858 memset(st
, 'A', sizeof(st
));
4860 fd
= _open(filename
, _O_RDONLY
, _S_IREAD
);
4861 ok(fd
!= -1, "_open failed\n");
4862 ok(_read(fd
, st
, 7) == 7, "_read failed\n");
4863 ok(_close(fd
) == 0, "_close failed\n");
4864 ok(!strcmp(st
, "test 12"), "expected 'test 12' got '%s'\n", st
);
4865 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4866 ok(_unlink(filename
) == 0, "Couldn't unlink file named '%s'\n", filename
);
4868 /* make sure that OPENMODE_out is implicit with open_ctor */
4869 pofs
= call_func5(p_ofstream_open_ctor
, &ofs
, filename
, OPENMODE_in
, filebuf_openprot
, TRUE
);
4870 ok(pofs
== &ofs
, "wrong return, expected %p got %p\n", &ofs
, pofs
);
4871 pofs
= call_func2(p_ostream_print_str
, &ofs
, "test ");
4872 ok(pofs
== &ofs
, "stream operation returned wrong pointer, expected %p got %p\n", &ofs
, pofs
);
4873 pofs
= call_func2(p_ostream_print_int
, &ofs
, 12);
4874 ok(pofs
== &ofs
, "stream operation returned wrong pointer, expected %p got %p\n", &ofs
, pofs
);
4875 call_func1(p_ofstream_close
, &ofs
);
4877 memset(st
, 'A', sizeof(st
));
4879 fd
= _open(filename
, _O_RDONLY
, _S_IREAD
);
4880 ok(fd
!= -1, "_open failed\n");
4881 ok(_read(fd
, st
, 7) == 7, "_read failed\n");
4882 ok(_close(fd
) == 0, "_close failed\n");
4883 ok(!strcmp(st
, "test 12"), "expected 'test 12' got '%s'\n", st
);
4884 call_func1(p_ofstream_vbase_dtor
, &ofs
);
4885 ok(_unlink(filename
) == 0, "Couldn't unlink file named '%s'\n", filename
);
4888 static void test_istream(void)
4890 istream is1
, is2
, *pis
;
4892 filebuf fb1
, fb2
, *pfb
;
4893 const char filename1
[] = "test1";
4894 const char filename2
[] = "test2";
4898 memset(&is1
, 0xab, sizeof(istream
));
4899 memset(&is2
, 0xab, sizeof(istream
));
4900 memset(&fb1
, 0xab, sizeof(filebuf
));
4901 memset(&fb2
, 0xab, sizeof(filebuf
));
4903 /* constructors/destructors */
4904 pis
= call_func3(p_istream_sb_ctor
, &is1
, NULL
, TRUE
);
4905 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4906 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4907 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4908 ok(is1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.sb
);
4909 ok(is1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is1
.base_ios
.state
);
4910 ok(is1
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is1
.base_ios
.flags
);
4911 call_func1(p_istream_vbase_dtor
, &is1
);
4912 is1
.extract_delim
= is1
.count
= 0xabababab;
4913 memset(&is1
.base_ios
, 0xab, sizeof(ios
));
4914 is1
.base_ios
.delbuf
= 0;
4915 pis
= call_func3(p_istream_sb_ctor
, &is1
, NULL
, FALSE
);
4916 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4917 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4918 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4919 ok(is1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.sb
);
4920 ok(is1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
4921 0xabababab|IOSTATE_badbit
, is1
.base_ios
.state
);
4922 ok(is1
.base_ios
.flags
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.flags
);
4923 call_func1(p_istream_dtor
, &is1
.base_ios
);
4924 pis
= call_func3(p_istream_sb_ctor
, &is1
, &fb1
.base
, FALSE
);
4925 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4926 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4927 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4928 ok(is1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, is1
.base_ios
.sb
);
4929 ok(is1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.state
);
4930 ok(is1
.base_ios
.flags
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.flags
);
4931 call_func1(p_istream_dtor
, &is1
.base_ios
);
4932 call_func1(p_filebuf_ctor
, &fb1
);
4933 pfb
= call_func4(p_filebuf_open
, &fb1
, filename1
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
4934 ok(pfb
== &fb1
, "wrong return, expected %p got %p\n", &fb1
, pfb
);
4935 ok(fb1
.base
.allocated
== 1, "expected %d got %d\n", 1, fb1
.base
.allocated
);
4936 pis
= call_func3(p_istream_sb_ctor
, &is1
, &fb1
.base
, TRUE
);
4937 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
4938 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
4939 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
4940 ok(is1
.base_ios
.sb
== &fb1
.base
, "expected %p got %p\n", &fb1
.base
, is1
.base_ios
.sb
);
4941 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
4942 ok(is1
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is1
.base_ios
.flags
);
4943 pis
= call_func2(p_istream_ctor
, &is2
, TRUE
);
4944 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4945 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
4946 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4947 ok(is2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.sb
);
4948 ok(is2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is2
.base_ios
.state
);
4949 ok(is2
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is2
.base_ios
.flags
);
4950 call_func1(p_istream_vbase_dtor
, &is2
);
4951 is2
.extract_delim
= is2
.count
= 0xabababab;
4952 memset(&is2
.base_ios
, 0xab, sizeof(ios
));
4953 is2
.base_ios
.flags
&= ~FLAGS_skipws
;
4954 pis
= call_func2(p_istream_ctor
, &is2
, FALSE
);
4955 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4956 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
4957 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4958 ok(is2
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, is2
.base_ios
.sb
);
4959 ok(is2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.state
);
4960 ok(is2
.base_ios
.flags
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.flags
);
4961 call_func1(p_istream_dtor
, &is2
.base_ios
);
4962 is1
.extract_delim
= is1
.count
= 0xcdcdcdcd;
4963 is1
.base_ios
.state
= 0xcdcdcdcd;
4964 is1
.base_ios
.flags
&= ~FLAGS_skipws
;
4965 is2
.extract_delim
= is2
.count
= 0xabababab;
4966 memset(&is2
.base_ios
, 0xab, sizeof(ios
));
4967 is2
.base_ios
.flags
&= ~FLAGS_skipws
;
4968 is2
.base_ios
.delbuf
= 0;
4969 pis
= call_func3(p_istream_copy_ctor
, &is2
, &is1
, FALSE
);
4970 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4971 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
4972 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4973 ok(is2
.base_ios
.sb
== is1
.base_ios
.sb
, "expected %p got %p\n", is1
.base_ios
.sb
, is2
.base_ios
.sb
);
4974 ok(is2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.state
);
4975 ok(is2
.base_ios
.flags
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.flags
);
4976 call_func1(p_istream_dtor
, &is2
.base_ios
);
4977 is2
.extract_delim
= is2
.count
= 0xabababab;
4978 memset(&is2
.base_ios
, 0xab, sizeof(ios
));
4979 pis
= call_func3(p_istream_copy_ctor
, &is2
, &is1
, TRUE
);
4980 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4981 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
4982 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
4983 ok(is2
.base_ios
.sb
== is1
.base_ios
.sb
, "expected %p got %p\n", is1
.base_ios
.sb
, is2
.base_ios
.sb
);
4984 ok(is2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is2
.base_ios
.state
);
4985 ok(is2
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is2
.base_ios
.flags
);
4988 is2
.extract_delim
= is2
.count
= 0xabababab;
4989 is2
.base_ios
.sb
= (streambuf
*) 0xabababab;
4990 is2
.base_ios
.state
= 0xabababab;
4991 is2
.base_ios
.special
[0] = 0xabababab;
4992 is2
.base_ios
.delbuf
= 0;
4993 is2
.base_ios
.tie
= (ostream
*) 0xabababab;
4994 is2
.base_ios
.flags
= 0xabababab;
4995 is2
.base_ios
.precision
= 0xabababab;
4996 is2
.base_ios
.width
= 0xabababab;
4997 pis
= call_func2(p_istream_assign
, &is2
, &is1
);
4998 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
4999 ok(is2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.extract_delim
);
5000 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
5001 ok(is2
.base_ios
.sb
== is1
.base_ios
.sb
, "expected %p got %p\n", is1
.base_ios
.sb
, is2
.base_ios
.sb
);
5002 ok(is2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is2
.base_ios
.state
);
5003 ok(is2
.base_ios
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.fill
);
5004 ok(is2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", is2
.base_ios
.delbuf
);
5005 ok(is2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.tie
);
5006 ok(is2
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is2
.base_ios
.flags
);
5007 ok(is2
.base_ios
.precision
== 6, "expected 6 got %d\n", is2
.base_ios
.precision
);
5008 ok(is2
.base_ios
.width
== 0, "expected 0 got %d\n", is2
.base_ios
.width
);
5009 if (0) /* crashes on native */
5010 pis
= call_func2(p_istream_assign
, &is2
, NULL
);
5011 is2
.extract_delim
= is2
.count
= 0xabababab;
5012 is2
.base_ios
.sb
= (streambuf
*) 0xabababab;
5013 is2
.base_ios
.state
= 0xabababab;
5014 is2
.base_ios
.special
[0] = 0xabababab;
5015 is2
.base_ios
.delbuf
= 0;
5016 is2
.base_ios
.tie
= (ostream
*) 0xabababab;
5017 is2
.base_ios
.flags
= 0xabababab;
5018 is2
.base_ios
.precision
= 0xabababab;
5019 is2
.base_ios
.width
= 0xabababab;
5020 pis
= call_func2(p_istream_assign_sb
, &is2
, NULL
);
5021 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
5022 ok(is2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.extract_delim
);
5023 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
5024 ok(is2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.sb
);
5025 ok(is2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is2
.base_ios
.state
);
5026 ok(is2
.base_ios
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.fill
);
5027 ok(is2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", is2
.base_ios
.delbuf
);
5028 ok(is2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.tie
);
5029 ok(is2
.base_ios
.flags
== FLAGS_skipws
, "expected %d got %d\n", FLAGS_skipws
, is2
.base_ios
.flags
);
5030 ok(is2
.base_ios
.precision
== 6, "expected 6 got %d\n", is2
.base_ios
.precision
);
5031 ok(is2
.base_ios
.width
== 0, "expected 0 got %d\n", is2
.base_ios
.width
);
5032 call_func1(p_filebuf_ctor
, &fb2
);
5033 pfb
= call_func4(p_filebuf_open
, &fb2
, filename2
, OPENMODE_in
|OPENMODE_out
, filebuf_openprot
);
5034 ok(pfb
== &fb2
, "wrong return, expected %p got %p\n", &fb2
, pfb
);
5035 ok(fb2
.base
.allocated
== 1, "expected %d got %d\n", 1, fb2
.base
.allocated
);
5036 pis
= call_func2(p_istream_assign_sb
, &is2
, &fb2
.base
);
5037 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
5038 ok(is2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.extract_delim
);
5039 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
5040 ok(is2
.base_ios
.sb
== &fb2
.base
, "expected %p got %p\n", &fb2
.base
, is2
.base_ios
.sb
);
5041 ok(is2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is2
.base_ios
.state
);
5044 is1
.extract_delim
= is1
.count
= 0;
5045 if (0) /* crashes on native */
5046 is1
.base_ios
.sb
= NULL
;
5047 is1
.base_ios
.state
= IOSTATE_badbit
;
5048 is1
.base_ios
.flags
= 0;
5049 call_func1(p_istream_eatwhite
, &is1
);
5050 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_eofbit
), "expected %d got %d\n",
5051 IOSTATE_badbit
|IOSTATE_eofbit
, is1
.base_ios
.state
);
5052 is1
.base_ios
.state
= IOSTATE_failbit
;
5053 call_func1(p_istream_eatwhite
, &is1
);
5054 ok(is1
.base_ios
.state
== (IOSTATE_failbit
|IOSTATE_eofbit
), "expected %d got %d\n",
5055 IOSTATE_failbit
|IOSTATE_eofbit
, is1
.base_ios
.state
);
5056 is1
.base_ios
.state
= IOSTATE_goodbit
;
5057 ret
= (int) call_func3(p_streambuf_xsputn
, &fb1
.base
, "And if \tyou ask\n\v\f\r me", 23);
5058 ok(ret
== 23, "expected 23 got %d\n", ret
);
5059 ok(fb1
.base
.pbase
== fb1
.base
.base
, "wrong put base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.pbase
);
5060 ok(fb1
.base
.pptr
== fb1
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb1
.base
.base
+ 23, fb1
.base
.pptr
);
5061 call_func1(p_istream_eatwhite
, &is1
);
5062 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5063 ok(fb1
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb1
.base
.pbase
);
5064 ok(fb1
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb1
.base
.pptr
);
5065 ok(fb1
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb1
.base
.epptr
);
5066 is1
.base_ios
.state
= IOSTATE_goodbit
;
5067 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 0, SEEKDIR_beg
, 0);
5068 ok(ret
== 0, "expected 0 got %d\n", ret
);
5069 call_func1(p_istream_eatwhite
, &is1
);
5070 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5071 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
5072 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
5073 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 23, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 23, fb1
.base
.egptr
);
5074 ret
= (int) call_func4(p_filebuf_seekoff
, &fb1
, 3, SEEKDIR_beg
, 0);
5075 ok(ret
== 3, "expected 3 got %d\n", ret
);
5076 call_func1(p_istream_eatwhite
, &is1
);
5077 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5078 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
5079 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 1, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.gptr
);
5080 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 20, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 20, fb1
.base
.egptr
);
5082 call_func1(p_istream_eatwhite
, &is1
);
5083 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5084 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
5085 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
5086 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 20, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 20, fb1
.base
.egptr
);
5088 call_func1(p_istream_eatwhite
, &is1
);
5089 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5090 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
5091 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 18, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 18, fb1
.base
.gptr
);
5092 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 20, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 20, fb1
.base
.egptr
);
5094 call_func1(p_istream_eatwhite
, &is1
);
5095 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5096 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
5097 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5098 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
5101 is1
.count
= 0xabababab;
5102 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
5103 ok(ret
== 0, "expected 0 got %d\n", ret
);
5104 ok(is1
.count
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.count
);
5105 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5106 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5107 is1
.base_ios
.state
= IOSTATE_badbit
;
5108 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
5109 ok(ret
== 0, "expected 0 got %d\n", ret
);
5110 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5111 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
5112 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5113 if (0) /* crashes on native */
5114 is1
.base_ios
.sb
= NULL
;
5115 is1
.base_ios
.state
= IOSTATE_goodbit
;
5116 is1
.base_ios
.tie
= &os
;
5117 pos
= call_func3(p_ostream_sb_ctor
, &os
, &fb2
.base
, TRUE
);
5118 ok(pos
== &os
, "wrong return, expected %p got %p\n", &os
, pos
);
5119 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "how I'm feeling", 15);
5120 ok(ret
== 15, "expected 15 got %d\n", ret
);
5121 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5122 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 15, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 15, fb2
.base
.pptr
);
5124 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
5125 ok(ret
== 1, "expected 1 got %d\n", ret
);
5126 ok(is1
.count
== -1, "expected -1 got %d\n", is1
.count
);
5127 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5128 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
5129 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
5130 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "Don't tell me", 13);
5131 ok(ret
== 13, "expected 13 got %d\n", ret
);
5132 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5133 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 13, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 13, fb2
.base
.pptr
);
5134 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
5135 ok(ret
== 1, "expected 1 got %d\n", ret
);
5136 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5137 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5138 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
5139 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
5140 ret
= (int) call_func3(p_streambuf_xsputn
, &fb2
.base
, "you're too blind to see", 23);
5141 ok(ret
== 23, "expected 23 got %d\n", ret
);
5142 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5143 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 23, fb2
.base
.pptr
);
5144 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5145 fb1
.base
.egptr
= fb1
.base
.base
+ 15;
5146 strcpy(fb1
.base
.eback
, "Never \t gonna ");
5147 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
5148 ok(ret
== 1, "expected 1 got %d\n", ret
);
5149 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5150 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5151 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 23, fb2
.base
.pptr
);
5152 fb1
.base
.gptr
= fb1
.base
.base
+ 4;
5154 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 11);
5155 ok(ret
== 1, "expected 1 got %d\n", ret
);
5156 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5157 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5158 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5159 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 23, fb2
.base
.pptr
);
5162 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 12);
5163 ok(ret
== 1, "expected 1 got %d\n", ret
);
5164 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5165 ok(os
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, os
.base_ios
.state
);
5166 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5167 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 23, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 23, fb2
.base
.pptr
);
5168 os
.base_ios
.state
= IOSTATE_goodbit
;
5170 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 12);
5171 ok(ret
== 1, "expected 1 got %d\n", ret
);
5172 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5173 ok(os
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, os
.base_ios
.state
);
5174 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
5175 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
5176 is1
.base_ios
.flags
= 0;
5177 fb1
.base
.gptr
= fb1
.base
.base
+ 5;
5178 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
5179 ok(ret
== 1, "expected 1 got %d\n", ret
);
5180 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5181 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
5182 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
5183 ok(ret
== 1, "expected 1 got %d\n", ret
);
5184 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5185 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
5186 is1
.base_ios
.flags
= FLAGS_skipws
;
5187 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 1);
5188 ok(ret
== 1, "expected 1 got %d\n", ret
);
5189 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5190 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
5191 ret
= (int) call_func2(p_istream_ipfx
, &is1
, -1);
5192 ok(ret
== 1, "expected 1 got %d\n", ret
);
5193 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5194 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
5195 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
5196 ok(ret
== 1, "expected 1 got %d\n", ret
);
5197 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5198 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 9, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.gptr
);
5199 fb1
.base
.gptr
= fb1
.base
.base
+ 14;
5200 fb2
.base
.pbase
= fb2
.base
.base
;
5201 fb2
.base
.pptr
= fb2
.base
.epptr
= fb2
.base
.base
+ 23;
5202 ret
= (int) call_func2(p_istream_ipfx
, &is1
, 0);
5203 ok(ret
== 0, "expected 0 got %d\n", ret
);
5204 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5205 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5206 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5207 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
5208 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
5211 is1
.extract_delim
= is1
.count
= 0xabababab;
5212 is1
.base_ios
.state
= IOSTATE_badbit
;
5213 memset(buffer
, 'A', sizeof(buffer
));
5214 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 30, 0);
5215 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5216 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5217 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5218 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
5219 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5220 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5221 is1
.extract_delim
= is1
.count
= 0xabababab;
5222 is1
.base_ios
.state
= IOSTATE_goodbit
;
5223 memset(buffer
, 'A', sizeof(buffer
));
5224 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 30, 0);
5225 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5226 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5227 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5228 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5229 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5230 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5231 is1
.extract_delim
= is1
.count
= 0xabababab;
5232 is1
.base_ios
.state
= IOSTATE_goodbit
;
5233 is1
.base_ios
.flags
= 0;
5234 memset(buffer
, 'A', sizeof(buffer
));
5235 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 0, 0);
5236 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5237 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5238 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5239 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5240 ok(buffer
[0] == 'A', "expected 65 got %d\n", buffer
[0]);
5241 is1
.extract_delim
= is1
.count
= 0xabababab;
5242 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5243 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5244 strcpy(fb1
.base
.base
, " give \n you 11 ! up\t. ");
5245 memset(buffer
, 'A', sizeof(buffer
));
5246 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 30, 0);
5247 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5248 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5249 ok(is1
.count
== 29, "expected 29 got %d\n", is1
.count
);
5250 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5251 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 29, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 29, fb1
.base
.gptr
);
5252 ok(!strncmp(buffer
, fb1
.base
.base
, 29), "unexpected buffer content, got '%s'\n", buffer
);
5253 ok(buffer
[29] == 0, "expected 0 got %d\n", buffer
[29]);
5254 fb1
.base
.gptr
= fb1
.base
.egptr
;
5255 memset(buffer
, 'A', sizeof(buffer
));
5256 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 1, 0);
5257 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5258 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5259 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5260 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5261 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
5262 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5263 is1
.base_ios
.flags
= FLAGS_skipws
;
5264 fb1
.base
.gptr
= fb1
.base
.base
;
5265 memset(buffer
, 'A', sizeof(buffer
));
5266 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, 0);
5267 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5268 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5269 ok(is1
.count
== 19, "expected 19 got %d\n", is1
.count
);
5270 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5271 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 19, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 19, fb1
.base
.gptr
);
5272 ok(!strncmp(buffer
, fb1
.base
.base
, 19), "unexpected buffer content, got '%s'\n", buffer
);
5273 ok(buffer
[19] == 0, "expected 0 got %d\n", buffer
[19]);
5274 fb1
.base
.gptr
= fb1
.base
.base
+ 20;
5275 memset(buffer
, 'A', sizeof(buffer
));
5276 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, 0);
5277 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5278 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5279 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
5280 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5281 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5282 ok(!strncmp(buffer
, fb1
.base
.base
+ 20, 10), "unexpected buffer content, got '%s'\n", buffer
);
5283 ok(buffer
[10] == 0, "expected 0 got %d\n", buffer
[10]);
5284 is1
.extract_delim
= 1;
5285 is1
.base_ios
.state
= IOSTATE_goodbit
;
5286 fb1
.base
.eback
= fb1
.base
.base
;
5287 fb1
.base
.gptr
= fb1
.base
.base
+ 20;
5288 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5289 memset(buffer
, 'A', sizeof(buffer
));
5290 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, -1);
5291 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5292 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5293 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
5294 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5295 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5296 ok(!strncmp(buffer
, fb1
.base
.base
+ 20, 10), "unexpected buffer content, got '%s'\n", buffer
);
5297 ok(buffer
[10] == 0, "expected 0 got %d\n", buffer
[10]);
5298 is1
.base_ios
.state
= IOSTATE_goodbit
;
5299 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5300 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5301 memset(buffer
, 'A', sizeof(buffer
));
5302 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, '\n');
5303 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5304 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5305 ok(is1
.count
== 9, "expected 9 got %d\n", is1
.count
);
5306 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5307 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 9, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.gptr
);
5308 ok(!strncmp(buffer
, fb1
.base
.base
, 9), "unexpected buffer content, got '%s'\n", buffer
);
5309 ok(buffer
[9] == 0, "expected 0 got %d\n", buffer
[9]);
5310 memset(buffer
, 'A', sizeof(buffer
));
5311 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, '\n');
5312 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5313 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5314 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5315 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5316 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 9, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.gptr
);
5317 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5318 is1
.extract_delim
= 0xabababab;
5319 memset(buffer
, 'A', sizeof(buffer
));
5320 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, '\n');
5321 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5322 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5323 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
5324 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5325 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 10, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 10, fb1
.base
.gptr
);
5326 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5327 *fb1
.base
.gptr
= -50;
5328 memset(buffer
, 'A', sizeof(buffer
));
5329 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 2, -50);
5330 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5331 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5332 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
5333 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5334 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 11, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 11, fb1
.base
.gptr
);
5335 ok((signed char)buffer
[0] == -50, "expected 0 got %d\n", buffer
[0]);
5336 ok(buffer
[1] == 0, "expected 0 got %d\n", buffer
[1]);
5337 *fb1
.base
.gptr
= -50;
5338 memset(buffer
, 'A', sizeof(buffer
));
5339 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 2, 206);
5340 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5341 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5342 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5343 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5344 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 11, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 11, fb1
.base
.gptr
);
5345 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5346 is1
.extract_delim
= 3;
5347 memset(buffer
, 'A', sizeof(buffer
));
5348 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 2, 206);
5349 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5350 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5351 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
5352 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5353 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 12, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 12, fb1
.base
.gptr
);
5354 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5355 memset(buffer
, 'A', sizeof(buffer
));
5356 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 20, '!');
5357 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5358 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5359 ok(is1
.count
== 6, "expected 6 got %d\n", is1
.count
);
5360 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5361 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 18, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 18, fb1
.base
.gptr
);
5362 ok(!strncmp(buffer
, fb1
.base
.base
+ 12, 6), "unexpected buffer content, got '%s'\n", buffer
);
5363 ok(buffer
[6] == 0, "expected 0 got %d\n", buffer
[6]);
5364 pis
= call_func4(p_istream_get_str_delim
, &is1
, NULL
, 5, 0);
5365 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5366 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5367 ok(is1
.count
== 4, "expected 4 got %d\n", is1
.count
);
5368 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5369 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 22, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 22, fb1
.base
.gptr
);
5370 fb1
.base
.gptr
= fb1
.base
.egptr
;
5371 memset(buffer
, 'A', sizeof(buffer
));
5372 pis
= call_func4(p_istream_get_str_delim
, &is1
, buffer
, 10, 0);
5373 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5374 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5375 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5376 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5377 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5378 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5379 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5380 if (0) /* crashes on native */
5381 pis
= call_func4(p_istream_get_str_delim
, &is1
, (char*) 0x1, 5, 0);
5384 is1
.extract_delim
= is1
.count
= 0xabababab;
5385 is1
.base_ios
.state
= IOSTATE_eofbit
;
5386 memset(buffer
, 'A', sizeof(buffer
));
5387 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 10, 0);
5388 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5389 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5390 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5391 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5392 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5393 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5394 is1
.base_ios
.state
= IOSTATE_goodbit
;
5395 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5396 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5397 memset(buffer
, 'A', sizeof(buffer
));
5398 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 20, 0);
5399 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5400 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5401 ok(is1
.count
== 19, "expected 19 got %d\n", is1
.count
);
5402 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5403 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 19, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 19, fb1
.base
.gptr
);
5404 ok(!strncmp(buffer
, fb1
.base
.base
, 19), "unexpected buffer content, got '%s'\n", buffer
);
5405 ok(buffer
[19] == 0, "expected 0 got %d\n", buffer
[19]);
5406 is1
.extract_delim
= -1;
5407 memset(buffer
, 'A', sizeof(buffer
));
5408 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 20, '\t');
5409 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5410 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5411 ok(is1
.count
== 4, "expected 4 got %d\n", is1
.count
);
5412 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5413 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 23, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 23, fb1
.base
.gptr
);
5414 ok(!strncmp(buffer
, fb1
.base
.base
+ 19, 3), "unexpected buffer content, got '%s'\n", buffer
);
5415 ok(buffer
[3] == 0, "expected 0 got %d\n", buffer
[3]);
5416 *fb1
.base
.gptr
= -50;
5417 memset(buffer
, 'A', sizeof(buffer
));
5418 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 5, -50);
5419 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5420 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5421 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5422 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5423 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 23, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 23, fb1
.base
.gptr
);
5424 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5425 *(fb1
.base
.gptr
+ 1) = -40;
5426 *(fb1
.base
.gptr
+ 2) = -30;
5427 memset(buffer
, 'A', sizeof(buffer
));
5428 pis
= call_func4(p_istream_get_str
, &is1
, buffer
, 5, -30);
5429 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5430 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5431 ok(is1
.count
== 2, "expected 2 got %d\n", is1
.count
);
5432 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5433 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 25, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 25, fb1
.base
.gptr
);
5434 ok((signed char)buffer
[0] == -50, "expected -50 got %d\n", buffer
[0]);
5435 ok((signed char)buffer
[1] == -40, "expected -40 got %d\n", buffer
[1]);
5436 ok(buffer
[2] == 0, "expected 0 got %d\n", buffer
[2]);
5439 is1
.count
= 0xabababab;
5440 is1
.base_ios
.state
= IOSTATE_eofbit
;
5441 ret
= (int) call_func1(p_istream_get
, &is1
);
5442 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5443 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5444 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5445 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5446 is1
.base_ios
.state
= IOSTATE_badbit
;
5447 ret
= (int) call_func1(p_istream_get
, &is1
);
5448 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5449 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5450 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
5451 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5452 is1
.base_ios
.state
= IOSTATE_goodbit
;
5453 fb1
.base
.egptr
= NULL
;
5454 ret
= (int) call_func1(p_istream_get
, &is1
);
5455 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5456 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5457 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5458 is1
.base_ios
.state
= IOSTATE_goodbit
;
5459 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5460 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5461 ret
= (int) call_func1(p_istream_get
, &is1
);
5462 ok(ret
== ' ', "expected %d got %d\n", ' ', ret
);
5463 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
5464 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5465 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 1, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.gptr
);
5466 *fb1
.base
.gptr
= '\n';
5467 ret
= (int) call_func1(p_istream_get
, &is1
);
5468 ok(ret
== '\n', "expected %d got %d\n", '\n', ret
);
5469 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
5470 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5471 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 2, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 2, fb1
.base
.gptr
);
5472 *fb1
.base
.gptr
= -50;
5473 ret
= (int) call_func1(p_istream_get
, &is1
);
5474 ok(ret
== 206, "expected 206 got %d\n", ret
);
5475 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
5476 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5477 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 3, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 3, fb1
.base
.gptr
);
5478 fb1
.base
.gptr
= fb1
.base
.base
+ 30;
5479 ret
= (int) call_func1(p_istream_get
, &is1
);
5480 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5481 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5482 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5483 ok(fb1
.base
.gptr
== (char*) 1, "wrong get pointer, expected %p got %p\n", (char*) 1, fb1
.base
.gptr
);
5486 is1
.count
= 0xabababab;
5487 is1
.base_ios
.state
= IOSTATE_badbit
;
5489 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
5490 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5491 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5492 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
5493 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5494 ok(c
== (char) 0xab, "expected %d got %d\n", (char) 0xab, c
);
5495 is1
.base_ios
.state
= IOSTATE_goodbit
;
5496 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
5497 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5498 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5499 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5500 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5501 ok((signed char)c
== EOF
, "expected -1 got %d\n", c
);
5502 is1
.base_ios
.state
= IOSTATE_goodbit
;
5503 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5504 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5505 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
5506 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5507 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
5508 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5509 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 1, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 1, fb1
.base
.gptr
);
5510 ok(c
== ' ', "expected %d got %d\n", ' ', c
);
5511 fb1
.base
.gptr
= fb1
.base
.base
+ 2;
5512 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
5513 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5514 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
5515 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5516 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 3, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 3, fb1
.base
.gptr
);
5517 ok((signed char)c
== -50, "expected %d got %d\n", -50, c
);
5518 if (0) /* crashes on native */
5519 pis
= call_func2(p_istream_get_char
, &is1
, NULL
);
5520 fb1
.base
.gptr
= fb1
.base
.base
+ 30;
5521 pis
= call_func2(p_istream_get_char
, &is1
, &c
);
5522 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5523 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5524 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5525 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5526 ok(fb1
.base
.gptr
== (char*) 1, "wrong get pointer, expected %p got %p\n", (char*) 1, fb1
.base
.gptr
);
5527 ok((signed char)c
== EOF
, "expected -1 got %d\n", c
);
5528 is1
.base_ios
.state
= IOSTATE_failbit
;
5529 pis
= call_func2(p_istream_get_char
, &is1
, NULL
);
5530 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5531 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5532 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5533 ok(fb1
.base
.gptr
== (char*) 1, "wrong get pointer, expected %p got %p\n", (char*) 1, fb1
.base
.gptr
);
5536 is1
.count
= 0xabababab;
5537 is1
.base_ios
.state
= IOSTATE_badbit
;
5538 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, 0);
5539 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5540 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5541 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
5542 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5543 is1
.base_ios
.state
= IOSTATE_goodbit
;
5544 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, 0);
5545 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5546 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5547 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5548 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
5549 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5550 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
5551 is1
.base_ios
.state
= IOSTATE_goodbit
;
5552 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5553 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5554 strcpy(fb1
.base
.base
, " Never gonna \nlet you \r down?");
5555 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, 0);
5556 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5557 ok(is1
.count
== 30, "expected 30 got %d\n", is1
.count
);
5558 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5559 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
5560 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5561 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
5562 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5563 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 30, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 30, fb2
.base
.pptr
);
5564 ok(fb2
.base
.epptr
== fb2
.base
.ebuf
, "wrong put end, expected %p got %p\n", fb2
.base
.ebuf
, fb2
.base
.epptr
);
5565 ok(!strncmp(fb2
.base
.pbase
, " Never gonna \nlet you \r down?", 30), "unexpected sb content, got '%s'\n", fb2
.base
.pbase
);
5566 is1
.base_ios
.state
= IOSTATE_goodbit
;
5567 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5568 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5569 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, '\n');
5570 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5571 ok(is1
.count
== 14, "expected 14 got %d\n", is1
.count
);
5572 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5573 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
5574 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
5575 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 30, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.egptr
);
5576 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5577 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 44, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 44, fb2
.base
.pptr
);
5578 ok(fb2
.base
.epptr
== fb2
.base
.ebuf
, "wrong put end, expected %p got %p\n", fb2
.base
.ebuf
, fb2
.base
.epptr
);
5579 ok(!strncmp(fb2
.base
.base
+ 30, " Never gonna ", 14), "unexpected sb content, got '%s'\n", fb2
.base
.pbase
);
5582 fb2
.base
.pbase
= fb2
.base
.pptr
= fb2
.base
.epptr
= NULL
;
5583 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, '\n');
5584 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5585 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5586 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5587 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
5588 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
5589 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 30, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.egptr
);
5590 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
5591 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
5592 ok(fb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb2
.base
.epptr
);
5593 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, 0);
5594 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5595 ok(is1
.count
== 16, "expected 16 got %d\n", is1
.count
);
5596 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5597 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5598 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
5599 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5600 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
5601 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
5602 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
5603 ok(fb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb2
.base
.epptr
);
5604 is1
.base_ios
.state
= IOSTATE_goodbit
;
5605 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5606 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5607 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, '\n');
5608 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5609 ok(is1
.count
== 14, "expected 14 got %d\n", is1
.count
);
5610 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5611 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
5612 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
5613 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 30, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.egptr
);
5614 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
5615 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
5616 ok(fb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb2
.base
.epptr
);
5618 is1
.base_ios
.state
= IOSTATE_goodbit
;
5619 pis
= call_func3(p_istream_get_sb
, &is1
, NULL
, '\n');
5620 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5621 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5622 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5623 ok(fb1
.base
.eback
== fb1
.base
.base
, "wrong get base, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.eback
);
5624 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
5625 ok(fb1
.base
.egptr
== fb1
.base
.base
+ 30, "wrong get end, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.egptr
);
5626 ok(fb2
.base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, fb2
.base
.pbase
);
5627 ok(fb2
.base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, fb2
.base
.pptr
);
5628 ok(fb2
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb2
.base
.epptr
);
5629 is1
.base_ios
.state
= IOSTATE_goodbit
;
5630 if (0) /* crashes on native */
5631 pis
= call_func3(p_istream_get_sb
, &is1
, NULL
, '?');
5632 *fb1
.base
.gptr
= -50;
5633 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, -50);
5634 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5635 ok(is1
.count
== 16, "expected 16 got %d\n", is1
.count
);
5636 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5637 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
5638 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5639 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
5640 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5641 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 16, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 16, fb2
.base
.pptr
);
5642 ok(fb2
.base
.epptr
== fb2
.base
.ebuf
, "wrong put end, expected %p got %p\n", fb2
.base
.ebuf
, fb2
.base
.epptr
);
5643 is1
.base_ios
.state
= IOSTATE_goodbit
;
5644 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5645 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5646 pis
= call_func3(p_istream_get_sb
, &is1
, &fb2
.base
, (char)206);
5647 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5648 ok(is1
.count
== 30, "expected 30 got %d\n", is1
.count
);
5649 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5650 ok(fb1
.base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, fb1
.base
.eback
);
5651 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5652 ok(fb1
.base
.egptr
== NULL
, "wrong get end, expected %p got %p\n", NULL
, fb1
.base
.egptr
);
5653 ok(fb2
.base
.pbase
== fb2
.base
.base
, "wrong put base, expected %p got %p\n", fb2
.base
.base
, fb2
.base
.pbase
);
5654 ok(fb2
.base
.pptr
== fb2
.base
.base
+ 46, "wrong put pointer, expected %p got %p\n", fb2
.base
.base
+ 46, fb2
.base
.pptr
);
5655 ok(fb2
.base
.epptr
== fb2
.base
.ebuf
, "wrong put end, expected %p got %p\n", fb2
.base
.ebuf
, fb2
.base
.epptr
);
5658 is1
.extract_delim
= is1
.count
= 0xabababab;
5659 memset(buffer
, 'A', sizeof(buffer
));
5660 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, 0);
5661 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5662 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5663 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5664 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5665 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5666 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5667 is1
.extract_delim
= is1
.count
= 0xabababab;
5668 is1
.base_ios
.state
= IOSTATE_goodbit
;
5669 memset(buffer
, 'A', sizeof(buffer
));
5670 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, 0);
5671 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5672 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5673 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5674 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5675 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5676 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5677 is1
.base_ios
.state
= IOSTATE_goodbit
;
5678 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5679 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5680 memset(buffer
, 'A', sizeof(buffer
));
5681 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, 'r');
5682 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5683 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5684 ok(is1
.count
== 7, "expected 7 got %d\n", is1
.count
);
5685 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5686 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 7, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 7, fb1
.base
.gptr
);
5687 ok(!strncmp(buffer
, fb1
.base
.base
, 6), "unexpected buffer content, got '%s'\n", buffer
);
5688 ok(buffer
[6] == 0, "expected 0 got %d\n", buffer
[6]);
5689 is1
.extract_delim
= -1;
5690 memset(buffer
, 'A', sizeof(buffer
));
5691 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, -50);
5692 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5693 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5694 ok(is1
.count
== 7, "expected 7 got %d\n", is1
.count
);
5695 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5696 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
5697 ok(!strncmp(buffer
, fb1
.base
.base
+ 7, 7), "unexpected buffer content, got '%s'\n", buffer
);
5698 ok(buffer
[7] == 0, "expected 0 got %d\n", buffer
[7]);
5699 is1
.extract_delim
= -1;
5700 memset(buffer
, 'A', sizeof(buffer
));
5701 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 10, (char)206);
5702 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5703 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5704 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5705 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5706 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
5707 ok(buffer
[0] == 0, "expected 0 got %d\n", buffer
[0]);
5708 is1
.extract_delim
= -2;
5709 memset(buffer
, 'A', sizeof(buffer
));
5710 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 20, '\r');
5711 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5712 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5713 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
5714 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5715 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 24, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 24, fb1
.base
.gptr
);
5716 ok(!strncmp(buffer
, fb1
.base
.base
+ 14, 9), "unexpected buffer content, got '%s'\n", buffer
);
5717 ok(buffer
[9] == 0, "expected 0 got %d\n", buffer
[9]);
5718 memset(buffer
, 'A', sizeof(buffer
));
5719 pis
= call_func4(p_istream_getline
, &is1
, NULL
, 20, '?');
5720 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5721 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5722 ok(is1
.count
== 6, "expected 6 got %d\n", is1
.count
);
5723 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5724 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
5725 memset(buffer
, 'A', sizeof(buffer
));
5726 pis
= call_func4(p_istream_getline
, &is1
, buffer
, 0, 0);
5727 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5728 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5729 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5730 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5731 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
5732 ok(buffer
[0] == 'A', "expected 'A' got %d\n", buffer
[0]);
5735 is1
.count
= is1
.extract_delim
= 0xabababab;
5736 is1
.base_ios
.state
= IOSTATE_badbit
;
5737 pis
= call_func3(p_istream_ignore
, &is1
, 10, 0);
5738 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5739 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5740 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5741 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
5742 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5743 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
5744 is1
.count
= is1
.extract_delim
= 0xabababab;
5745 is1
.base_ios
.state
= IOSTATE_goodbit
;
5746 pis
= call_func3(p_istream_ignore
, &is1
, 0, 0);
5747 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5748 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5749 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5750 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5751 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
5752 pis
= call_func3(p_istream_ignore
, &is1
, 1, 0);
5753 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5754 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5755 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5756 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5757 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5758 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5759 is1
.base_ios
.state
= IOSTATE_goodbit
;
5760 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5761 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5762 pis
= call_func3(p_istream_ignore
, &is1
, 5, -1);
5763 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5764 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5765 ok(is1
.count
== 5, "expected 5 got %d\n", is1
.count
);
5766 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5767 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 5, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 5, fb1
.base
.gptr
);
5768 is1
.extract_delim
= 0;
5769 pis
= call_func3(p_istream_ignore
, &is1
, 10, 'g');
5770 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5771 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5772 ok(is1
.count
== 4, "expected 4 got %d\n", is1
.count
);
5773 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5774 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 9, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 9, fb1
.base
.gptr
);
5775 is1
.extract_delim
= -1;
5776 pis
= call_func3(p_istream_ignore
, &is1
, 10, 'a');
5777 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5778 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5779 ok(is1
.count
== 3, "expected 3 got %d\n", is1
.count
);
5780 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5781 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 12, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 12, fb1
.base
.gptr
);
5782 is1
.extract_delim
= -1;
5783 pis
= call_func3(p_istream_ignore
, &is1
, 10, 206);
5784 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5785 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5786 ok(is1
.count
== 2, "expected 2 got %d\n", is1
.count
);
5787 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5788 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
5789 pis
= call_func3(p_istream_ignore
, &is1
, 10, -50);
5790 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5791 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5792 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
5793 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5794 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 24, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 24, fb1
.base
.gptr
);
5795 is1
.extract_delim
= -1;
5796 pis
= call_func3(p_istream_ignore
, &is1
, 10, -1);
5797 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5798 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
5799 ok(is1
.count
== 6, "expected 6 got %d\n", is1
.count
);
5800 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5801 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5804 is1
.count
= 0xabababab;
5805 ret
= (int) call_func1(p_istream_peek
, &is1
);
5806 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5807 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5808 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5809 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5810 is1
.count
= 0xabababab;
5811 is1
.base_ios
.state
= IOSTATE_goodbit
;
5812 ret
= (int) call_func1(p_istream_peek
, &is1
);
5813 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5814 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5815 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5816 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5817 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5818 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5819 ret
= (int) call_func1(p_istream_peek
, &is1
);
5820 ok(ret
== ' ', "expected ' ' got %d\n", ret
);
5821 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5822 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5823 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
5824 if (0) /* crashes on native */
5825 is1
.base_ios
.sb
= NULL
;
5826 fb1
.base
.gptr
= fb1
.base
.base
+ 14;
5827 ret
= (int) call_func1(p_istream_peek
, &is1
);
5828 ok(ret
== 206, "expected 206 got %d\n", ret
);
5829 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5830 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5831 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
5832 fb1
.base
.gptr
= fb1
.base
.base
+ 30;
5833 ret
= (int) call_func1(p_istream_peek
, &is1
);
5834 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
5835 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5836 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5837 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5840 is1
.base_ios
.state
= IOSTATE_goodbit
;
5841 pis
= call_func2(p_istream_putback
, &is1
, 'a');
5842 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5843 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5844 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5847 pis
= call_func2(p_istream_putback
, &is1
, 'a');
5848 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5849 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5851 fb1
.base
.eback
= fb1
.base
.base
;
5852 fb1
.base
.gptr
= fb1
.base
.base
+ 15;
5853 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5854 pis
= call_func2(p_istream_putback
, &is1
, -40);
5855 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5856 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5857 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 15, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 15, fb1
.base
.gptr
);
5858 is1
.base_ios
.state
= IOSTATE_badbit
;
5859 pis
= call_func2(p_istream_putback
, &is1
, -40);
5860 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5861 ok(is1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is1
.base_ios
.state
);
5862 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 15, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 15, fb1
.base
.gptr
);
5863 is1
.base_ios
.state
= IOSTATE_eofbit
;
5864 pis
= call_func2(p_istream_putback
, &is1
, -40);
5865 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5866 ok(is1
.base_ios
.state
== IOSTATE_eofbit
, "expected %d got %d\n", IOSTATE_eofbit
, is1
.base_ios
.state
);
5867 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 15, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 15, fb1
.base
.gptr
);
5868 is1
.base_ios
.state
= IOSTATE_goodbit
;
5869 if (0) /* crashes on native */
5870 is1
.base_ios
.sb
= NULL
;
5871 pis
= call_func2(p_istream_putback
, &is1
, -40);
5872 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5873 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5874 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 14, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 14, fb1
.base
.gptr
);
5875 ok((signed char)*fb1
.base
.gptr
== -40, "expected -40 got %d\n", *fb1
.base
.gptr
);
5878 is1
.extract_delim
= is1
.count
= 0xabababab;
5879 is1
.base_ios
.state
= IOSTATE_badbit
;
5880 memset(buffer
, 'A', sizeof(buffer
));
5881 pis
= call_func3(p_istream_read
, &is1
, buffer
, 10);
5882 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5883 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5884 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
5885 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5886 ok(buffer
[0] == 'A', "expected 'A' got %d\n", buffer
[0]);
5887 is1
.base_ios
.state
= IOSTATE_goodbit
;
5888 fb1
.base
.gptr
= fb1
.base
.base
;
5889 memset(buffer
, 'A', sizeof(buffer
));
5890 pis
= call_func3(p_istream_read
, &is1
, buffer
, 10);
5891 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5892 ok(is1
.count
== 10, "expected 10 got %d\n", is1
.count
);
5893 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5894 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 10, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 10, fb1
.base
.gptr
);
5895 ok(!strncmp(buffer
, fb1
.base
.base
, 10), "unexpected buffer content, got '%s'\n", buffer
);
5896 ok(buffer
[10] == 'A', "expected 'A' got %d\n", buffer
[10]);
5897 memset(buffer
, 'A', sizeof(buffer
));
5898 pis
= call_func3(p_istream_read
, &is1
, buffer
, 20);
5899 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5900 ok(is1
.count
== 20, "expected 20 got %d\n", is1
.count
);
5901 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5902 ok(fb1
.base
.gptr
== fb1
.base
.base
+ 30, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
+ 30, fb1
.base
.gptr
);
5903 ok(!strncmp(buffer
, fb1
.base
.base
+ 10, 20), "unexpected buffer content, got '%s'\n", buffer
);
5904 ok((signed char)buffer
[4] == -40, "expected -40 got %d\n", buffer
[4]);
5905 ok(buffer
[20] == 'A', "expected 'A' got %d\n", buffer
[20]);
5906 memset(buffer
, 'A', sizeof(buffer
));
5907 pis
= call_func3(p_istream_read
, &is1
, buffer
, 5);
5908 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5909 ok(is1
.count
== 1, "expected 1 got %d\n", is1
.count
);
5910 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5911 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5912 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5913 ok(buffer
[0] == 'e', "expected 'e' got %d\n", buffer
[0]);
5914 ok(buffer
[1] == 'A', "expected 'A' got %d\n", buffer
[1]);
5915 is1
.base_ios
.state
= IOSTATE_goodbit
;
5916 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5917 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5918 memset(buffer
, 'A', sizeof(buffer
));
5919 pis
= call_func3(p_istream_read
, &is1
, buffer
, 35);
5920 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5921 ok(is1
.count
== 30, "expected 30 got %d\n", is1
.count
);
5922 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
5923 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
5924 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5925 ok(!strncmp(buffer
, fb1
.base
.base
, 30), "unexpected buffer content, got '%s'\n", buffer
);
5926 ok(buffer
[30] == 'A', "expected 'A' got %d\n", buffer
[30]);
5927 if (0) /* crashes on native */
5928 is1
.base_ios
.sb
= NULL
;
5929 is1
.base_ios
.state
= IOSTATE_goodbit
;
5930 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5931 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5932 memset(buffer
, 'A', sizeof(buffer
));
5933 if (0) /* crashes on native */
5934 pis
= call_func3(p_istream_read
, &is1
, buffer
, -1);
5935 pis
= call_func3(p_istream_read
, &is1
, buffer
, 0);
5936 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5937 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
5938 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
5939 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
5940 ok(buffer
[0] == 'A', "expected 'A' got %d\n", buffer
[0]);
5941 fb1
.base
.gptr
= fb1
.base
.egptr
;
5944 is1
.extract_delim
= is1
.count
= 0xabababab;
5945 pis
= call_func2(p_istream_seekg
, &is1
, 0);
5946 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5947 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5948 ok(_tell(fb1
.fd
) == 0, "expected 0 got %ld\n", _tell(fb1
.fd
));
5949 if (0) /* crashes on native */
5950 is1
.base_ios
.sb
= NULL
;
5951 pis
= call_func2(p_istream_seekg
, &is1
, -5);
5952 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5953 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5954 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5955 ok(_tell(fb1
.fd
) == 0, "expected 0 got %ld\n", _tell(fb1
.fd
));
5956 fb1
.base
.epptr
= fb1
.base
.ebuf
;
5957 pis
= call_func2(p_istream_seekg
, &is1
, 5);
5958 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5959 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5960 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5961 ok(fb1
.base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, fb1
.base
.epptr
);
5962 ok(_tell(fb1
.fd
) == 5, "expected 5 got %ld\n", _tell(fb1
.fd
));
5963 is1
.base_ios
.state
= IOSTATE_goodbit
;
5966 pis
= call_func2(p_istream_seekg
, &is1
, 0);
5967 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5968 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5969 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5970 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
5971 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
5972 pis
= call_func3(p_istream_seekg_offset
, &is1
, 0, SEEKDIR_end
);
5973 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5974 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5975 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
5976 is1
.base_ios
.state
= IOSTATE_goodbit
;
5978 pis
= call_func3(p_istream_seekg_offset
, &is1
, 0, SEEKDIR_end
);
5979 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5980 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5981 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
5982 if (0) /* crashes on native */
5983 is1
.base_ios
.sb
= NULL
;
5984 fb1
.base
.gptr
= fb1
.base
.egptr
;
5985 pis
= call_func3(p_istream_seekg_offset
, &is1
, 0, SEEKDIR_end
);
5986 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
5987 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5988 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
5989 ok(_tell(fb1
.fd
) == 24, "expected 24 got %ld\n", _tell(fb1
.fd
));
5992 ret
= (int) call_func1(p_istream_sync
, &is1
);
5993 ok(ret
== 0, "expected 0 got %d\n", ret
);
5994 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
5995 is1
.base_ios
.state
= IOSTATE_badbit
;
5996 ret
= (int) call_func1(p_istream_sync
, &is1
);
5997 ok(ret
== 0, "expected 0 got %d\n", ret
);
5998 ok(is1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is1
.base_ios
.state
);
5999 is1
.base_ios
.state
= IOSTATE_goodbit
;
6000 ret
= (int) call_func1(p_istream_sync
, &is1
);
6001 ok(ret
== 0, "expected 0 got %d\n", ret
);
6002 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
6003 if (0) /* crashes on native */
6004 is1
.base_ios
.sb
= NULL
;
6005 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
6006 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
6007 ret
= (int) call_func1(p_istream_sync
, &is1
);
6008 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
6009 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
6010 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
6011 ok(fb1
.base
.gptr
== fb1
.base
.base
, "wrong get pointer, expected %p got %p\n", fb1
.base
.base
, fb1
.base
.gptr
);
6012 fb1
.base
.gptr
= fb1
.base
.egptr
;
6013 ret
= (int) call_func1(p_istream_sync
, &is1
);
6014 ok(ret
== 0, "expected 0 got %d\n", ret
);
6015 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
), "expected %d got %d\n",
6016 IOSTATE_badbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
6017 ok(fb1
.base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, fb1
.base
.gptr
);
6018 is1
.base_ios
.state
= IOSTATE_eofbit
;
6021 ret
= (int) call_func1(p_istream_sync
, &is1
);
6022 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
6023 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
), "expected %d got %d\n",
6024 IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
, is1
.base_ios
.state
);
6028 ret
= (int) call_func1(p_istream_tellg
, &is1
);
6029 ok(ret
== 24, "expected 24 got %d\n", ret
);
6030 ok(is1
.base_ios
.state
== (IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
), "expected %d got %d\n",
6031 IOSTATE_badbit
|IOSTATE_failbit
|IOSTATE_eofbit
, is1
.base_ios
.state
);
6032 is1
.base_ios
.state
= IOSTATE_goodbit
;
6033 ret
= (int) call_func1(p_istream_tellg
, &is1
);
6034 ok(ret
== 24, "expected 24 got %d\n", ret
);
6035 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
6036 if (0) /* crashes on native */
6037 is1
.base_ios
.sb
= NULL
;
6038 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.base
;
6039 fb1
.base
.egptr
= fb1
.base
.base
+ 30;
6040 ret
= (int) call_func1(p_istream_tellg
, &is1
);
6041 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
6042 ok(is1
.base_ios
.state
== IOSTATE_failbit
, "expected %d got %d\n", IOSTATE_failbit
, is1
.base_ios
.state
);
6043 is1
.base_ios
.state
= IOSTATE_eofbit
;
6044 ret
= (int) call_func1(p_istream_tellg
, &is1
);
6045 ok(ret
== EOF
, "expected -1 got %d\n", ret
);
6046 ok(is1
.base_ios
.state
== (IOSTATE_eofbit
|IOSTATE_failbit
), "expected %d got %d\n",
6047 IOSTATE_eofbit
|IOSTATE_failbit
, is1
.base_ios
.state
);
6048 fb1
.base
.eback
= fb1
.base
.gptr
= fb1
.base
.egptr
= NULL
;
6050 call_func1(p_istream_vbase_dtor
, &is1
);
6051 call_func1(p_istream_vbase_dtor
, &is2
);
6052 call_func1(p_ostream_vbase_dtor
, &os
);
6053 call_func1(p_filebuf_dtor
, &fb1
);
6054 call_func1(p_filebuf_dtor
, &fb2
);
6055 ok(_unlink(filename1
) == 0, "Couldn't unlink file named '%s'\n", filename1
);
6056 ok(_unlink(filename2
) == 0, "Couldn't unlink file named '%s'\n", filename2
);
6059 static void test_istream_getint(void)
6062 strstreambuf ssb
, *pssb
;
6066 struct istream_getint_test
{
6067 const char *stream_content
;
6068 ios_io_state initial_state
;
6070 int expected_return
;
6071 ios_io_state expected_state
;
6072 int expected_offset
;
6073 const char *expected_buffer
;
6075 {"", IOSTATE_badbit
, FLAGS_skipws
, 0, IOSTATE_badbit
|IOSTATE_failbit
, 0, ""},
6076 {"", IOSTATE_eofbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, ""},
6077 {"", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, ""},
6078 {" 0 ", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 2, "0"},
6079 {" \n0", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 3, "0"},
6080 {"-0", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 2, "-0"},
6081 {"000\n", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 3, "000"},
6082 {"015 16", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 3, "015"},
6083 {"099", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 1, "0"},
6084 {" 12345", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 6, "12345"},
6085 {"12345\r", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 5, "12345"},
6086 {"0xab ", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_goodbit
, 4, "0xab"},
6087 {" 0xefg", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_goodbit
, 5, "0xef"},
6088 {"0XABc", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_eofbit
, 5, "0XABc"},
6089 {"0xzzz", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_failbit
, 0, ""},
6090 {"0y123", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 1, "0"},
6091 {"\t+42 ", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 4, "+42"},
6092 {"+\t42", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
6093 {"+4\t2", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 2, "+4"},
6094 {"+0xc", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_eofbit
, 4, "+0xc"},
6095 {" -1 ", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 3, "-1"},
6096 {" -005 ", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 5, "-005"},
6097 {" 2-0 ", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 2, "2"},
6098 {"--3 ", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
6099 {"+-7", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
6100 {"+", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
6101 {"-0x123abc", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_eofbit
, 9, "-0x123abc"},
6102 {"0-x123abc", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 1, "0"},
6103 {"0x-123abc", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_failbit
, 0, ""},
6104 {"2147483648", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 10, "2147483648"},
6105 {"99999999999999", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
, 14, "99999999999999"},
6106 {"999999999999999", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 15, "999999999999999"},
6107 {"123456789123456789", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 15, "123456789123456"},
6108 {"000000000000000000", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 15, "000000000000000"},
6109 {"-0xffffffffffffffffff", IOSTATE_goodbit
, FLAGS_skipws
, 16, IOSTATE_goodbit
, 15, "-0xffffffffffff"},
6110 {"3.14159", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 1, "3"},
6111 {"deadbeef", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, ""},
6112 {"0deadbeef", IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 1, "0"},
6113 {"98765L", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 5, "98765"},
6114 {"9999l", IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_goodbit
, 4, "9999"},
6115 {" 1", IOSTATE_goodbit
, 0, 0, IOSTATE_failbit
, 0, ""},
6116 {"1 ", IOSTATE_goodbit
, 0, 0, IOSTATE_goodbit
, 1, "1"},
6117 {"010", IOSTATE_goodbit
, FLAGS_dec
, 10, IOSTATE_eofbit
, 3, "010"},
6118 {"0x123", IOSTATE_goodbit
, FLAGS_dec
, 10, IOSTATE_goodbit
, 1, "0"},
6119 {"x1", IOSTATE_goodbit
, FLAGS_dec
, 10, IOSTATE_failbit
, 0, ""},
6120 {"33", IOSTATE_goodbit
, FLAGS_dec
|FLAGS_oct
, 10, IOSTATE_eofbit
, 2, "33"},
6121 {"abc", IOSTATE_goodbit
, FLAGS_dec
|FLAGS_hex
, 10, IOSTATE_failbit
, 0, ""},
6122 {"33", IOSTATE_goodbit
, FLAGS_oct
, 8, IOSTATE_eofbit
, 2, "33"},
6123 {"9", IOSTATE_goodbit
, FLAGS_oct
, 8, IOSTATE_failbit
, 0, ""},
6124 {"0", IOSTATE_goodbit
, FLAGS_oct
, 8, IOSTATE_eofbit
, 1, "0"},
6125 {"x1", IOSTATE_goodbit
, FLAGS_oct
, 8, IOSTATE_failbit
, 0, ""},
6126 {"9", IOSTATE_goodbit
, FLAGS_oct
|FLAGS_hex
, 16, IOSTATE_eofbit
, 1, "9"},
6127 {"abc", IOSTATE_goodbit
, FLAGS_oct
|FLAGS_hex
, 16, IOSTATE_eofbit
, 3, "abc"},
6128 {"123 ", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_goodbit
, 3, "123"},
6129 {"x123 ", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_failbit
, 0, ""},
6130 {"0x123 ", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_goodbit
, 5, "0x123"},
6131 {"-a", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_eofbit
, 2, "-a"},
6132 {"-j", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_failbit
, 0, ""},
6133 {"-0x-1", IOSTATE_goodbit
, FLAGS_hex
, 16, IOSTATE_failbit
, 0, ""},
6134 {"0", IOSTATE_goodbit
, FLAGS_dec
|FLAGS_oct
|FLAGS_hex
, 10, IOSTATE_eofbit
, 1, "0"},
6135 {"0z", IOSTATE_goodbit
, FLAGS_dec
|FLAGS_oct
|FLAGS_hex
, 10, IOSTATE_goodbit
, 1, "0"}
6138 pssb
= call_func2(p_strstreambuf_dynamic_ctor
, &ssb
, 64);
6139 ok(pssb
== &ssb
, "wrong return, expected %p got %p\n", &ssb
, pssb
);
6140 ret
= (int) call_func1(p_streambuf_allocate
, &ssb
.base
);
6141 ok(ret
== 1, "expected 1 got %d\n", ret
);
6142 pis
= call_func3(p_istream_sb_ctor
, &is
, &ssb
.base
, TRUE
);
6143 ok(pis
== &is
, "wrong return, expected %p got %p\n", &is
, pis
);
6145 for (i
= 0; i
< ARRAY_SIZE(tests
); i
++) {
6146 len
= strlen(tests
[i
].stream_content
);
6147 is
.base_ios
.state
= tests
[i
].initial_state
;
6148 is
.base_ios
.flags
= tests
[i
].flags
;
6149 ssb
.base
.eback
= ssb
.base
.gptr
= ssb
.base
.base
;
6150 ssb
.base
.egptr
= ssb
.base
.base
+ len
;
6151 memcpy(ssb
.base
.base
, tests
[i
].stream_content
, len
);
6153 ret
= (int) call_func2(p_istream_getint
, &is
, buffer
);
6154 ok(ret
== tests
[i
].expected_return
, "Test %d: wrong return, expected %d got %d\n", i
,
6155 tests
[i
].expected_return
, ret
);
6156 ok(is
.base_ios
.state
== tests
[i
].expected_state
, "Test %d: expected %d got %d\n", i
,
6157 tests
[i
].expected_state
, is
.base_ios
.state
);
6158 ok(ssb
.base
.gptr
== ssb
.base
.base
+ tests
[i
].expected_offset
, "Test %d: expected %p got %p\n", i
,
6159 ssb
.base
.base
+ tests
[i
].expected_offset
, ssb
.base
.gptr
);
6160 ok(!strncmp(buffer
, tests
[i
].expected_buffer
, strlen(tests
[i
].expected_buffer
)),
6161 "Test %d: unexpected buffer content, got '%s'\n", i
, buffer
);
6164 call_func1(p_istream_vbase_dtor
, &is
);
6165 call_func1(p_strstreambuf_dtor
, &ssb
);
6168 static void test_istream_getdouble(void)
6171 strstreambuf ssb
, *pssb
;
6175 struct istream_getdouble_test
{
6176 const char *stream_content
;
6178 ios_io_state initial_state
;
6180 int expected_return
;
6181 ios_io_state expected_state
;
6182 int expected_offset
;
6183 const char *expected_buffer
;
6186 {"", 32, IOSTATE_badbit
, FLAGS_skipws
, 0, IOSTATE_badbit
|IOSTATE_failbit
, 0, "", FALSE
},
6187 {"", 0, IOSTATE_badbit
, FLAGS_skipws
, 0, IOSTATE_badbit
|IOSTATE_failbit
, 0, "", FALSE
},
6188 {"", 32, IOSTATE_eofbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, "", FALSE
},
6189 {"", 32, IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, "", FALSE
},
6190 {" ", 32, IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 1, "", FALSE
},
6191 {" 0", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_eofbit
, 2, "0", FALSE
},
6192 {"156", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_eofbit
, 3, "156", FALSE
},
6193 {"123 ", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_goodbit
, 3, "123", FALSE
},
6194 {"+4 5", 32, IOSTATE_goodbit
, FLAGS_skipws
, 2, IOSTATE_goodbit
, 2, "+4", FALSE
},
6195 {"-88a", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_goodbit
, 3, "-88", FALSE
},
6196 {"-+5", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_failbit
, 1, "-", FALSE
},
6197 {"++7", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_failbit
, 1, "+", FALSE
},
6198 {"+", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_eofbit
|IOSTATE_failbit
, 1, "+", FALSE
},
6199 {"abc", 32, IOSTATE_goodbit
, FLAGS_skipws
, 0, IOSTATE_failbit
, 0, "", FALSE
},
6200 {"0xabc", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_goodbit
, 1, "0", FALSE
},
6201 {"01", 32, IOSTATE_goodbit
, FLAGS_skipws
, 2, IOSTATE_eofbit
, 2, "01", FALSE
},
6202 {"10000000000000000000", 32, IOSTATE_goodbit
, FLAGS_skipws
, 20, IOSTATE_eofbit
, 20, "10000000000000000000", FALSE
},
6203 {"1.2", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_eofbit
, 3, "1.2", FALSE
},
6204 {"\t-0.4444f", 32, IOSTATE_goodbit
, FLAGS_skipws
, 7, IOSTATE_goodbit
, 8, "-0.4444", FALSE
},
6205 {"3.-14159", 32, IOSTATE_goodbit
, FLAGS_skipws
, 2, IOSTATE_goodbit
, 2, "3.", FALSE
},
6206 {"3.14.159", 32, IOSTATE_goodbit
, FLAGS_skipws
, 4, IOSTATE_goodbit
, 4, "3.14", FALSE
},
6207 {"3.000", 32, IOSTATE_goodbit
, FLAGS_skipws
, 5, IOSTATE_eofbit
, 5, "3.000", FALSE
},
6208 {".125f", 32, IOSTATE_goodbit
, FLAGS_skipws
, 4, IOSTATE_goodbit
, 4, ".125", FALSE
},
6209 {"-.125f", 32, IOSTATE_goodbit
, FLAGS_skipws
, 5, IOSTATE_goodbit
, 5, "-.125", FALSE
},
6210 {"5L", 32, IOSTATE_goodbit
, FLAGS_skipws
, 1, IOSTATE_goodbit
, 1, "5", FALSE
},
6211 {"1.", 32, IOSTATE_goodbit
, FLAGS_skipws
, 2, IOSTATE_eofbit
, 2, "1.", FALSE
},
6212 {"55.!", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_goodbit
, 3, "55.", FALSE
},
6213 {"99.99999999999", 32, IOSTATE_goodbit
, FLAGS_skipws
, 14, IOSTATE_eofbit
, 14, "99.99999999999", FALSE
},
6214 {"9.9999999999999999999", 32, IOSTATE_goodbit
, FLAGS_skipws
, 21, IOSTATE_eofbit
, 21, "9.9999999999999999999", FALSE
},
6215 {"0.0000000000000f", 32, IOSTATE_goodbit
, FLAGS_skipws
, 15, IOSTATE_goodbit
, 15, "0.0000000000000", FALSE
},
6216 {"1.0000e5 ", 32, IOSTATE_goodbit
, FLAGS_skipws
, 8, IOSTATE_goodbit
, 8, "1.0000e5", FALSE
},
6217 {"-2.12345e1000 ", 32, IOSTATE_goodbit
, FLAGS_skipws
, 13, IOSTATE_goodbit
, 13, "-2.12345e1000", FALSE
},
6218 {" 8E1", 32, IOSTATE_goodbit
, FLAGS_skipws
, 3, IOSTATE_eofbit
, 5, "8E1", FALSE
},
6219 {"99.99E-99E5", 32, IOSTATE_goodbit
, FLAGS_skipws
, 9, IOSTATE_goodbit
, 9, "99.99E-99", FALSE
},
6220 {"0e0", 32, IOSTATE_goodbit
, FLAGS_skipws
|FLAGS_uppercase
, 3, IOSTATE_eofbit
, 3, "0e0", FALSE
},
6221 {"1.e8.5", 32, IOSTATE_goodbit
, 0, 4, IOSTATE_goodbit
, 4, "1.e8", FALSE
},
6222 {"1.0e-1000000000000000000 ", 32, IOSTATE_goodbit
, 0, 24, IOSTATE_goodbit
, 24, "1.0e-1000000000000000000", FALSE
},
6223 {"1.e+f", 32, IOSTATE_goodbit
, 0, 3, IOSTATE_goodbit
, 3, "1.e", FALSE
},
6224 {"1.ef", 32, IOSTATE_goodbit
, 0, 2, IOSTATE_goodbit
, 2, "1.", FALSE
},
6225 {"1.E-z", 32, IOSTATE_goodbit
, 0, 3, IOSTATE_goodbit
, 3, "1.E", FALSE
},
6226 {".", 32, IOSTATE_goodbit
, 0, 1, IOSTATE_eofbit
|IOSTATE_failbit
, 1, ".", FALSE
},
6227 {".e", 32, IOSTATE_goodbit
, 0, 1, IOSTATE_failbit
, 1, ".", FALSE
},
6228 {".e.", 32, IOSTATE_goodbit
, 0, 1, IOSTATE_failbit
, 1, ".", FALSE
},
6229 {".e5", 32, IOSTATE_goodbit
, 0, 3, IOSTATE_eofbit
|IOSTATE_failbit
, 3, ".e5", FALSE
},
6230 {".2e5", 32, IOSTATE_goodbit
, 0, 4, IOSTATE_eofbit
, 4, ".2e5", FALSE
},
6231 {"9.e", 32, IOSTATE_goodbit
, 0, 2, IOSTATE_goodbit
, 2, "9.", FALSE
},
6232 {"0.0e-0", 32, IOSTATE_goodbit
, 0, 6, IOSTATE_eofbit
, 6, "0.0e-0", FALSE
},
6233 {"e5.2", 32, IOSTATE_goodbit
, 0, 2, IOSTATE_failbit
, 2, "e5", FALSE
},
6234 {"1.0000", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, "1.00", TRUE
},
6235 {"-123456", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, "-123", TRUE
},
6236 {"3.5e2", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, "3.5e", TRUE
},
6237 {"3.e25", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, "3.e2", TRUE
},
6238 {"1.11f", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_goodbit
, 4, "1.11", FALSE
},
6239 {".5e-5", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_failbit
, 5, ".5e-", TRUE
},
6240 {".5e-", 5, IOSTATE_goodbit
, 0, 3, IOSTATE_goodbit
, 3, ".5e", FALSE
},
6241 {".5e2", 5, IOSTATE_goodbit
, 0, 4, IOSTATE_eofbit
, 4, ".5e2", FALSE
},
6242 {"1", 0, IOSTATE_goodbit
, 0, -1, IOSTATE_failbit
, 0, "", TRUE
},
6243 {"x", 0, IOSTATE_goodbit
, 0, -1, IOSTATE_failbit
, 0, "", TRUE
},
6244 {"", 0, IOSTATE_goodbit
, 0, -1, IOSTATE_failbit
, 0, "", TRUE
},
6245 {"", 1, IOSTATE_goodbit
, 0, 0, IOSTATE_eofbit
|IOSTATE_failbit
, 0, "", FALSE
},
6246 {"1.0", 1, IOSTATE_goodbit
, 0, 0, IOSTATE_failbit
, 1, "", TRUE
},
6247 {"1.0", 2, IOSTATE_goodbit
, 0, 1, IOSTATE_failbit
, 2, "1", TRUE
}
6250 pssb
= call_func2(p_strstreambuf_dynamic_ctor
, &ssb
, 64);
6251 ok(pssb
== &ssb
, "wrong return, expected %p got %p\n", &ssb
, pssb
);
6252 ret
= (int) call_func1(p_streambuf_allocate
, &ssb
.base
);
6253 ok(ret
== 1, "expected 1 got %d\n", ret
);
6254 pis
= call_func3(p_istream_sb_ctor
, &is
, &ssb
.base
, TRUE
);
6255 ok(pis
== &is
, "wrong return, expected %p got %p\n", &is
, pis
);
6257 for (i
= 0; i
< ARRAY_SIZE(tests
); i
++) {
6258 len
= strlen(tests
[i
].stream_content
);
6259 is
.base_ios
.state
= tests
[i
].initial_state
;
6260 is
.base_ios
.flags
= tests
[i
].flags
;
6261 ssb
.base
.eback
= ssb
.base
.gptr
= ssb
.base
.base
;
6262 ssb
.base
.egptr
= ssb
.base
.base
+ len
;
6263 memcpy(ssb
.base
.base
, tests
[i
].stream_content
, len
);
6265 ret
= (int) call_func3(p_istream_getdouble
, &is
, buffer
, tests
[i
].count
);
6266 ok(ret
== tests
[i
].expected_return
||
6267 /* xp, 2k3 */ broken(tests
[i
].broken
&& ret
== tests
[i
].expected_return
+ 1),
6268 "Test %d: wrong return, expected %d got %d\n", i
, tests
[i
].expected_return
, ret
);
6269 ok(is
.base_ios
.state
== tests
[i
].expected_state
, "Test %d: expected %d got %d\n", i
,
6270 tests
[i
].expected_state
, is
.base_ios
.state
);
6271 ok(ssb
.base
.gptr
== ssb
.base
.base
+ tests
[i
].expected_offset
, "Test %d: expected %p got %p\n",
6272 i
, ssb
.base
.base
+ tests
[i
].expected_offset
, ssb
.base
.gptr
);
6273 ok(!strncmp(buffer
, tests
[i
].expected_buffer
, strlen(tests
[i
].expected_buffer
)),
6274 "Test %d: unexpected buffer content, got '%s'\n", i
, buffer
);
6277 call_func1(p_istream_vbase_dtor
, &is
);
6278 call_func1(p_strstreambuf_dtor
, &ssb
);
6281 static void test_istream_read(void)
6284 strstreambuf ssb
, ssb_test
, *pssb
;
6287 /* makes tables narrower */
6288 const ios_io_state IOSTATE_faileof
= IOSTATE_failbit
|IOSTATE_eofbit
;
6290 char c
, st
[8], char_out
[] = {-85, ' ', 'a', -50};
6291 const char *str_out
[] = {"AAAAAAA", "abc", "a", "abc", "ab", "abcde"};
6292 short s
, short_out
[] = {32767, -32768};
6293 unsigned short us
, ushort_out
[] = {65535u, 65534u, 32768u};
6294 int n
, int_out
[] = {123456789, 0, 1, -500, 0x8000, 2147483646, 2147483647, -2147483647, -2147483647-1, -1};
6295 unsigned un
, uint_out
[] = {4294967295u, 4294967294u, 2147483648u, 1u};
6296 LONG l
, long_out
[] = {2147483647l, -2147483647l-1};
6297 ULONG ul
, ulong_out
[] = {4294967295ul, 4294967294ul, 2147483648ul, 1ul};
6298 float f
, float_out
[] = {123.456f
, 0.0f
, 1.0f
, 0.1f
, -1.0f
, -0.1f
, FLT_MIN
, -FLT_MIN
, FLT_MAX
, -FLT_MAX
};
6299 double d
, double_out
[] = {1.0, 0.1, 0.0, INFINITY
, -INFINITY
};
6300 const char *sbf_out
[] = {"", "abcd\n", "abcdef"};
6301 struct istream_read_test
{
6302 enum { type_chr
, type_str
, type_shrt
, type_ushrt
, type_int
, type_uint
,
6303 type_long
, type_ulong
, type_flt
, type_dbl
, type_ldbl
, type_sbf
} type
;
6304 const char *stream_content
;
6308 ios_io_state expected_state
;
6310 int expected_offset
;
6314 {type_chr
, "", FLAGS_skipws
, 6, /* -85 */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
6315 {type_chr
, " ", FLAGS_skipws
, 6, /* -85 */ 0, IOSTATE_faileof
, 6, 2, FALSE
},
6316 {type_chr
, " abc ", 0, 6, /* ' ' */ 1, IOSTATE_goodbit
, 6, 1, FALSE
},
6317 {type_chr
, " abc ", FLAGS_skipws
, 6, /* 'a' */ 2, IOSTATE_goodbit
, 6, 2, FALSE
},
6318 {type_chr
, " a", FLAGS_skipws
, 0, /* 'a' */ 2, IOSTATE_goodbit
, 0, 2, FALSE
},
6319 {type_chr
, "\xce", 0, 6, /* -50 */ 3, IOSTATE_goodbit
, 6, 1, FALSE
},
6321 {type_str
, "", FLAGS_skipws
, 6, /* "AAAAAAA" */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
6322 {type_str
, " ", FLAGS_skipws
, 6, /* "AAAAAAA" */ 0, IOSTATE_faileof
, 6, 1, FALSE
},
6323 {type_str
, " abc", FLAGS_skipws
, 6, /* "abc" */ 1, IOSTATE_eofbit
, 0, 4, FALSE
},
6324 {type_str
, " abc ", FLAGS_skipws
, 6, /* "abc" */ 1, IOSTATE_goodbit
, 0, 4, FALSE
},
6325 {type_str
, " a\tc", FLAGS_skipws
, 6, /* "a" */ 2, IOSTATE_goodbit
, 0, 2, FALSE
},
6326 {type_str
, " a\tc", 0, 6, /* "AAAAAAA" */ 0, IOSTATE_failbit
, 0, 0, FALSE
},
6327 {type_str
, "abcde\n", 0, 4, /* "abc" */ 3, IOSTATE_goodbit
, 0, 3, FALSE
},
6328 {type_str
, "abc\n", 0, 4, /* "abc" */ 3, IOSTATE_goodbit
, 0, 3, FALSE
},
6329 {type_str
, "ab\r\n", 0, 3, /* "ab" */ 4, IOSTATE_goodbit
, 0, 2, FALSE
},
6330 {type_str
, "abc", 0, 4, /* "abc" */ 3, IOSTATE_goodbit
, 0, 3, FALSE
},
6331 {type_str
, "abc", 0, 1, /* "AAAAAAA" */ 0, IOSTATE_failbit
, 0, 0, FALSE
},
6332 {type_str
, "\n", 0, 1, /* "AAAAAAA" */ 0, IOSTATE_failbit
, 0, 0, FALSE
},
6333 {type_str
, "abcde\n", 0, 0, /* "abcde" */ 5, IOSTATE_goodbit
, 0, 5, FALSE
},
6334 {type_str
, "\n", 0, 0, /* "AAAAAAA" */ 0, IOSTATE_failbit
, 0, 0, FALSE
},
6335 {type_str
, "abcde", 0, -1, /* "abcde" */ 5, IOSTATE_eofbit
, 0, 5, FALSE
},
6337 {type_shrt
, "32767", 0, 6, /* 32767 */ 0, IOSTATE_eofbit
, 6, 5, FALSE
},
6338 {type_shrt
, "32768", 0, 6, /* 32767 */ 0, IOSTATE_faileof
, 6, 5, FALSE
},
6339 {type_shrt
, "2147483648", 0, 6, /* 32767 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
6340 {type_shrt
, "4294967296", 0, 6, /* 32767 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
6341 {type_shrt
, "-32768", 0, 6, /* -32768 */ 1, IOSTATE_eofbit
, 6, 6, FALSE
},
6342 {type_shrt
, "-32769", 0, 6, /* -32768 */ 1, IOSTATE_faileof
, 6, 6, FALSE
},
6343 {type_shrt
, "-2147483648", 0, 6, /* -32768 */ 1, IOSTATE_faileof
, 6, 11, FALSE
},
6344 /* unsigned short */
6345 {type_ushrt
, "65535", 0, 6, /* 65535 */ 0, IOSTATE_eofbit
, 6, 5, FALSE
},
6346 {type_ushrt
, "65536", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 5, FALSE
},
6347 {type_ushrt
, "12345678", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 8, FALSE
},
6348 {type_ushrt
, "2147483648", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
6349 {type_ushrt
, "4294967296", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
6350 {type_ushrt
, "99999999999999", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 14, FALSE
},
6351 {type_ushrt
, "-1", 0, 6, /* 65535 */ 0, IOSTATE_eofbit
, 6, 2, TRUE
},
6352 {type_ushrt
, "-2", 0, 6, /* 65534 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
6353 {type_ushrt
, "-32768", 0, 6, /* 32768 */ 2, IOSTATE_eofbit
, 6, 6, FALSE
},
6354 {type_ushrt
, "-32769", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 6, FALSE
},
6355 {type_ushrt
, "-2147483648", 0, 6, /* 65535 */ 0, IOSTATE_faileof
, 6, 11, FALSE
},
6357 {type_int
, "", FLAGS_skipws
, 6, /* 123456789 */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
6358 {type_int
, " 0", FLAGS_skipws
, 6, /* 0 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
6359 {type_int
, " 0", 0, 6, /* 0 */ 1, IOSTATE_failbit
, 6, 0, FALSE
},
6360 {type_int
, "+1 ", 0, 6, /* 1 */ 2, IOSTATE_goodbit
, 6, 2, FALSE
},
6361 {type_int
, "1L", 0, 6, /* 1 */ 2, IOSTATE_goodbit
, 6, 1, FALSE
},
6362 {type_int
, "-500.0", 0, 6, /* -500 */ 3, IOSTATE_goodbit
, 6, 4, FALSE
},
6363 {type_int
, "0x8000", 0, 6, /* 0x8000 */ 4, IOSTATE_eofbit
, 6, 6, FALSE
},
6364 {type_int
, "0xtest", 0, 6, /* 0 */ 1, IOSTATE_failbit
, 6, 0, FALSE
},
6365 {type_int
, "0test", 0, 6, /* 0 */ 1, IOSTATE_goodbit
, 6, 1, FALSE
},
6366 {type_int
, "0x7ffffffe", 0, 6, /* 2147483646 */ 5, IOSTATE_eofbit
, 6, 10, FALSE
},
6367 {type_int
, "0x7fffffff", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
6368 {type_int
, "0x80000000", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
6369 {type_int
, "0xdeadbeef", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
6370 {type_int
, "2147483648", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
6371 {type_int
, "4294967295", 0, 6, /* 2147483647 */ 6, IOSTATE_eofbit
, 6, 10, FALSE
},
6372 {type_int
, "-2147483647", 0, 6, /* -2147483647 */ 7, IOSTATE_eofbit
, 6, 11, FALSE
},
6373 {type_int
, "-2147483648", 0, 6, /* -2147483648 */ 8, IOSTATE_eofbit
, 6, 11, FALSE
},
6374 {type_int
, "-2147483649", 0, 6, /* -2147483648 */ 8, IOSTATE_eofbit
, 6, 11, FALSE
},
6375 {type_int
, "-1f", FLAGS_dec
, 6, /* -1 */ 9, IOSTATE_goodbit
, 6, 2, FALSE
},
6377 {type_uint
, "4294967295", 0, 6, /* 4294967295 */ 0, IOSTATE_eofbit
, 6, 10, TRUE
},
6378 {type_uint
, "4294967296", 0, 6, /* 4294967295 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
6379 {type_uint
, "99999999999999", 0, 6, /* 4294967295 */ 0, IOSTATE_faileof
, 6, 14, FALSE
},
6380 {type_uint
, "-1", 0, 6, /* 4294967295 */ 0, IOSTATE_eofbit
, 6, 2, TRUE
},
6381 {type_uint
, "-2", 0, 6, /* 4294967294 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
6382 {type_uint
, "-2147483648", 0, 6, /* 2147483648 */ 2, IOSTATE_eofbit
, 6, 11, FALSE
},
6383 {type_uint
, "-4294967295", 0, 6, /* 1 */ 3, IOSTATE_eofbit
, 6, 11, FALSE
},
6384 {type_uint
, "-9999999999999", 0, 6, /* 1 */ 3, IOSTATE_eofbit
, 6, 14, FALSE
},
6386 {type_long
, "2147483647", 0, 6, /* 2147483647 */ 0, IOSTATE_eofbit
, 6, 10, TRUE
},
6387 {type_long
, "2147483648", 0, 6, /* 2147483647 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
6388 {type_long
, "4294967295", 0, 6, /* 2147483647 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
6389 {type_long
, "-2147483648", 0, 6, /* -2147483648 */ 1, IOSTATE_eofbit
, 6, 11, TRUE
},
6390 {type_long
, "-2147483649", 0, 6, /* -2147483648 */ 1, IOSTATE_faileof
, 6, 11, FALSE
},
6391 {type_long
, "-9999999999999", 0, 6, /* -2147483648 */ 1, IOSTATE_faileof
, 6, 14, FALSE
},
6393 {type_ulong
, "4294967295", 0, 6, /* 4294967295 */ 0, IOSTATE_eofbit
, 6, 10, TRUE
},
6394 {type_ulong
, "4294967296", 0, 6, /* 4294967295 */ 0, IOSTATE_faileof
, 6, 10, FALSE
},
6395 {type_ulong
, "99999999999999", 0, 6, /* 4294967295 */ 0, IOSTATE_faileof
, 6, 14, FALSE
},
6396 {type_ulong
, "-1", 0, 6, /* 4294967295 */ 0, IOSTATE_eofbit
, 6, 2, TRUE
},
6397 {type_ulong
, "-2", 0, 6, /* 4294967294 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
6398 {type_ulong
, "-2147483648", 0, 6, /* 2147483648 */ 2, IOSTATE_eofbit
, 6, 11, FALSE
},
6399 {type_ulong
, "-4294967295", 0, 6, /* 1 */ 3, IOSTATE_eofbit
, 6, 11, FALSE
},
6400 {type_ulong
, "-9999999999999", 0, 6, /* 1 */ 3, IOSTATE_eofbit
, 6, 14, FALSE
},
6402 {type_flt
, "", FLAGS_skipws
, 6, /* 123.456 */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
6403 {type_flt
, "", 0, 6, /* 123.456 */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
6404 {type_flt
, " 0", 0, 6, /* 123.456 */ 0, IOSTATE_failbit
, 6, 0, FALSE
},
6405 {type_flt
, " 0", FLAGS_skipws
, 6, /* 0.0 */ 1, IOSTATE_eofbit
, 6, 2, FALSE
},
6406 {type_flt
, "-0 ", 0, 6, /* 0.0 */ 1, IOSTATE_goodbit
, 6, 2, FALSE
},
6407 {type_flt
, "+1.0", 0, 6, /* 1.0 */ 2, IOSTATE_eofbit
, 6, 4, FALSE
},
6408 {type_flt
, "1.#INF", 0, 6, /* 1.0 */ 2, IOSTATE_goodbit
, 6, 2, FALSE
},
6409 {type_flt
, "0.100000000000000e1", 0, 6, /* 1.0 */ 2, IOSTATE_eofbit
, 6, 19, FALSE
},
6411 {type_flt, "0.1000000000000000e1", 0, 6, 0.1 3, IOSTATE_failbit, 6, 20, FALSE}, */
6412 {type_flt
, "0.10000000000000000e1", 0, 6, /* 0.1 */ 3, IOSTATE_failbit
, 6, 20, TRUE
},
6413 {type_flt
, "-0.10000000000000e1", 0, 6, /* -1.0 */ 4, IOSTATE_eofbit
, 6, 19, FALSE
},
6415 {type_flt, "-0.100000000000000e1 ", 0, 6, -0.1 5, IOSTATE_failbit, 6, 20, FALSE}, */
6416 {type_flt
, "-0.1000000000000000e1", 0, 6, /* -0.1 */ 5, IOSTATE_failbit
, 6, 20, TRUE
},
6417 {type_flt
, "5.1691126e-77", 0, 6, /* FLT_MIN */ 6, IOSTATE_eofbit
, 6, 13, FALSE
},
6418 {type_flt
, "-2.49873e-41f", 0, 6, /* -FLT_MIN */ 7, IOSTATE_goodbit
, 6, 12, FALSE
},
6419 {type_flt
, "1.23456789e1234", 0, 6, /* FLT_MAX */ 8, IOSTATE_eofbit
, 6, 15, FALSE
},
6420 {type_flt
, "-1.23456789e1234", 0, 6, /* -FLT_MAX */ 9, IOSTATE_eofbit
, 6, 16, FALSE
},
6422 {type_dbl
, "0.10000000000000000000000e1", 0, 6, /* 1.0 */ 0, IOSTATE_eofbit
, 6, 27, FALSE
},
6424 {type_dbl, "0.100000000000000000000000e1", 0, 6, 0.1 1, IOSTATE_failbit, 6, 28, FALSE}, */
6425 {type_dbl
, "0.1000000000000000000000000e1", 0, 6, /* 0.1 */ 1, IOSTATE_failbit
, 6, 28, TRUE
},
6426 {type_dbl
, "3.698124698114778e-6228", 0, 6, /* 0.0 */ 2, IOSTATE_eofbit
, 6, 23, FALSE
},
6427 {type_dbl
, "-3.698124698114778e-6228", 0, 6, /* 0.0 */ 2, IOSTATE_eofbit
, 6, 24, FALSE
},
6428 {type_dbl
, "3.698124698114778e6228", 0, 6, /* INF */ 3, IOSTATE_eofbit
, 6, 22, FALSE
},
6429 {type_dbl
, "-3.698124698114778e6228A", 0, 6, /* -INF */ 4, IOSTATE_goodbit
, 6, 23, FALSE
},
6431 {type_ldbl
, "0.100000000000000000000000000e1", 0, 6, /* 1.0 */ 0, IOSTATE_eofbit
, 6, 31, FALSE
},
6433 {type_ldbl, "0.1000000000000000000000000000e1", 0, 6, 0.1 1, IOSTATE_failbit, 6, 32, FALSE}, */
6434 {type_ldbl
, "0.10000000000000000000000000000e1", 0, 6, /* 0.1 */ 1, IOSTATE_failbit
, 6, 32, TRUE
},
6435 {type_ldbl
, "1.69781699841e-1475", 0, 6, /* 0.0 */ 2, IOSTATE_eofbit
, 6, 19, FALSE
},
6436 {type_ldbl
, "-1.69781699841e-1475l", 0, 6, /* 0.0 */ 2, IOSTATE_goodbit
, 6, 20, FALSE
},
6437 {type_ldbl
, "1.69781699841e1475", 0, 6, /* INF */ 3, IOSTATE_eofbit
, 6, 18, FALSE
},
6438 {type_ldbl
, "-1.69781699841e1475", 0, 6, /* -INF */ 4, IOSTATE_eofbit
, 6, 19, FALSE
},
6440 {type_sbf
, "", FLAGS_skipws
, 6, /* "" */ 0, IOSTATE_faileof
, 6, 0, FALSE
},
6441 {type_sbf
, " ", FLAGS_skipws
, 6, /* "" */ 0, IOSTATE_faileof
, 6, 2, FALSE
},
6442 {type_sbf
, "\r\nabcd\n", FLAGS_skipws
, 6, /* "abc\n" */ 1, IOSTATE_goodbit
, 6, 8, FALSE
},
6443 {type_sbf
, "abcdefg\n", 0, 6, /* "abcde" */ 2, IOSTATE_failbit
, 6, 9, FALSE
},
6444 {type_sbf
, "abcdefg\n", 0, 0, /* "" */ 0, IOSTATE_failbit
, 0, 9, FALSE
}
6447 pssb
= call_func2(p_strstreambuf_dynamic_ctor
, &ssb_test
, 64);
6448 ok(pssb
== &ssb_test
, "wrong return, expected %p got %p\n", &ssb_test
, pssb
);
6449 ret
= (int) call_func1(p_streambuf_allocate
, &ssb_test
.base
);
6450 ok(ret
== 1, "expected 1 got %d\n", ret
);
6451 ssb_test
.dynamic
= 0;
6452 pssb
= call_func2(p_strstreambuf_dynamic_ctor
, &ssb
, 64);
6453 ok(pssb
== &ssb
, "wrong return, expected %p got %p\n", &ssb
, pssb
);
6454 ret
= (int) call_func1(p_streambuf_allocate
, &ssb
.base
);
6455 ok(ret
== 1, "expected 1 got %d\n", ret
);
6456 pis
= call_func3(p_istream_sb_ctor
, &is
, &ssb
.base
, TRUE
);
6457 ok(pis
== &is
, "wrong return, expected %p got %p\n", &is
, pis
);
6459 for (i
= 0; i
< ARRAY_SIZE(tests
); i
++) {
6460 len
= strlen(tests
[i
].stream_content
);
6461 is
.base_ios
.state
= IOSTATE_goodbit
;
6462 is
.base_ios
.flags
= tests
[i
].flags
;
6463 is
.base_ios
.width
= tests
[i
].width
;
6464 ssb
.base
.eback
= ssb
.base
.gptr
= ssb
.base
.base
;
6465 ssb
.base
.egptr
= ssb
.base
.base
+ len
;
6466 memcpy(ssb
.base
.base
, tests
[i
].stream_content
, len
);
6468 switch (tests
[i
].type
) {
6471 pis
= call_func2(p_istream_read_char
, &is
, &c
);
6472 ok(c
== char_out
[tests
[i
].expected_val
], "Test %d: expected %d got %d\n", i
,
6473 char_out
[tests
[i
].expected_val
], c
);
6476 memset(st
, 'A', sizeof(st
));
6478 pis
= call_func2(p_istream_read_str
, &is
, st
);
6479 ok(!strcmp(st
, str_out
[tests
[i
].expected_val
]), "Test %d: expected %s got %s\n", i
,
6480 str_out
[tests
[i
].expected_val
], st
);
6484 pis
= call_func2(p_istream_read_short
, &is
, &s
);
6485 ok(s
== short_out
[tests
[i
].expected_val
], "Test %d: expected %hd got %hd\n", i
,
6486 short_out
[tests
[i
].expected_val
], s
);
6490 pis
= call_func2(p_istream_read_unsigned_short
, &is
, &us
);
6491 ok(us
== ushort_out
[tests
[i
].expected_val
], "Test %d: expected %hu got %hu\n", i
,
6492 ushort_out
[tests
[i
].expected_val
], us
);
6496 pis
= call_func2(p_istream_read_int
, &is
, &n
);
6497 ok(n
== int_out
[tests
[i
].expected_val
], "Test %d: expected %d got %d\n", i
,
6498 int_out
[tests
[i
].expected_val
], n
);
6502 pis
= call_func2(p_istream_read_unsigned_int
, &is
, &un
);
6503 ok(un
== uint_out
[tests
[i
].expected_val
], "Test %d: expected %u got %u\n", i
,
6504 uint_out
[tests
[i
].expected_val
], un
);
6508 pis
= call_func2(p_istream_read_long
, &is
, &l
);
6509 ok(l
== long_out
[tests
[i
].expected_val
], "Test %d: expected %d got %d\n", i
,
6510 long_out
[tests
[i
].expected_val
], l
);
6514 pis
= call_func2(p_istream_read_unsigned_long
, &is
, &ul
);
6515 ok(ul
== ulong_out
[tests
[i
].expected_val
], "Test %d: expected %u got %u\n", i
,
6516 ulong_out
[tests
[i
].expected_val
], ul
);
6520 pis
= call_func2(p_istream_read_float
, &is
, &f
);
6521 ok(f
== float_out
[tests
[i
].expected_val
], "Test %d: expected %f got %f\n", i
,
6522 float_out
[tests
[i
].expected_val
], f
);
6526 pis
= call_func2(p_istream_read_double
, &is
, &d
);
6527 ok(d
== double_out
[tests
[i
].expected_val
], "Test %d: expected %f got %f\n", i
,
6528 double_out
[tests
[i
].expected_val
], d
);
6532 pis
= call_func2(p_istream_read_long_double
, &is
, &d
);
6533 ok(d
== double_out
[tests
[i
].expected_val
], "Test %d: expected %f got %f\n", i
,
6534 double_out
[tests
[i
].expected_val
], d
);
6537 ssb_test
.base
.pbase
= ssb_test
.base
.pptr
= ssb_test
.base
.base
;
6538 ssb_test
.base
.epptr
= ssb_test
.base
.base
+ tests
[i
].width
;
6539 pis
= call_func2(p_istream_read_streambuf
, &is
, &ssb_test
.base
);
6540 len
= strlen(sbf_out
[tests
[i
].expected_val
]);
6541 ok(ssb_test
.base
.pptr
== ssb_test
.base
.pbase
+ len
, "Test %d: wrong put pointer, expected %p got %p\n",
6542 i
, ssb_test
.base
.pbase
+ len
, ssb_test
.base
.pptr
);
6543 ok(!strncmp(ssb_test
.base
.pbase
, sbf_out
[tests
[i
].expected_val
], len
),
6544 "Test %d: expected %s got %s\n", i
, sbf_out
[tests
[i
].expected_val
], ssb_test
.base
.pbase
);
6548 ok(pis
== &is
, "Test %d: wrong return, expected %p got %p\n", i
, &is
, pis
);
6549 ok(is
.base_ios
.state
== tests
[i
].expected_state
|| /* xp, 2k3 */ broken(tests
[i
].broken
),
6550 "Test %d: expected %d got %d\n", i
, tests
[i
].expected_state
, is
.base_ios
.state
);
6551 ok(is
.base_ios
.width
== tests
[i
].expected_width
, "Test %d: expected %d got %d\n", i
,
6552 tests
[i
].expected_width
, is
.base_ios
.width
);
6553 ok(ssb
.base
.gptr
== ssb
.base
.base
+ tests
[i
].expected_offset
||
6554 /* xp, 2k3 */ broken(tests
[i
].broken
), "Test %d: expected %p got %p\n", i
,
6555 ssb
.base
.base
+ tests
[i
].expected_offset
, ssb
.base
.gptr
);
6558 ssb_test
.dynamic
= 1;
6559 call_func1(p_istream_vbase_dtor
, &is
);
6560 call_func1(p_strstreambuf_dtor
, &ssb
);
6561 call_func1(p_strstreambuf_dtor
, &ssb_test
);
6564 static void test_istream_withassign(void)
6566 istream isa1
, isa2
, *pisa
;
6570 memset(&isa1
, 0xab, sizeof(istream
));
6571 memset(&isa2
, 0xab, sizeof(istream
));
6573 /* constructors/destructors */
6574 pisa
= call_func3(p_istream_withassign_sb_ctor
, &isa1
, NULL
, TRUE
);
6575 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
6576 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
6577 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
6578 ok(isa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.sb
);
6579 ok(isa1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, isa1
.base_ios
.state
);
6580 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
6581 ok(isa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.tie
);
6582 ok(isa1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa1
.base_ios
.flags
);
6583 ok(isa1
.base_ios
.precision
== 6, "expected 6 got %d\n", isa1
.base_ios
.precision
);
6584 ok(isa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa1
.base_ios
.fill
);
6585 ok(isa1
.base_ios
.width
== 0, "expected 0 got %d\n", isa1
.base_ios
.width
);
6586 ok(isa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", isa1
.base_ios
.do_lock
);
6587 call_func1(p_istream_withassign_vbase_dtor
, &isa1
);
6588 isa1
.extract_delim
= isa1
.count
= 0xabababab;
6589 memset(&isa1
.base_ios
, 0xab, sizeof(ios
));
6590 isa1
.base_ios
.delbuf
= 0;
6591 pisa
= call_func3(p_istream_withassign_sb_ctor
, &isa1
, NULL
, FALSE
);
6592 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
6593 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
6594 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
6595 ok(isa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.sb
);
6596 ok(isa1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
6597 0xabababab|IOSTATE_badbit
, isa1
.base_ios
.state
);
6598 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
6599 ok(isa1
.base_ios
.tie
== isa2
.base_ios
.tie
, "expected %p got %p\n", isa2
.base_ios
.tie
, isa1
.base_ios
.tie
);
6600 ok(isa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, isa1
.base_ios
.flags
);
6601 ok(isa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.precision
);
6602 ok(isa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", isa1
.base_ios
.fill
);
6603 ok(isa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.width
);
6604 ok(isa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.do_lock
);
6605 call_func1(p_istream_withassign_dtor
, &isa1
.base_ios
);
6606 isa1
.extract_delim
= isa1
.count
= 0xabababab;
6607 memset(&isa1
.base_ios
, 0xab, sizeof(ios
));
6608 pisa
= call_func3(p_istream_withassign_sb_ctor
, &isa1
, &sb
, TRUE
);
6609 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
6610 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
6611 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
6612 ok(isa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, isa1
.base_ios
.sb
);
6613 ok(isa1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, isa1
.base_ios
.state
);
6614 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
6615 ok(isa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.tie
);
6616 ok(isa1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa1
.base_ios
.flags
);
6617 ok(isa1
.base_ios
.precision
== 6, "expected 6 got %d\n", isa1
.base_ios
.precision
);
6618 ok(isa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa1
.base_ios
.fill
);
6619 ok(isa1
.base_ios
.width
== 0, "expected 0 got %d\n", isa1
.base_ios
.width
);
6620 ok(isa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", isa1
.base_ios
.do_lock
);
6621 call_func1(p_istream_withassign_vbase_dtor
, &isa1
);
6622 isa1
.extract_delim
= isa1
.count
= 0xabababab;
6623 memset(&isa1
.base_ios
, 0xab, sizeof(ios
));
6624 isa1
.base_ios
.delbuf
= 0;
6625 isa1
.base_ios
.state
= 0xabababab | IOSTATE_badbit
;
6626 pisa
= call_func3(p_istream_withassign_sb_ctor
, &isa1
, &sb
, FALSE
);
6627 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
6628 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
6629 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
6630 ok(isa1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, isa1
.base_ios
.sb
);
6631 ok(isa1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.state
);
6632 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
6633 ok(isa1
.base_ios
.tie
== isa2
.base_ios
.tie
, "expected %p got %p\n", isa2
.base_ios
.tie
, isa1
.base_ios
.tie
);
6634 ok(isa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, isa1
.base_ios
.flags
);
6635 ok(isa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.precision
);
6636 ok(isa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", isa1
.base_ios
.fill
);
6637 ok(isa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.width
);
6638 ok(isa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.do_lock
);
6639 call_func1(p_istream_withassign_dtor
, &isa1
.base_ios
);
6640 isa1
.extract_delim
= isa1
.count
= 0xabababab;
6641 pisa
= call_func2(p_istream_withassign_ctor
, &isa1
, TRUE
);
6642 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
6643 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
6644 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
6645 ok(isa1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.sb
);
6646 ok(isa1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, isa1
.base_ios
.state
);
6647 ok(isa1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa1
.base_ios
.delbuf
);
6648 ok(isa1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa1
.base_ios
.tie
);
6649 ok(isa1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa1
.base_ios
.flags
);
6650 ok(isa1
.base_ios
.precision
== 6, "expected 6 got %d\n", isa1
.base_ios
.precision
);
6651 ok(isa1
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa1
.base_ios
.fill
);
6652 ok(isa1
.base_ios
.width
== 0, "expected 0 got %d\n", isa1
.base_ios
.width
);
6653 ok(isa1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", isa1
.base_ios
.do_lock
);
6654 call_func1(p_istream_withassign_vbase_dtor
, &isa1
);
6655 isa1
.extract_delim
= isa1
.count
= 0xabababab;
6656 memset(&isa1
.base_ios
, 0xab, sizeof(ios
));
6657 pisa
= call_func2(p_istream_withassign_ctor
, &isa1
, FALSE
);
6658 ok(pisa
== &isa1
, "wrong return, expected %p got %p\n", &isa1
, pisa
);
6659 ok(isa1
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
6660 ok(isa1
.count
== 0, "expected 0 got %d\n", isa1
.count
);
6661 ok(isa1
.base_ios
.sb
== isa2
.base_ios
.sb
, "expected %p got %p\n", isa2
.base_ios
.sb
, isa1
.base_ios
.sb
);
6662 ok(isa1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.state
);
6663 ok(isa1
.base_ios
.delbuf
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.delbuf
);
6664 ok(isa1
.base_ios
.tie
== isa2
.base_ios
.tie
, "expected %p got %p\n", isa2
.base_ios
.tie
, isa1
.base_ios
.tie
);
6665 ok(isa1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, isa1
.base_ios
.flags
);
6666 ok(isa1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.precision
);
6667 ok(isa1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", isa1
.base_ios
.fill
);
6668 ok(isa1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.width
);
6669 ok(isa1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa1
.base_ios
.do_lock
);
6670 call_func1(p_istream_withassign_dtor
, &isa1
.base_ios
);
6671 isa1
.extract_delim
= isa1
.count
= 0xcdcdcdcd;
6672 memset(&isa1
.base_ios
, 0xcd, sizeof(ios
));
6673 pisa
= call_func3(p_istream_withassign_copy_ctor
, &isa2
, &isa1
, TRUE
);
6674 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
6675 ok(isa2
.extract_delim
== 0, "expected 0 got %d\n", isa1
.extract_delim
);
6676 ok(isa2
.count
== 0, "expected 0 got %d\n", isa1
.count
);
6677 ok(isa2
.base_ios
.sb
== isa1
.base_ios
.sb
, "expected %p got %p\n", isa1
.base_ios
.sb
, isa2
.base_ios
.sb
);
6678 ok(isa2
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, isa2
.base_ios
.state
);
6679 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
6680 ok(isa2
.base_ios
.tie
== isa1
.base_ios
.tie
, "expected %p got %p\n", isa1
.base_ios
.tie
, isa2
.base_ios
.tie
);
6681 ok(isa2
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, isa2
.base_ios
.flags
);
6682 ok(isa2
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", isa2
.base_ios
.precision
);
6683 ok(isa2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", isa2
.base_ios
.fill
);
6684 ok(isa2
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", isa2
.base_ios
.width
);
6685 ok(isa2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", isa2
.base_ios
.do_lock
);
6686 call_func1(p_istream_withassign_vbase_dtor
, &isa2
);
6687 isa1
.base_ios
.sb
= NULL
;
6688 isa2
.extract_delim
= isa2
.count
= 0xabababab;
6689 memset(&isa2
.base_ios
, 0xab, sizeof(ios
));
6690 isa2
.base_ios
.delbuf
= 0;
6691 isa2
.base_ios
.flags
&= ~FLAGS_skipws
;
6692 pos
= isa2
.base_ios
.tie
;
6693 pisa
= call_func3(p_istream_withassign_copy_ctor
, &isa2
, &isa1
, FALSE
);
6694 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
6695 ok(isa2
.extract_delim
== 0, "expected 0 got %d\n", isa2
.extract_delim
);
6696 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
6697 ok(isa2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.sb
);
6698 ok(isa2
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
6699 0xabababab|IOSTATE_badbit
, isa2
.base_ios
.state
);
6700 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
6701 ok(isa2
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, isa2
.base_ios
.tie
);
6702 ok(isa2
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, isa2
.base_ios
.flags
);
6703 ok(isa2
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.precision
);
6704 ok(isa2
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", isa2
.base_ios
.fill
);
6705 ok(isa2
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.width
);
6706 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
6707 call_func1(p_istream_withassign_dtor
, &isa2
.base_ios
);
6710 isa2
.extract_delim
= isa2
.count
= 0xabababab;
6711 isa2
.base_ios
.delbuf
= 0xabababab;
6712 pisa
= call_func2(p_istream_withassign_assign_sb
, &isa2
, &sb
);
6713 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
6714 ok(isa2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.extract_delim
);
6715 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
6716 ok(isa2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, isa2
.base_ios
.sb
);
6717 ok(isa2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, isa2
.base_ios
.state
);
6718 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
6719 ok(isa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.tie
);
6720 ok(isa2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa2
.base_ios
.flags
);
6721 ok(isa2
.base_ios
.precision
== 6, "expected 6 got %d\n", isa2
.base_ios
.precision
);
6722 ok(isa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa2
.base_ios
.fill
);
6723 ok(isa2
.base_ios
.width
== 0, "expected 0 got %d\n", isa2
.base_ios
.width
);
6724 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
6725 isa2
.count
= 0xabababab;
6726 memset(&isa2
.base_ios
, 0xab, sizeof(ios
));
6727 isa2
.base_ios
.delbuf
= 0;
6728 pisa
= call_func2(p_istream_withassign_assign_sb
, &isa2
, NULL
);
6729 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
6730 ok(isa2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.extract_delim
);
6731 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
6732 ok(isa2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.sb
);
6733 ok(isa2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, isa2
.base_ios
.state
);
6734 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
6735 ok(isa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.tie
);
6736 ok(isa2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa2
.base_ios
.flags
);
6737 ok(isa2
.base_ios
.precision
== 6, "expected 6 got %d\n", isa2
.base_ios
.precision
);
6738 ok(isa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa2
.base_ios
.fill
);
6739 ok(isa2
.base_ios
.width
== 0, "expected 0 got %d\n", isa2
.base_ios
.width
);
6740 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
6741 isa2
.count
= 0xabababab;
6742 memset(&isa2
.base_ios
, 0xab, sizeof(ios
));
6743 isa2
.base_ios
.delbuf
= 0;
6744 pisa
= call_func2(p_istream_withassign_assign_is
, &isa2
, &isa1
);
6745 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
6746 ok(isa2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.extract_delim
);
6747 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
6748 ok(isa2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.sb
);
6749 ok(isa2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, isa2
.base_ios
.state
);
6750 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
6751 ok(isa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.tie
);
6752 ok(isa2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa2
.base_ios
.flags
);
6753 ok(isa2
.base_ios
.precision
== 6, "expected 6 got %d\n", isa2
.base_ios
.precision
);
6754 ok(isa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa2
.base_ios
.fill
);
6755 ok(isa2
.base_ios
.width
== 0, "expected 0 got %d\n", isa2
.base_ios
.width
);
6756 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
6757 isa1
.base_ios
.sb
= &sb
;
6758 isa2
.count
= 0xabababab;
6759 memset(&isa2
.base_ios
, 0xab, sizeof(ios
));
6760 isa2
.base_ios
.delbuf
= 0;
6761 pisa
= call_func2(p_istream_withassign_assign
, &isa2
, &isa1
);
6762 ok(pisa
== &isa2
, "wrong return, expected %p got %p\n", &isa2
, pisa
);
6763 ok(isa2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.extract_delim
);
6764 ok(isa2
.count
== 0, "expected 0 got %d\n", isa2
.count
);
6765 ok(isa2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, isa2
.base_ios
.sb
);
6766 ok(isa2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, isa2
.base_ios
.state
);
6767 ok(isa2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", isa2
.base_ios
.delbuf
);
6768 ok(isa2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, isa2
.base_ios
.tie
);
6769 ok(isa2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, isa2
.base_ios
.flags
);
6770 ok(isa2
.base_ios
.precision
== 6, "expected 6 got %d\n", isa2
.base_ios
.precision
);
6771 ok(isa2
.base_ios
.fill
== ' ', "expected 32 got %d\n", isa2
.base_ios
.fill
);
6772 ok(isa2
.base_ios
.width
== 0, "expected 0 got %d\n", isa2
.base_ios
.width
);
6773 ok(isa2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, isa2
.base_ios
.do_lock
);
6776 static void test_istrstream(void)
6778 istream is1
, is2
, *pis
;
6783 memset(&is1
, 0xab, sizeof(istream
));
6784 memset(&is2
, 0xab, sizeof(istream
));
6786 /* constructors/destructors */
6787 pis
= call_func4(p_istrstream_buffer_ctor
, &is1
, buffer
, 32, TRUE
);
6788 pssb
= (strstreambuf
*) is1
.base_ios
.sb
;
6789 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
6790 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
6791 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
6792 ok(is1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, is1
.base_ios
.sb
);
6793 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
6794 ok(is1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", is1
.base_ios
.delbuf
);
6795 ok(is1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.tie
);
6796 ok(is1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, is1
.base_ios
.flags
);
6797 ok(is1
.base_ios
.precision
== 6, "expected 6 got %d\n", is1
.base_ios
.precision
);
6798 ok(is1
.base_ios
.fill
== ' ', "expected 32 got %d\n", is1
.base_ios
.fill
);
6799 ok(is1
.base_ios
.width
== 0, "expected 0 got %d\n", is1
.base_ios
.width
);
6800 ok(is1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", is1
.base_ios
.do_lock
);
6801 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
6802 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
6803 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
6804 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
6805 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
6806 ok(pssb
->base
.ebuf
== buffer
+ 32, "wrong buffer end, expected %p got %p\n", buffer
+ 32, pssb
->base
.ebuf
);
6807 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
6808 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
6809 ok(pssb
->base
.egptr
== buffer
+ 32, "wrong get end, expected %p got %p\n", buffer
+ 32, pssb
->base
.egptr
);
6810 ok(pssb
->base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, pssb
->base
.pbase
);
6811 ok(pssb
->base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, pssb
->base
.pptr
);
6812 ok(pssb
->base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, pssb
->base
.epptr
);
6813 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
6814 call_func1(p_istrstream_vbase_dtor
, &is1
);
6815 ok(is1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.sb
);
6816 ok(is1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is1
.base_ios
.state
);
6817 memset(&is1
, 0xab, sizeof(istream
));
6818 pis
= call_func4(p_istrstream_buffer_ctor
, &is1
, NULL
, -1, TRUE
);
6819 pssb
= (strstreambuf
*) is1
.base_ios
.sb
;
6820 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
6821 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
6822 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
6823 ok(is1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, is1
.base_ios
.sb
);
6824 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
6825 ok(is1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", is1
.base_ios
.delbuf
);
6826 ok(is1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.tie
);
6827 ok(is1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, is1
.base_ios
.flags
);
6828 ok(is1
.base_ios
.precision
== 6, "expected 6 got %d\n", is1
.base_ios
.precision
);
6829 ok(is1
.base_ios
.fill
== ' ', "expected 32 got %d\n", is1
.base_ios
.fill
);
6830 ok(is1
.base_ios
.width
== 0, "expected 0 got %d\n", is1
.base_ios
.width
);
6831 ok(is1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", is1
.base_ios
.do_lock
);
6832 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
6833 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
6834 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
6835 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
6836 ok(pssb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pssb
->base
.base
);
6837 ok(pssb
->base
.ebuf
== (char*) 0x7fffffff || pssb
->base
.ebuf
== (char*) -1,
6838 "wrong buffer end, expected 0x7fffffff or -1, got %p\n", pssb
->base
.ebuf
);
6839 ok(pssb
->base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, pssb
->base
.eback
);
6840 ok(pssb
->base
.gptr
== NULL
, "wrong get pointer, expected %p got %p\n", NULL
, pssb
->base
.gptr
);
6841 ok(pssb
->base
.egptr
== (char*) 0x7fffffff || pssb
->base
.egptr
== (char*) -1,
6842 "wrong get end, expected 0x7fffffff or -1, got %p\n", pssb
->base
.egptr
);
6843 ok(pssb
->base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, pssb
->base
.pbase
);
6844 ok(pssb
->base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, pssb
->base
.pptr
);
6845 ok(pssb
->base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, pssb
->base
.epptr
);
6846 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
6847 call_func1(p_istrstream_vbase_dtor
, &is1
);
6848 ok(is1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.sb
);
6849 ok(is1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is1
.base_ios
.state
);
6850 is1
.extract_delim
= is1
.count
= 0xabababab;
6851 memset(&is1
.base_ios
, 0xab, sizeof(ios
));
6852 is1
.base_ios
.delbuf
= 0;
6853 strcpy(buffer
, "Test");
6854 pis
= call_func4(p_istrstream_buffer_ctor
, &is1
, buffer
, 0, FALSE
);
6855 pssb
= (strstreambuf
*) is1
.base_ios
.sb
;
6856 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
6857 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
6858 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
6859 ok(is1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, is1
.base_ios
.sb
);
6860 ok(is1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.state
);
6861 ok(is1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", is1
.base_ios
.delbuf
);
6862 ok(is1
.base_ios
.tie
== is2
.base_ios
.tie
, "expected %p got %p\n", is2
.base_ios
.tie
, is1
.base_ios
.tie
);
6863 ok(is1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, is1
.base_ios
.flags
);
6864 ok(is1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.precision
);
6865 ok(is1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", is1
.base_ios
.fill
);
6866 ok(is1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.width
);
6867 ok(is1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.do_lock
);
6868 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
6869 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
6870 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
6871 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
6872 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
6873 ok(pssb
->base
.ebuf
== buffer
+ 4, "wrong buffer end, expected %p got %p\n", buffer
+ 4, pssb
->base
.ebuf
);
6874 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
6875 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
6876 ok(pssb
->base
.egptr
== buffer
+ 4, "wrong get end, expected %p got %p\n", buffer
+ 4, pssb
->base
.egptr
);
6877 ok(pssb
->base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, pssb
->base
.pbase
);
6878 ok(pssb
->base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, pssb
->base
.pptr
);
6879 ok(pssb
->base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, pssb
->base
.epptr
);
6880 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
6881 call_func1(p_istrstream_dtor
, &is1
.base_ios
);
6882 ok(is1
.base_ios
.sb
== &pssb
->base
, "expected %p got %p\n", &pssb
->base
, is1
.base_ios
.sb
);
6883 ok(is1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.state
);
6884 call_func1(p_strstreambuf_dtor
, pssb
);
6885 p_operator_delete(pssb
);
6887 memset(&is1
, 0xab, sizeof(istream
));
6889 pis
= call_func3(p_istrstream_str_ctor
, &is1
, buffer
, TRUE
);
6890 pssb
= (strstreambuf
*) is1
.base_ios
.sb
;
6891 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
6892 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
6893 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
6894 ok(is1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, is1
.base_ios
.sb
);
6895 ok(is1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is1
.base_ios
.state
);
6896 ok(is1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", is1
.base_ios
.delbuf
);
6897 ok(is1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.tie
);
6898 ok(is1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, is1
.base_ios
.flags
);
6899 ok(is1
.base_ios
.precision
== 6, "expected 6 got %d\n", is1
.base_ios
.precision
);
6900 ok(is1
.base_ios
.fill
== ' ', "expected 32 got %d\n", is1
.base_ios
.fill
);
6901 ok(is1
.base_ios
.width
== 0, "expected 0 got %d\n", is1
.base_ios
.width
);
6902 ok(is1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", is1
.base_ios
.do_lock
);
6903 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
6904 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
6905 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
6906 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
6907 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
6908 ok(pssb
->base
.ebuf
== buffer
, "wrong buffer end, expected %p got %p\n", buffer
, pssb
->base
.ebuf
);
6909 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
6910 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
6911 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
6912 ok(pssb
->base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, pssb
->base
.pbase
);
6913 ok(pssb
->base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, pssb
->base
.pptr
);
6914 ok(pssb
->base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, pssb
->base
.epptr
);
6915 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
6916 call_func1(p_istrstream_vbase_dtor
, &is1
);
6917 ok(is1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is1
.base_ios
.sb
);
6918 ok(is1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is1
.base_ios
.state
);
6919 if (0) /* crashes on native */
6920 pis
= call_func3(p_istrstream_str_ctor
, &is1
, NULL
, TRUE
);
6921 is1
.extract_delim
= is1
.count
= 0xabababab;
6922 memset(&is1
.base_ios
, 0xab, sizeof(ios
));
6923 is1
.base_ios
.delbuf
= 0;
6924 pis
= call_func3(p_istrstream_str_ctor
, &is1
, buffer
, FALSE
);
6925 pssb
= (strstreambuf
*) is1
.base_ios
.sb
;
6926 ok(pis
== &is1
, "wrong return, expected %p got %p\n", &is1
, pis
);
6927 ok(is1
.extract_delim
== 0, "expected 0 got %d\n", is1
.extract_delim
);
6928 ok(is1
.count
== 0, "expected 0 got %d\n", is1
.count
);
6929 ok(is1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, is1
.base_ios
.sb
);
6930 ok(is1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.state
);
6931 ok(is1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", is1
.base_ios
.delbuf
);
6932 ok(is1
.base_ios
.tie
== is2
.base_ios
.tie
, "expected %p got %p\n", is2
.base_ios
.tie
, is1
.base_ios
.tie
);
6933 ok(is1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, is1
.base_ios
.flags
);
6934 ok(is1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.precision
);
6935 ok(is1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", is1
.base_ios
.fill
);
6936 ok(is1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.width
);
6937 ok(is1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.do_lock
);
6938 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
6939 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
6940 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
6941 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
6942 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
6943 ok(pssb
->base
.ebuf
== buffer
, "wrong buffer end, expected %p got %p\n", buffer
, pssb
->base
.ebuf
);
6944 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
6945 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
6946 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
6947 ok(pssb
->base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, pssb
->base
.pbase
);
6948 ok(pssb
->base
.pptr
== NULL
, "wrong put pointer, expected %p got %p\n", NULL
, pssb
->base
.pptr
);
6949 ok(pssb
->base
.epptr
== NULL
, "wrong put end, expected %p got %p\n", NULL
, pssb
->base
.epptr
);
6950 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
6951 call_func1(p_istrstream_dtor
, &is1
.base_ios
);
6952 ok(is1
.base_ios
.sb
== &pssb
->base
, "expected %p got %p\n", &pssb
->base
, is1
.base_ios
.sb
);
6953 ok(is1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is1
.base_ios
.state
);
6954 call_func1(p_strstreambuf_dtor
, pssb
);
6955 p_operator_delete(pssb
);
6957 is1
.extract_delim
= is1
.count
= 0xcdcdcdcd;
6958 memset(&is1
.base_ios
, 0xcd, sizeof(ios
));
6959 pis
= call_func3(p_istrstream_copy_ctor
, &is2
, &is1
, TRUE
);
6960 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
6961 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
6962 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
6963 ok(is2
.base_ios
.sb
== is1
.base_ios
.sb
, "expected %p got %p\n", is1
.base_ios
.sb
, is2
.base_ios
.sb
);
6964 ok(is2
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, is2
.base_ios
.state
);
6965 ok(is2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", is2
.base_ios
.delbuf
);
6966 ok(is2
.base_ios
.tie
== is1
.base_ios
.tie
, "expected %p got %p\n", is1
.base_ios
.tie
, is2
.base_ios
.tie
);
6967 ok(is2
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, is2
.base_ios
.flags
);
6968 ok(is2
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", is2
.base_ios
.precision
);
6969 ok(is2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", is2
.base_ios
.fill
);
6970 ok(is2
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", is2
.base_ios
.width
);
6971 ok(is2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", is2
.base_ios
.do_lock
);
6972 call_func1(p_istrstream_vbase_dtor
, &is2
);
6973 ok(is2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.sb
);
6974 ok(is2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, is2
.base_ios
.state
);
6975 is2
.extract_delim
= is2
.count
= 0xabababab;
6976 memset(&is2
.base_ios
, 0xab, sizeof(ios
));
6977 is2
.base_ios
.delbuf
= 0;
6978 pos
= is2
.base_ios
.tie
;
6979 pis
= call_func3(p_istrstream_copy_ctor
, &is2
, &is1
, FALSE
);
6980 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
6981 ok(is2
.extract_delim
== 0, "expected 0 got %d\n", is2
.extract_delim
);
6982 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
6983 ok(is2
.base_ios
.sb
== is1
.base_ios
.sb
, "expected %p got %p\n", is1
.base_ios
.sb
, is2
.base_ios
.sb
);
6984 ok(is2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.state
);
6985 ok(is2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", is2
.base_ios
.delbuf
);
6986 ok(is2
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, is2
.base_ios
.tie
);
6987 ok(is2
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, is2
.base_ios
.flags
);
6988 ok(is2
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.precision
);
6989 ok(is2
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", is2
.base_ios
.fill
);
6990 ok(is2
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.width
);
6991 ok(is2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.do_lock
);
6992 call_func1(p_istrstream_dtor
, &is2
.base_ios
);
6995 is2
.extract_delim
= is2
.count
= 0xabababab;
6996 memset(&is2
.base_ios
, 0xab, sizeof(ios
));
6997 is2
.base_ios
.delbuf
= 0;
6998 pis
= call_func2(p_istrstream_assign
, &is2
, &is1
);
6999 ok(pis
== &is2
, "wrong return, expected %p got %p\n", &is2
, pis
);
7000 ok(is2
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.extract_delim
);
7001 ok(is2
.count
== 0, "expected 0 got %d\n", is2
.count
);
7002 ok(is2
.base_ios
.sb
== is1
.base_ios
.sb
, "expected %p got %p\n", is1
.base_ios
.sb
, is2
.base_ios
.sb
);
7003 ok(is2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, is2
.base_ios
.state
);
7004 ok(is2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", is2
.base_ios
.delbuf
);
7005 ok(is2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, is2
.base_ios
.tie
);
7006 ok(is2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, is2
.base_ios
.flags
);
7007 ok(is2
.base_ios
.precision
== 6, "expected 6 got %d\n", is2
.base_ios
.precision
);
7008 ok(is2
.base_ios
.fill
== ' ', "expected 32 got %d\n", is2
.base_ios
.fill
);
7009 ok(is2
.base_ios
.width
== 0, "expected 0 got %d\n", is2
.base_ios
.width
);
7010 ok(is2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, is2
.base_ios
.do_lock
);
7013 static void test_iostream(void)
7015 iostream ios1
, ios2
, *pios
;
7019 memset(&ios1
, 0xab, sizeof(iostream
));
7020 memset(&ios2
, 0xab, sizeof(iostream
));
7022 /* constructors/destructors */
7023 pios
= call_func3(p_iostream_sb_ctor
, &ios1
, NULL
, TRUE
);
7024 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7025 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7026 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7027 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7028 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7029 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7030 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
7031 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7032 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7033 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7034 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7035 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7036 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7037 call_func1(p_iostream_vbase_dtor
, &ios1
);
7038 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
7039 ios1
.base2
.unknown
= 0xabababab;
7040 memset(&ios1
.base_ios
, 0xab, sizeof(ios
));
7041 ios1
.base_ios
.delbuf
= 0;
7042 pios
= call_func3(p_iostream_sb_ctor
, &ios1
, NULL
, FALSE
);
7043 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7044 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7045 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7046 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7047 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7048 ok(ios1
.base_ios
.state
== (0xabababab|IOSTATE_badbit
), "expected %d got %d\n",
7049 0xabababab|IOSTATE_badbit
, ios1
.base_ios
.state
);
7050 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
7051 ok(ios1
.base_ios
.tie
== ios2
.base_ios
.tie
, "expected %p got %p\n", ios2
.base_ios
.tie
, ios1
.base_ios
.tie
);
7052 ok(ios1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios1
.base_ios
.flags
);
7053 ok(ios1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.precision
);
7054 ok(ios1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios1
.base_ios
.fill
);
7055 ok(ios1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.width
);
7056 ok(ios1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.do_lock
);
7057 call_func1(p_iostream_dtor
, &ios1
.base_ios
);
7058 memset(&ios1
, 0xab, sizeof(iostream
));
7059 pios
= call_func3(p_iostream_sb_ctor
, &ios1
, &sb
, TRUE
);
7060 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7061 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7062 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7063 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7064 ok(ios1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios1
.base_ios
.sb
);
7065 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
7066 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
7067 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7068 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7069 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7070 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7071 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7072 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7073 call_func1(p_iostream_vbase_dtor
, &ios1
);
7074 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7075 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7076 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
7077 ios1
.base2
.unknown
= 0xabababab;
7078 memset(&ios1
.base_ios
, 0xab, sizeof(ios
));
7079 ios1
.base_ios
.delbuf
= 0;
7080 pios
= call_func3(p_iostream_sb_ctor
, &ios1
, &sb
, FALSE
);
7081 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7082 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7083 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7084 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7085 ok(ios1
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios1
.base_ios
.sb
);
7086 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
7087 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
7088 ok(ios1
.base_ios
.tie
== ios2
.base_ios
.tie
, "expected %p got %p\n", ios2
.base_ios
.tie
, ios1
.base_ios
.tie
);
7089 ok(ios1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios1
.base_ios
.flags
);
7090 ok(ios1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.precision
);
7091 ok(ios1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios1
.base_ios
.fill
);
7092 ok(ios1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.width
);
7093 ok(ios1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.do_lock
);
7094 call_func1(p_iostream_dtor
, &ios1
.base_ios
);
7095 memset(&ios1
, 0xab, sizeof(iostream
));
7096 pios
= call_func2(p_iostream_ctor
, &ios1
, TRUE
);
7097 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7098 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7099 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7100 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7101 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7102 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7103 ok(ios1
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios1
.base_ios
.delbuf
);
7104 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7105 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7106 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7107 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7108 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7109 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7110 call_func1(p_iostream_vbase_dtor
, &ios1
);
7111 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
7112 ios1
.base2
.unknown
= 0xabababab;
7113 memset(&ios1
.base_ios
, 0xab, sizeof(ios
));
7114 pios
= call_func2(p_iostream_ctor
, &ios1
, FALSE
);
7115 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7116 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7117 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7118 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7119 ok(ios1
.base_ios
.sb
== ios2
.base_ios
.sb
, "expected %p got %p\n", ios2
.base_ios
.sb
, ios1
.base_ios
.sb
);
7120 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
7121 ok(ios1
.base_ios
.delbuf
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.delbuf
);
7122 ok(ios1
.base_ios
.tie
== ios2
.base_ios
.tie
, "expected %p got %p\n", ios2
.base_ios
.tie
, ios1
.base_ios
.tie
);
7123 ok(ios1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios1
.base_ios
.flags
);
7124 ok(ios1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.precision
);
7125 ok(ios1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios1
.base_ios
.fill
);
7126 ok(ios1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.width
);
7127 ok(ios1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.do_lock
);
7128 call_func1(p_iostream_dtor
, &ios1
.base_ios
);
7129 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
7130 ios1
.base2
.unknown
= 0xabababab;
7131 memset(&ios2
, 0xcd, sizeof(iostream
));
7132 pios
= call_func3(p_iostream_copy_ctor
, &ios2
, &ios1
, TRUE
);
7133 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
7134 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
7135 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
7136 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
7137 ok(ios2
.base_ios
.sb
== ios1
.base_ios
.sb
, "expected %p got %p\n", ios1
.base_ios
.sb
, ios2
.base_ios
.sb
);
7138 ok(ios2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios2
.base_ios
.state
);
7139 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
7140 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
7141 ok(ios2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios2
.base_ios
.flags
);
7142 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
7143 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
7144 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
7145 ok(ios2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios2
.base_ios
.do_lock
);
7146 call_func1(p_iostream_vbase_dtor
, &ios2
);
7147 ios1
.base_ios
.sb
= NULL
;
7148 memset(&ios2
, 0xcd, sizeof(iostream
));
7149 pios
= call_func3(p_iostream_copy_ctor
, &ios2
, &ios1
, TRUE
);
7150 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
7151 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
7152 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
7153 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
7154 ok(ios2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.sb
);
7155 ok(ios2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios2
.base_ios
.state
);
7156 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
7157 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
7158 ok(ios2
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios2
.base_ios
.flags
);
7159 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
7160 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
7161 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
7162 ok(ios2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios2
.base_ios
.do_lock
);
7163 call_func1(p_iostream_vbase_dtor
, &ios2
);
7164 ios1
.base_ios
.sb
= &sb
;
7165 ios2
.base1
.extract_delim
= ios2
.base1
.count
= 0xcdcdcdcd;
7166 ios2
.base2
.unknown
= 0xcdcdcdcd;
7167 memset(&ios2
.base_ios
, 0xcd, sizeof(ios
));
7168 ios2
.base_ios
.delbuf
= 0;
7169 pos
= ios2
.base_ios
.tie
;
7170 pios
= call_func3(p_iostream_copy_ctor
, &ios2
, &ios1
, FALSE
);
7171 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
7172 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
7173 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
7174 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
7175 ok(ios2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios2
.base_ios
.sb
);
7176 ok(ios2
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, ios2
.base_ios
.state
);
7177 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
7178 ok(ios2
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, ios2
.base_ios
.tie
);
7179 ok(ios2
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, ios2
.base_ios
.flags
);
7180 ok(ios2
.base_ios
.precision
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.precision
);
7181 ok(ios2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", ios2
.base_ios
.fill
);
7182 ok(ios2
.base_ios
.width
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.width
);
7183 ok(ios2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.do_lock
);
7184 call_func1(p_iostream_dtor
, &ios2
.base_ios
);
7187 ios2
.base1
.extract_delim
= ios2
.base1
.count
= 0xcdcdcdcd;
7188 ios2
.base2
.unknown
= 0xcdcdcdcd;
7189 ios2
.base_ios
.sb
= (streambuf
*) 0xcdcdcdcd;
7190 ios2
.base_ios
.state
= 0xcdcdcdcd;
7191 pios
= call_func2(p_iostream_assign_sb
, &ios2
, &sb
);
7192 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
7193 ok(ios2
.base1
.extract_delim
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base1
.extract_delim
);
7194 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
7195 ok(ios2
.base2
.unknown
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base2
.unknown
);
7196 ok(ios2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios2
.base_ios
.sb
);
7197 ok(ios2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios2
.base_ios
.state
);
7198 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
7199 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
7200 ok(ios2
.base_ios
.flags
== 0, "expected 0 got %x\n", ios2
.base_ios
.flags
);
7201 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
7202 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
7203 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
7204 ok(ios2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.do_lock
);
7205 ios2
.base1
.count
= 0xcdcdcdcd;
7206 memset(&ios2
.base_ios
, 0xcd, sizeof(ios
));
7207 ios2
.base_ios
.delbuf
= 0;
7208 pios
= call_func2(p_iostream_assign_sb
, &ios2
, NULL
);
7209 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
7210 ok(ios2
.base1
.extract_delim
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base1
.extract_delim
);
7211 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
7212 ok(ios2
.base2
.unknown
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base2
.unknown
);
7213 ok(ios2
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.sb
);
7214 ok(ios2
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios2
.base_ios
.state
);
7215 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
7216 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
7217 ok(ios2
.base_ios
.flags
== 0, "expected 0 got %x\n", ios2
.base_ios
.flags
);
7218 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
7219 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
7220 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
7221 ok(ios2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.do_lock
);
7222 ios2
.base1
.count
= 0xcdcdcdcd;
7223 memset(&ios2
.base_ios
, 0xcd, sizeof(ios
));
7224 ios2
.base_ios
.delbuf
= 0;
7225 if (0) /* crashes on native */
7226 pios
= call_func2(p_iostream_assign
, &ios2
, NULL
);
7227 pios
= call_func2(p_iostream_assign
, &ios2
, &ios1
);
7228 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
7229 ok(ios2
.base1
.extract_delim
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base1
.extract_delim
);
7230 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
7231 ok(ios2
.base2
.unknown
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base2
.unknown
);
7232 ok(ios2
.base_ios
.sb
== &sb
, "expected %p got %p\n", &sb
, ios2
.base_ios
.sb
);
7233 ok(ios2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios2
.base_ios
.state
);
7234 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
7235 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
7236 ok(ios2
.base_ios
.flags
== 0, "expected 0 got %x\n", ios2
.base_ios
.flags
);
7237 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
7238 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
7239 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
7240 ok(ios2
.base_ios
.do_lock
== 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, ios2
.base_ios
.do_lock
);
7243 static void test_ifstream(void)
7245 const char *filename
= "ifstream_test";
7246 istream ifs
, ifs_copy
, *pifs
;
7253 memset(&ifs
, 0xab, sizeof(istream
));
7255 /* constructors/destructors */
7256 pifs
= call_func2(p_ifstream_ctor
, &ifs
, TRUE
);
7257 pfb
= (filebuf
*) ifs
.base_ios
.sb
;
7258 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7259 ok(ifs
.extract_delim
== 0, "expected 0 got %d\n", ifs
.extract_delim
);
7260 ok(ifs
.count
== 0, "expected 0 got %d\n", ifs
.count
);
7261 ok(ifs
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ifs
.base_ios
.sb
);
7262 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7263 ok(ifs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ifs
.base_ios
.delbuf
);
7264 ok(ifs
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ifs
.base_ios
.tie
);
7265 ok(ifs
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ifs
.base_ios
.flags
);
7266 ok(ifs
.base_ios
.precision
== 6, "expected 6 got %d\n", ifs
.base_ios
.precision
);
7267 ok(ifs
.base_ios
.fill
== ' ', "expected 32 got %d\n", ifs
.base_ios
.fill
);
7268 ok(ifs
.base_ios
.width
== 0, "expected 0 got %d\n", ifs
.base_ios
.width
);
7269 ok(ifs
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ifs
.base_ios
.do_lock
);
7270 ok(pfb
->fd
== -1, "wrong fd, expected -1 got %d\n", pfb
->fd
);
7271 ok(pfb
->close
== 0, "wrong value, expected 0 got %d\n", pfb
->close
);
7272 ok(pfb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb
->base
.allocated
);
7273 ok(pfb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb
->base
.unbuffered
);
7274 ok(pfb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pfb
->base
.base
);
7275 ok(pfb
->base
.ebuf
== NULL
, "wrong ebuf, expected %p got %p\n", NULL
, pfb
->base
.ebuf
);
7276 ok(pfb
->fd
== -1, "wrong fd, expected 0 got %d\n", pfb
->fd
);
7277 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7279 pifs
= call_func3(p_ifstream_fd_ctor
, &ifs
, 42, TRUE
);
7280 pfb
= (filebuf
*) ifs
.base_ios
.sb
;
7281 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7282 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7283 ok(ifs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ifs
.base_ios
.delbuf
);
7284 ok(pfb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb
->base
.allocated
);
7285 ok(pfb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb
->base
.unbuffered
);
7286 ok(pfb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pfb
->base
.base
);
7287 ok(pfb
->base
.ebuf
== NULL
, "wrong ebuf, expected %p got %p\n", NULL
, pfb
->base
.ebuf
);
7288 ok(pfb
->fd
== 42, "wrong fd, expected 42 got %d\n", pfb
->fd
);
7289 ok(pfb
->close
== 0, "wrong value, expected 0 got %d\n", pfb
->close
);
7291 pifs
= call_func3(p_ifstream_copy_ctor
, &ifs_copy
, &ifs
, TRUE
);
7292 pfb
= (filebuf
*) ifs_copy
.base_ios
.sb
;
7293 ok(pifs
== &ifs_copy
, "wrong return, expected %p got %p\n", &ifs_copy
, pifs
);
7294 ok(ifs_copy
.base_ios
.sb
== ifs
.base_ios
.sb
, "expected shared streambuf\n");
7295 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7296 ok(ifs_copy
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs_copy
.base_ios
.state
);
7298 call_func1(p_ifstream_vbase_dtor
, &ifs_copy
);
7299 call_func1(p_ifstream_dtor
, &ifs
.base_ios
);
7301 pifs
= call_func5(p_ifstream_buffer_ctor
, &ifs
, 53, buffer
, ARRAY_SIZE(buffer
), TRUE
);
7302 pfb
= (filebuf
*) ifs
.base_ios
.sb
;
7303 ok(ifs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ifs
.base_ios
.delbuf
);
7304 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7305 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7306 ok(pfb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb
->base
.allocated
);
7307 ok(pfb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb
->base
.unbuffered
);
7308 ok(pfb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pfb
->base
.base
);
7309 ok(pfb
->base
.ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), pfb
->base
.ebuf
);
7310 ok(pfb
->fd
== 53, "wrong fd, expected 53 got %d\n", pfb
->fd
);
7311 ok(pfb
->close
== 0, "wrong value, expected 0 got %d\n", pfb
->close
);
7312 call_func1(p_ifstream_dtor
, &ifs
.base_ios
);
7314 pifs
= call_func5(p_ifstream_buffer_ctor
, &ifs
, 64, NULL
, 0, TRUE
);
7315 pfb
= (filebuf
*) ifs
.base_ios
.sb
;
7316 ok(ifs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ifs
.base_ios
.delbuf
);
7317 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7318 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7319 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7320 ok(pfb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb
->base
.allocated
);
7321 ok(pfb
->base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", pfb
->base
.unbuffered
);
7322 ok(pfb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pfb
->base
.base
);
7323 ok(pfb
->base
.ebuf
== NULL
, "wrong ebuf, expected %p got %p\n", NULL
, pfb
->base
.ebuf
);
7324 ok(pfb
->fd
== 64, "wrong fd, expected 64 got %d\n", pfb
->fd
);
7325 ok(pfb
->close
== 0, "wrong value, expected 0 got %d\n", pfb
->close
);
7326 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7328 pifs
= call_func5(p_ifstream_open_ctor
, &ifs
, filename
, OPENMODE_in
, filebuf_openprot
, TRUE
);
7329 pfb
= (filebuf
*) ifs
.base_ios
.sb
;
7330 ok(ifs
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ifs
.base_ios
.delbuf
);
7331 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7332 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7333 ok(pfb
->base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", pfb
->base
.allocated
);
7334 ok(pfb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb
->base
.unbuffered
);
7335 ok(pfb
->base
.base
!= NULL
, "wrong buffer, expected not %p got %p\n", NULL
, pfb
->base
.base
);
7336 ok(pfb
->base
.ebuf
!= NULL
, "wrong ebuf, expected not %p got %p\n", NULL
, pfb
->base
.ebuf
);
7337 ok(pfb
->fd
!= -1, "wrong fd, expected not -1 got %d\n", pfb
->fd
);
7339 ok(pfb
->close
== 1, "wrong value, expected 1 got %d\n", pfb
->close
);
7340 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7341 ok(_close(fd
) == -1, "expected ifstream to close opened file\n");
7344 call_func5(p_ifstream_buffer_ctor
, &ifs
, -1, NULL
, 0, TRUE
);
7345 ok(ifs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ifs
.base_ios
.sb
->base
);
7346 ok(ifs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ifs
.base_ios
.sb
->ebuf
);
7347 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", pfb
->base
.unbuffered
);
7348 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7350 psb
= call_func3(p_ifstream_setbuf
, &ifs
, buffer
, ARRAY_SIZE(buffer
));
7351 ok(psb
== ifs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ifs
.base_ios
.sb
, psb
);
7352 ok(ifs
.base_ios
.sb
->base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ifs
.base_ios
.sb
->base
);
7353 ok(ifs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ifs
.base_ios
.sb
->ebuf
);
7354 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7355 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7356 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7358 psb
= call_func3(p_ifstream_setbuf
, &ifs
, NULL
, 0);
7359 ok(psb
== ifs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ifs
.base_ios
.sb
, psb
);
7360 ok(ifs
.base_ios
.sb
->base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ifs
.base_ios
.sb
->base
);
7361 ok(ifs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ifs
.base_ios
.sb
->ebuf
);
7362 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7363 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7364 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7365 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7367 call_func2(p_ifstream_ctor
, &ifs
, TRUE
);
7368 ok(ifs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ifs
.base_ios
.sb
->base
);
7369 ok(ifs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ifs
.base_ios
.sb
->ebuf
);
7370 ok(ifs
.base_ios
.sb
->unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7371 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7372 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7374 psb
= call_func3(p_ifstream_setbuf
, &ifs
, buffer
, ARRAY_SIZE(buffer
));
7375 ok(psb
== ifs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ifs
.base_ios
.sb
, psb
);
7376 ok(ifs
.base_ios
.sb
->base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ifs
.base_ios
.sb
->base
);
7377 ok(ifs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ifs
.base_ios
.sb
->ebuf
);
7378 ok(ifs
.base_ios
.sb
->unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7379 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7380 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7382 psb
= call_func3(p_ifstream_setbuf
, &ifs
, NULL
, 0);
7383 ok(psb
== ifs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ifs
.base_ios
.sb
, psb
);
7384 ok(ifs
.base_ios
.sb
->base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, ifs
.base_ios
.sb
->base
);
7385 ok(ifs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ifs
.base_ios
.sb
->ebuf
);
7386 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7387 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7388 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7390 psb
= call_func3(p_ifstream_setbuf
, &ifs
, buffer
+ 8, ARRAY_SIZE(buffer
) - 8);
7391 ok(psb
== ifs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ifs
.base_ios
.sb
, psb
);
7392 ok(ifs
.base_ios
.sb
->base
== buffer
+ 8, "wrong buffer, expected %p got %p\n", buffer
+ 8, ifs
.base_ios
.sb
->base
);
7393 ok(ifs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ifs
.base_ios
.sb
->ebuf
);
7394 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7395 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7396 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7398 psb
= call_func3(p_ifstream_setbuf
, &ifs
, buffer
+ 8, 0);
7399 ok(psb
== ifs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ifs
.base_ios
.sb
, psb
);
7400 ok(ifs
.base_ios
.sb
->base
== buffer
+ 8, "wrong buffer, expected %p got %p\n", buffer
+ 8, ifs
.base_ios
.sb
->base
);
7401 ok(ifs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ifs
.base_ios
.sb
->ebuf
);
7402 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7403 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7404 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7406 psb
= call_func3(p_ifstream_setbuf
, &ifs
, buffer
+ 4, ARRAY_SIZE(buffer
) - 4);
7407 ok(psb
== ifs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ifs
.base_ios
.sb
, psb
);
7408 ok(ifs
.base_ios
.sb
->base
== buffer
+ 4, "wrong buffer, expected %p got %p\n", buffer
+ 4, ifs
.base_ios
.sb
->base
);
7409 ok(ifs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ifs
.base_ios
.sb
->ebuf
);
7410 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7411 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7412 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7414 psb
= call_func3(p_ifstream_setbuf
, &ifs
, NULL
, 5);
7415 ok(psb
== ifs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ifs
.base_ios
.sb
, psb
);
7416 ok(ifs
.base_ios
.sb
->base
== buffer
+ 4, "wrong buffer, expected %p got %p\n", buffer
+ 4, ifs
.base_ios
.sb
->base
);
7417 ok(ifs
.base_ios
.sb
->ebuf
== buffer
+ ARRAY_SIZE(buffer
), "wrong ebuf, expected %p got %p\n", buffer
+ ARRAY_SIZE(buffer
), ifs
.base_ios
.sb
->ebuf
);
7418 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7419 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7420 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7421 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7423 /* setbuf - seems to be a nop and always return NULL in those other cases */
7424 pifs
= call_func5(p_ifstream_buffer_ctor
, &ifs
, 42, NULL
, 0, TRUE
);
7425 ok(ifs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ifs
.base_ios
.sb
->base
);
7426 ok(ifs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ifs
.base_ios
.sb
->ebuf
);
7427 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7428 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7430 ifs
.base_ios
.state
= IOSTATE_eofbit
;
7431 psb
= call_func3(p_ifstream_setbuf
, &ifs
, buffer
, ARRAY_SIZE(buffer
));
7432 ok(psb
== NULL
, "wrong return, expected NULL got %p\n", psb
);
7433 ok(ifs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ifs
.base_ios
.sb
->base
);
7434 ok(ifs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ifs
.base_ios
.sb
->ebuf
);
7435 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7436 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7437 ok(ifs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
7439 ifs
.base_ios
.state
= IOSTATE_eofbit
;
7440 psb
= call_func3(p_ifstream_setbuf
, &ifs
, NULL
, 0);
7441 ok(psb
== NULL
, "wrong return, expected NULL got %p\n", psb
);
7442 ok(ifs
.base_ios
.sb
->base
== NULL
, "wrong base value, expected NULL got %p\n", ifs
.base_ios
.sb
->base
);
7443 ok(ifs
.base_ios
.sb
->ebuf
== NULL
, "wrong ebuf value, expected NULL got %p\n", ifs
.base_ios
.sb
->ebuf
);
7444 ok(ifs
.base_ios
.sb
->unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7445 ok(ifs
.base_ios
.sb
->allocated
== 0, "wrong allocated value, expected 0 got %d\n", ifs
.base_ios
.sb
->allocated
);
7446 ok(ifs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
7447 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7449 pifs
= call_func5(p_ifstream_open_ctor
, &ifs
, filename
, OPENMODE_in
, filebuf_openprot
, TRUE
);
7450 ifs
.base_ios
.state
= IOSTATE_eofbit
;
7451 psb
= call_func3(p_ifstream_setbuf
, &ifs
, NULL
, 0);
7452 ok(psb
== NULL
, "wrong return, expected NULL got %p\n", psb
);
7453 ok(ifs
.base_ios
.sb
->base
!= NULL
, "wrong base value, expected NULL got %p\n", ifs
.base_ios
.sb
->base
);
7454 ok(ifs
.base_ios
.sb
->ebuf
!= NULL
, "wrong ebuf value, expected NULL got %p\n", ifs
.base_ios
.sb
->ebuf
);
7455 ok(ifs
.base_ios
.sb
->unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7456 ok(ifs
.base_ios
.sb
->allocated
== 1, "wrong allocated value, expected 1 got %d\n", ifs
.base_ios
.sb
->allocated
);
7457 ok(ifs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
7459 ifs
.base_ios
.state
= IOSTATE_eofbit
;
7460 psb
= call_func3(p_ifstream_setbuf
, &ifs
, buffer
, ARRAY_SIZE(buffer
));
7461 ok(psb
== NULL
, "wrong return, expected NULL got %p\n", psb
);
7462 ok(ifs
.base_ios
.sb
->base
!= NULL
, "wrong base value, expected NULL got %p\n", ifs
.base_ios
.sb
->base
);
7463 ok(ifs
.base_ios
.sb
->base
!= buffer
, "wrong base value, expected not %p got %p\n", buffer
, ifs
.base_ios
.sb
->base
);
7464 ok(ifs
.base_ios
.sb
->unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", ifs
.base_ios
.sb
->unbuffered
);
7465 ok(ifs
.base_ios
.sb
->allocated
== 1, "wrong allocated value, expected 1 got %d\n", ifs
.base_ios
.sb
->allocated
);
7466 ok(ifs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
7467 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7470 pifs
= call_func2(p_ifstream_ctor
, &ifs
, TRUE
);
7471 pfb
= (filebuf
*) ifs
.base_ios
.sb
;
7472 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7473 call_func2(p_ifstream_attach
, &ifs
, 42);
7474 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "attaching on vanilla stream set some state bits\n");
7475 fd
= (int) call_func1(p_ifstream_fd
, &ifs
);
7476 ok(fd
== 42, "wrong fd, expected 42 got %d\n", fd
);
7477 ok(pfb
->close
== 0, "wrong close value, expected 0 got %d\n", pfb
->close
);
7478 ifs
.base_ios
.state
= IOSTATE_eofbit
;
7479 call_func2(p_ifstream_attach
, &ifs
, 53);
7480 ok(ifs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "attaching on already setup stream did not set failbit\n");
7481 ok(fd
== 42, "wrong fd, expected 42 got %d\n", fd
);
7482 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7485 pifs
= call_func2(p_ifstream_ctor
, &ifs
, TRUE
);
7486 pfb
= (filebuf
*) ifs
.base_ios
.sb
;
7487 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7488 fd
= (int) call_func1(p_ifstream_fd
, &ifs
);
7489 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7490 ok(fd
== -1, "wrong fd, expected -1 but got %d\n", fd
);
7491 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7493 pifs
= call_func5(p_ifstream_open_ctor
, &ifs
, filename
, OPENMODE_in
, filebuf_openprot
, TRUE
);
7494 pfb
= (filebuf
*) ifs
.base_ios
.sb
;
7495 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7496 fd
= (int) call_func1(p_ifstream_fd
, &ifs
);
7497 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7498 ok(fd
== pfb
->fd
, "wrong fd, expected %d but got %d\n", pfb
->fd
, fd
);
7501 pfb
= (filebuf
*) call_func1(p_ifstream_rdbuf
, &ifs
);
7502 ok((streambuf
*) pfb
== ifs
.base_ios
.sb
, "wrong return, expected %p got %p\n", ifs
.base_ios
.sb
, pfb
);
7503 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7506 ret
= (int) call_func2(p_ifstream_setmode
, &ifs
, filebuf_binary
);
7507 ok(ret
== filebuf_text
, "wrong return, expected %d got %d\n", filebuf_text
, ret
);
7508 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7509 ret
= (int) call_func2(p_ifstream_setmode
, &ifs
, filebuf_binary
);
7510 ok(ret
== filebuf_binary
, "wrong return, expected %d got %d\n", filebuf_binary
, ret
);
7511 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7512 ret
= (int) call_func2(p_ifstream_setmode
, &ifs
, filebuf_text
);
7513 ok(ret
== filebuf_binary
, "wrong return, expected %d got %d\n", filebuf_binary
, ret
);
7514 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7515 ret
= (int) call_func2(p_ifstream_setmode
, &ifs
, 0x9000);
7516 ok(ret
== -1, "wrong return, expected -1 got %d\n", ret
);
7517 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ifs
.base_ios
.state
);
7519 /* close && is_open */
7520 ok((int) call_func1(p_ifstream_is_open
, &ifs
) == 1, "expected ifstream to be open\n");
7521 ifs
.base_ios
.state
= IOSTATE_eofbit
| IOSTATE_failbit
;
7522 call_func1(p_ifstream_close
, &ifs
);
7523 ok(ifs
.base_ios
.state
== IOSTATE_goodbit
, "close did not clear state = %d\n", ifs
.base_ios
.state
);
7524 ifs
.base_ios
.state
= IOSTATE_eofbit
;
7525 call_func1(p_ifstream_close
, &ifs
);
7526 ok(ifs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "close on a closed stream did not set failbit\n");
7527 ok((int) call_func1(p_ifstream_is_open
, &ifs
) == 0, "expected ifstream to not be open\n");
7528 ok(_close(fd
) == -1, "expected close to close the opened file\n");
7531 ifs
.base_ios
.state
= IOSTATE_eofbit
;
7532 call_func4(p_ifstream_open
, &ifs
, filename
, OPENMODE_in
, filebuf_openprot
);
7533 fd
= (int) call_func1(p_ifstream_fd
, &ifs
);
7534 ok(fd
!= -1, "wrong fd, expected not -1 got %d\n", fd
);
7535 ok(ifs
.base_ios
.state
== IOSTATE_eofbit
, "open did not succeed\n");
7536 call_func4(p_ifstream_open
, &ifs
, filename
, OPENMODE_in
, filebuf_openprot
);
7537 ok(ifs
.base_ios
.state
== (IOSTATE_eofbit
| IOSTATE_failbit
), "second open did not set failbit\n");
7538 call_func1(p_ifstream_close
, &ifs
);
7540 /* write something we can read later */
7541 fd
= _open(filename
, _O_TRUNC
|_O_CREAT
|_O_RDWR
, _S_IWRITE
);
7542 ok(fd
!= -1, "_open failed\n");
7543 ok(_write(fd
, "test 12", 7) == 7, "_write failed\n");
7544 ok(_close(fd
) == 0, "_close failed\n");
7546 /* integration with parent istream - reading */
7547 ifs
.base_ios
.state
= IOSTATE_goodbit
; /* open doesn't clear the state */
7548 call_func4(p_ifstream_open
, &ifs
, filename
, OPENMODE_out
, filebuf_openprot
); /* make sure that OPENMODE_in is implicit */
7549 memset(st
, 'A', sizeof(st
));
7551 pifs
= call_func2(p_istream_read_str
, &ifs
, st
);
7552 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7553 ok(!strcmp(st
, "test"), "expected 'test' got '%s'\n", st
);
7556 pifs
= call_func2(p_istream_read_int
, pifs
, &i
);
7557 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7558 ok(i
== 12, "expected 12 got %d\n", i
);
7559 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7561 /* make sure that OPENMODE_in is implicit with open_ctor */
7562 pifs
= call_func5(p_ifstream_open_ctor
, &ifs
, filename
, OPENMODE_out
, filebuf_openprot
, TRUE
);
7563 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7564 memset(st
, 'A', sizeof(st
));
7566 pifs
= call_func2(p_istream_read_str
, &ifs
, st
);
7567 ok(pifs
== &ifs
, "wrong return, expected %p got %p\n", &ifs
, pifs
);
7568 ok(!strcmp(st
, "test"), "expected 'test' got '%s'\n", st
);
7569 call_func1(p_ifstream_vbase_dtor
, &ifs
);
7570 ok(_unlink(filename
) == 0, "Couldn't unlink file named '%s'\n", filename
);
7573 static void test_strstream(void)
7575 iostream ios1
, ios2
, *pios
;
7580 memset(&ios1
, 0xab, sizeof(iostream
));
7581 memset(&ios2
, 0xab, sizeof(iostream
));
7583 /* constructors/destructors */
7584 pios
= call_func2(p_strstream_ctor
, &ios1
, TRUE
);
7585 pssb
= (strstreambuf
*) ios1
.base_ios
.sb
;
7586 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7587 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7588 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7589 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7590 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7591 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
7592 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7593 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7594 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7595 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7596 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7597 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7598 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7599 ok(pssb
->dynamic
== 1, "expected 1, got %d\n", pssb
->dynamic
);
7600 ok(pssb
->increase
== 1, "expected 1, got %d\n", pssb
->increase
);
7601 ok(pssb
->constant
== 0, "expected 0, got %d\n", pssb
->constant
);
7602 ok(pssb
->f_alloc
== NULL
, "expected %p, got %p\n", NULL
, pssb
->f_alloc
);
7603 ok(pssb
->f_free
== NULL
, "expected %p, got %p\n", NULL
, pssb
->f_free
);
7604 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
7605 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
7606 ok(pssb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pssb
->base
.base
);
7607 ok(pssb
->base
.ebuf
== NULL
, "wrong buffer end, expected %p got %p\n", NULL
, pssb
->base
.ebuf
);
7608 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
7609 call_func1(p_strstream_vbase_dtor
, &ios1
);
7610 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7611 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7612 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
7613 ios1
.base2
.unknown
= 0xabababab;
7614 memset(&ios1
.base_ios
, 0xab, sizeof(ios
));
7615 ios1
.base_ios
.delbuf
= 0;
7616 pios
= call_func2(p_strstream_ctor
, &ios1
, FALSE
);
7617 pssb
= (strstreambuf
*) ios1
.base_ios
.sb
;
7618 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7619 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7620 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7621 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7622 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7623 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
7624 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7625 ok(ios1
.base_ios
.tie
== ios2
.base_ios
.tie
, "expected %p got %p\n", ios2
.base_ios
.tie
, ios1
.base_ios
.tie
);
7626 ok(ios1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios1
.base_ios
.flags
);
7627 ok(ios1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.precision
);
7628 ok(ios1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios1
.base_ios
.fill
);
7629 ok(ios1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.width
);
7630 ok(ios1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.do_lock
);
7631 ok(pssb
->dynamic
== 1, "expected 1, got %d\n", pssb
->dynamic
);
7632 ok(pssb
->increase
== 1, "expected 1, got %d\n", pssb
->increase
);
7633 ok(pssb
->constant
== 0, "expected 0, got %d\n", pssb
->constant
);
7634 ok(pssb
->f_alloc
== NULL
, "expected %p, got %p\n", NULL
, pssb
->f_alloc
);
7635 ok(pssb
->f_free
== NULL
, "expected %p, got %p\n", NULL
, pssb
->f_free
);
7636 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
7637 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
7638 ok(pssb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pssb
->base
.base
);
7639 ok(pssb
->base
.ebuf
== NULL
, "wrong buffer end, expected %p got %p\n", NULL
, pssb
->base
.ebuf
);
7640 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
7641 call_func1(p_strstream_dtor
, &ios1
.base_ios
);
7642 ok(ios1
.base_ios
.sb
== &pssb
->base
, "expected %p got %p\n", &pssb
->base
, ios1
.base_ios
.sb
);
7643 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
7644 call_func1(p_strstreambuf_dtor
, pssb
);
7645 p_operator_delete(pssb
);
7647 memset(&ios1
, 0xab, sizeof(iostream
));
7648 pios
= call_func5(p_strstream_buffer_ctor
, &ios1
, buffer
, 32, 0, TRUE
);
7649 pssb
= (strstreambuf
*) ios1
.base_ios
.sb
;
7650 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7651 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7652 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7653 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7654 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7655 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
7656 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7657 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7658 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7659 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7660 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7661 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7662 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7663 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
7664 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
7665 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
7666 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
7667 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
7668 ok(pssb
->base
.ebuf
== buffer
+ 32, "wrong buffer end, expected %p got %p\n", buffer
+ 32, pssb
->base
.ebuf
);
7669 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
7670 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
7671 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
7672 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
7673 ok(pssb
->base
.pptr
== buffer
, "wrong put pointer, expected %p got %p\n", buffer
, pssb
->base
.pptr
);
7674 ok(pssb
->base
.epptr
== buffer
+ 32, "wrong put end, expected %p got %p\n", buffer
+ 32, pssb
->base
.epptr
);
7675 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
7676 call_func1(p_strstream_vbase_dtor
, &ios1
);
7677 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7678 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7679 memset(&ios1
, 0xab, sizeof(iostream
));
7680 pios
= call_func5(p_strstream_buffer_ctor
, &ios1
, buffer
, 16, OPENMODE_in
, TRUE
);
7681 pssb
= (strstreambuf
*) ios1
.base_ios
.sb
;
7682 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7683 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7684 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7685 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7686 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7687 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
7688 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7689 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7690 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7691 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7692 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7693 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7694 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7695 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
7696 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
7697 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
7698 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
7699 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
7700 ok(pssb
->base
.ebuf
== buffer
+ 16, "wrong buffer end, expected %p got %p\n", buffer
+ 16, pssb
->base
.ebuf
);
7701 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
7702 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
7703 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
7704 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
7705 ok(pssb
->base
.pptr
== buffer
, "wrong put pointer, expected %p got %p\n", buffer
, pssb
->base
.pptr
);
7706 ok(pssb
->base
.epptr
== buffer
+ 16, "wrong put end, expected %p got %p\n", buffer
+ 16, pssb
->base
.epptr
);
7707 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
7708 call_func1(p_strstream_vbase_dtor
, &ios1
);
7709 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7710 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7711 memset(&ios1
, 0xab, sizeof(iostream
));
7712 pios
= call_func5(p_strstream_buffer_ctor
, &ios1
, buffer
, -1, OPENMODE_in
|OPENMODE_out
, TRUE
);
7713 pssb
= (strstreambuf
*) ios1
.base_ios
.sb
;
7714 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7715 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7716 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7717 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7718 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7719 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
7720 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7721 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7722 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7723 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7724 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7725 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7726 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7727 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
7728 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
7729 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
7730 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
7731 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
7732 ok(pssb
->base
.ebuf
== (char *)((ULONG_PTR
)buffer
+ 0x7fffffff) || pssb
->base
.ebuf
== (char*) -1,
7733 "wrong buffer end, expected %p + 0x7fffffff or -1, got %p\n", buffer
, pssb
->base
.ebuf
);
7734 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
7735 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
7736 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
7737 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
7738 ok(pssb
->base
.pptr
== buffer
, "wrong put pointer, expected %p got %p\n", buffer
, pssb
->base
.pptr
);
7739 ok(pssb
->base
.epptr
== (char *)((ULONG_PTR
)buffer
+ 0x7fffffff) || pssb
->base
.epptr
== (char*) -1,
7740 "wrong buffer end, expected %p + 0x7fffffff or -1, got %p\n", buffer
, pssb
->base
.epptr
);
7741 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
7742 call_func1(p_strstream_vbase_dtor
, &ios1
);
7743 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7744 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7745 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
7746 ios1
.base2
.unknown
= 0xabababab;
7747 memset(&ios1
.base_ios
, 0xab, sizeof(ios
));
7748 ios1
.base_ios
.delbuf
= 0;
7749 strcpy(buffer
, "Test");
7750 pios
= call_func5(p_strstream_buffer_ctor
, &ios1
, buffer
, 0, OPENMODE_in
|OPENMODE_app
, FALSE
);
7751 pssb
= (strstreambuf
*) ios1
.base_ios
.sb
;
7752 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7753 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7754 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7755 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7756 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7757 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
7758 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7759 ok(ios1
.base_ios
.tie
== ios2
.base_ios
.tie
, "expected %p got %p\n", ios2
.base_ios
.tie
, ios1
.base_ios
.tie
);
7760 ok(ios1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios1
.base_ios
.flags
);
7761 ok(ios1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.precision
);
7762 ok(ios1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios1
.base_ios
.fill
);
7763 ok(ios1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.width
);
7764 ok(ios1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.do_lock
);
7765 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
7766 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
7767 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
7768 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
7769 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
7770 ok(pssb
->base
.ebuf
== buffer
+ 4, "wrong buffer end, expected %p got %p\n", buffer
+ 4, pssb
->base
.ebuf
);
7771 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
7772 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
7773 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
7774 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
7775 ok(pssb
->base
.pptr
== buffer
, "wrong put pointer, expected %p got %p\n", buffer
, pssb
->base
.pptr
);
7776 ok(pssb
->base
.epptr
== buffer
+ 4, "wrong put end, expected %p got %p\n", buffer
+ 4, pssb
->base
.epptr
);
7777 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
7778 call_func1(p_strstream_dtor
, &ios1
.base_ios
);
7779 ok(ios1
.base_ios
.sb
== &pssb
->base
, "expected %p got %p\n", &pssb
->base
, ios1
.base_ios
.sb
);
7780 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
7781 call_func1(p_strstreambuf_dtor
, pssb
);
7782 p_operator_delete(pssb
);
7783 memset(&ios1
, 0xab, sizeof(iostream
));
7784 pios
= call_func5(p_strstream_buffer_ctor
, &ios1
, buffer
, 16, OPENMODE_ate
, TRUE
);
7785 pssb
= (strstreambuf
*) ios1
.base_ios
.sb
;
7786 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7787 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7788 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7789 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7790 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7791 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
7792 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7793 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7794 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7795 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7796 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7797 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7798 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7799 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
7800 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
7801 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
7802 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
7803 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
7804 ok(pssb
->base
.ebuf
== buffer
+ 16, "wrong buffer end, expected %p got %p\n", buffer
+ 16, pssb
->base
.ebuf
);
7805 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
7806 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
7807 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
7808 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
7809 ok(pssb
->base
.pptr
== buffer
, "wrong put pointer, expected %p got %p\n", buffer
, pssb
->base
.pptr
);
7810 ok(pssb
->base
.epptr
== buffer
+ 16, "wrong put end, expected %p got %p\n", buffer
+ 16, pssb
->base
.epptr
);
7811 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
7812 call_func1(p_strstream_vbase_dtor
, &ios1
);
7813 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7814 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7815 pios
= call_func5(p_strstream_buffer_ctor
, &ios1
, buffer
, 16, OPENMODE_out
|OPENMODE_ate
, TRUE
);
7816 pssb
= (strstreambuf
*) ios1
.base_ios
.sb
;
7817 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7818 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7819 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7820 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7821 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7822 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
7823 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7824 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7825 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7826 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7827 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7828 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7829 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7830 ok(pssb
->dynamic
== 0, "expected 0, got %d\n", pssb
->dynamic
);
7831 ok(pssb
->constant
== 1, "expected 1, got %d\n", pssb
->constant
);
7832 ok(pssb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pssb
->base
.allocated
);
7833 ok(pssb
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pssb
->base
.unbuffered
);
7834 ok(pssb
->base
.base
== buffer
, "wrong buffer, expected %p got %p\n", buffer
, pssb
->base
.base
);
7835 ok(pssb
->base
.ebuf
== buffer
+ 16, "wrong buffer end, expected %p got %p\n", buffer
+ 16, pssb
->base
.ebuf
);
7836 ok(pssb
->base
.eback
== buffer
, "wrong get base, expected %p got %p\n", buffer
, pssb
->base
.eback
);
7837 ok(pssb
->base
.gptr
== buffer
, "wrong get pointer, expected %p got %p\n", buffer
, pssb
->base
.gptr
);
7838 ok(pssb
->base
.egptr
== buffer
, "wrong get end, expected %p got %p\n", buffer
, pssb
->base
.egptr
);
7839 ok(pssb
->base
.pbase
== buffer
, "wrong put base, expected %p got %p\n", buffer
, pssb
->base
.pbase
);
7840 ok(pssb
->base
.pptr
== buffer
+ 4, "wrong put pointer, expected %p got %p\n", buffer
+ 4, pssb
->base
.pptr
);
7841 ok(pssb
->base
.epptr
== buffer
+ 16, "wrong put end, expected %p got %p\n", buffer
+ 16, pssb
->base
.epptr
);
7842 ok(pssb
->base
.do_lock
== -1, "expected -1 got %d\n", pssb
->base
.do_lock
);
7843 call_func1(p_strstream_vbase_dtor
, &ios1
);
7844 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7845 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7847 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xcdcdcdcd;
7848 ios1
.base2
.unknown
= 0xcdcdcdcd;
7849 memset(&ios1
.base_ios
, 0xcd, sizeof(ios
));
7850 pios
= call_func3(p_strstream_copy_ctor
, &ios2
, &ios1
, TRUE
);
7851 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
7852 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
7853 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
7854 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
7855 ok(ios2
.base_ios
.sb
== ios1
.base_ios
.sb
, "expected %p got %p\n", ios1
.base_ios
.sb
, ios2
.base_ios
.sb
);
7856 ok(ios2
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, ios2
.base_ios
.state
);
7857 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
7858 ok(ios2
.base_ios
.tie
== ios1
.base_ios
.tie
, "expected %p got %p\n", ios1
.base_ios
.tie
, ios2
.base_ios
.tie
);
7859 ok(ios2
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, ios2
.base_ios
.flags
);
7860 ok(ios2
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", ios2
.base_ios
.precision
);
7861 ok(ios2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", ios2
.base_ios
.fill
);
7862 ok(ios2
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", ios2
.base_ios
.width
);
7863 ok(ios2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios2
.base_ios
.do_lock
);
7864 call_func1(p_strstream_vbase_dtor
, &ios2
);
7865 ios2
.base1
.extract_delim
= ios2
.base1
.count
= 0xabababab;
7866 ios2
.base2
.unknown
= 0xabababab;
7867 memset(&ios2
.base_ios
, 0xab, sizeof(ios
));
7868 ios2
.base_ios
.delbuf
= 0;
7869 pos
= ios2
.base_ios
.tie
;
7870 pios
= call_func3(p_strstream_copy_ctor
, &ios2
, &ios1
, FALSE
);
7871 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
7872 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
7873 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
7874 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
7875 ok(ios2
.base_ios
.sb
== ios1
.base_ios
.sb
, "expected %p got %p\n", ios1
.base_ios
.sb
, ios2
.base_ios
.sb
);
7876 ok(ios2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.state
);
7877 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
7878 ok(ios2
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, ios2
.base_ios
.tie
);
7879 ok(ios2
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios2
.base_ios
.flags
);
7880 ok(ios2
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.precision
);
7881 ok(ios2
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios2
.base_ios
.fill
);
7882 ok(ios2
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.width
);
7883 ok(ios2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.do_lock
);
7884 call_func1(p_strstream_dtor
, &ios2
.base_ios
);
7887 ios2
.base1
.extract_delim
= ios2
.base1
.count
= 0xabababab;
7888 ios2
.base2
.unknown
= 0xabababab;
7889 memset(&ios2
.base_ios
, 0xab, sizeof(ios
));
7890 ios2
.base_ios
.delbuf
= 0;
7891 pios
= call_func2(p_strstream_assign
, &ios2
, &ios1
);
7892 ok(ios2
.base1
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base1
.extract_delim
);
7893 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
7894 ok(ios2
.base2
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base2
.unknown
);
7895 ok(ios2
.base_ios
.sb
== ios1
.base_ios
.sb
, "expected %p got %p\n", ios1
.base_ios
.sb
, ios2
.base_ios
.sb
);
7896 ok(ios2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios2
.base_ios
.state
);
7897 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
7898 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
7899 ok(ios2
.base_ios
.flags
== 0, "expected 0 got %x\n", ios2
.base_ios
.flags
);
7900 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
7901 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
7902 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
7903 ok(ios2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.do_lock
);
7906 static void test_stdiostream(void)
7908 iostream ios1
, ios2
, *pios
;
7912 const char filename
[] = "stdiostream_test";
7914 memset(&ios1
, 0xab, sizeof(iostream
));
7915 memset(&ios2
, 0xab, sizeof(iostream
));
7917 file
= fopen(filename
, "w+");
7918 ok(file
!= NULL
, "Couldn't open the file named '%s'\n", filename
);
7920 /* constructors/destructors */
7921 pios
= call_func3(p_stdiostream_file_ctor
, &ios1
, file
, TRUE
);
7922 pstb
= (stdiobuf
*) ios1
.base_ios
.sb
;
7923 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7924 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7925 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7926 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7927 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7928 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
7929 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7930 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7931 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7932 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7933 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7934 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7935 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7936 ok(pstb
->file
== file
, "expected %p, got %p\n", file
, pstb
->file
);
7937 ok(pstb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pstb
->base
.allocated
);
7938 ok(pstb
->base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", pstb
->base
.unbuffered
);
7939 ok(pstb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pstb
->base
.base
);
7940 ok(pstb
->base
.ebuf
== NULL
, "wrong buffer end, expected %p got %p\n", NULL
, pstb
->base
.ebuf
);
7941 ok(pstb
->base
.do_lock
== -1, "expected -1 got %d\n", pstb
->base
.do_lock
);
7942 call_func1(p_stdiostream_vbase_dtor
, &ios1
);
7943 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7944 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
7945 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xabababab;
7946 ios1
.base2
.unknown
= 0xabababab;
7947 memset(&ios1
.base_ios
, 0xab, sizeof(ios
));
7948 ios1
.base_ios
.delbuf
= 0;
7949 pios
= call_func3(p_stdiostream_file_ctor
, &ios1
, file
, FALSE
);
7950 pstb
= (stdiobuf
*) ios1
.base_ios
.sb
;
7951 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7952 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7953 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7954 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7955 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7956 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
7957 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7958 ok(ios1
.base_ios
.tie
== ios2
.base_ios
.tie
, "expected %p got %p\n", ios2
.base_ios
.tie
, ios1
.base_ios
.tie
);
7959 ok(ios1
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios1
.base_ios
.flags
);
7960 ok(ios1
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.precision
);
7961 ok(ios1
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios1
.base_ios
.fill
);
7962 ok(ios1
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.width
);
7963 ok(ios1
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.do_lock
);
7964 ok(pstb
->file
== file
, "expected %p, got %p\n", file
, pstb
->file
);
7965 ok(pstb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pstb
->base
.allocated
);
7966 ok(pstb
->base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", pstb
->base
.unbuffered
);
7967 ok(pstb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pstb
->base
.base
);
7968 ok(pstb
->base
.ebuf
== NULL
, "wrong buffer end, expected %p got %p\n", NULL
, pstb
->base
.ebuf
);
7969 ok(pstb
->base
.do_lock
== -1, "expected -1 got %d\n", pstb
->base
.do_lock
);
7970 call_func1(p_stdiostream_dtor
, &ios1
.base_ios
);
7971 ok(ios1
.base_ios
.sb
== &pstb
->base
, "expected %p got %p\n", &pstb
->base
, ios1
.base_ios
.sb
);
7972 ok(ios1
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios1
.base_ios
.state
);
7973 call_func1(p_stdiobuf_dtor
, pstb
);
7974 p_operator_delete(pstb
);
7975 memset(&ios1
, 0xab, sizeof(iostream
));
7976 pios
= call_func3(p_stdiostream_file_ctor
, &ios1
, NULL
, TRUE
);
7977 pstb
= (stdiobuf
*) ios1
.base_ios
.sb
;
7978 ok(pios
== &ios1
, "wrong return, expected %p got %p\n", &ios1
, pios
);
7979 ok(ios1
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios1
.base1
.extract_delim
);
7980 ok(ios1
.base1
.count
== 0, "expected 0 got %d\n", ios1
.base1
.count
);
7981 ok(ios1
.base2
.unknown
== 0, "expected 0 got %d\n", ios1
.base2
.unknown
);
7982 ok(ios1
.base_ios
.sb
!= NULL
, "expected not %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7983 ok(ios1
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios1
.base_ios
.state
);
7984 ok(ios1
.base_ios
.delbuf
== 1, "expected 1 got %d\n", ios1
.base_ios
.delbuf
);
7985 ok(ios1
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.tie
);
7986 ok(ios1
.base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, ios1
.base_ios
.flags
);
7987 ok(ios1
.base_ios
.precision
== 6, "expected 6 got %d\n", ios1
.base_ios
.precision
);
7988 ok(ios1
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios1
.base_ios
.fill
);
7989 ok(ios1
.base_ios
.width
== 0, "expected 0 got %d\n", ios1
.base_ios
.width
);
7990 ok(ios1
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios1
.base_ios
.do_lock
);
7991 ok(pstb
->file
== NULL
, "expected %p, got %p\n", NULL
, pstb
->file
);
7992 ok(pstb
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pstb
->base
.allocated
);
7993 ok(pstb
->base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", pstb
->base
.unbuffered
);
7994 ok(pstb
->base
.base
== NULL
, "wrong buffer, expected %p got %p\n", NULL
, pstb
->base
.base
);
7995 ok(pstb
->base
.ebuf
== NULL
, "wrong buffer end, expected %p got %p\n", NULL
, pstb
->base
.ebuf
);
7996 ok(pstb
->base
.do_lock
== -1, "expected -1 got %d\n", pstb
->base
.do_lock
);
7997 call_func1(p_stdiostream_vbase_dtor
, &ios1
);
7998 ok(ios1
.base_ios
.sb
== NULL
, "expected %p got %p\n", NULL
, ios1
.base_ios
.sb
);
7999 ok(ios1
.base_ios
.state
== IOSTATE_badbit
, "expected %d got %d\n", IOSTATE_badbit
, ios1
.base_ios
.state
);
8001 ios1
.base1
.extract_delim
= ios1
.base1
.count
= 0xcdcdcdcd;
8002 ios1
.base2
.unknown
= 0xcdcdcdcd;
8003 memset(&ios1
.base_ios
, 0xcd, sizeof(ios
));
8004 pios
= call_func3(p_stdiostream_copy_ctor
, &ios2
, &ios1
, TRUE
);
8005 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
8006 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
8007 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
8008 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
8009 ok(ios2
.base_ios
.sb
== ios1
.base_ios
.sb
, "expected %p got %p\n", ios1
.base_ios
.sb
, ios2
.base_ios
.sb
);
8010 ok(ios2
.base_ios
.state
== 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, ios2
.base_ios
.state
);
8011 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
8012 ok(ios2
.base_ios
.tie
== ios1
.base_ios
.tie
, "expected %p got %p\n", ios1
.base_ios
.tie
, ios2
.base_ios
.tie
);
8013 ok(ios2
.base_ios
.flags
== 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, ios2
.base_ios
.flags
);
8014 ok(ios2
.base_ios
.precision
== (char) 0xcd, "expected -51 got %d\n", ios2
.base_ios
.precision
);
8015 ok(ios2
.base_ios
.fill
== (char) 0xcd, "expected -51 got %d\n", ios2
.base_ios
.fill
);
8016 ok(ios2
.base_ios
.width
== (char) 0xcd, "expected -51 got %d\n", ios2
.base_ios
.width
);
8017 ok(ios2
.base_ios
.do_lock
== -1, "expected -1 got %d\n", ios2
.base_ios
.do_lock
);
8018 call_func1(p_stdiostream_vbase_dtor
, &ios2
);
8019 ios2
.base1
.extract_delim
= ios2
.base1
.count
= 0xabababab;
8020 ios2
.base2
.unknown
= 0xabababab;
8021 memset(&ios2
.base_ios
, 0xab, sizeof(ios
));
8022 ios2
.base_ios
.delbuf
= 0;
8023 pos
= ios2
.base_ios
.tie
;
8024 pios
= call_func3(p_stdiostream_copy_ctor
, &ios2
, &ios1
, FALSE
);
8025 ok(pios
== &ios2
, "wrong return, expected %p got %p\n", &ios2
, pios
);
8026 ok(ios2
.base1
.extract_delim
== 0, "expected 0 got %d\n", ios2
.base1
.extract_delim
);
8027 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
8028 ok(ios2
.base2
.unknown
== 0, "expected 0 got %d\n", ios2
.base2
.unknown
);
8029 ok(ios2
.base_ios
.sb
== ios1
.base_ios
.sb
, "expected %p got %p\n", ios1
.base_ios
.sb
, ios2
.base_ios
.sb
);
8030 ok(ios2
.base_ios
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.state
);
8031 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
8032 ok(ios2
.base_ios
.tie
== pos
, "expected %p got %p\n", pos
, ios2
.base_ios
.tie
);
8033 ok(ios2
.base_ios
.flags
== 0xabababab, "expected %x got %x\n", 0xabababab, ios2
.base_ios
.flags
);
8034 ok(ios2
.base_ios
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.precision
);
8035 ok(ios2
.base_ios
.fill
== (char) 0xab, "expected -85 got %d\n", ios2
.base_ios
.fill
);
8036 ok(ios2
.base_ios
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.width
);
8037 ok(ios2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.do_lock
);
8038 call_func1(p_stdiostream_dtor
, &ios2
.base_ios
);
8041 ios2
.base1
.extract_delim
= ios2
.base1
.count
= 0xabababab;
8042 ios2
.base2
.unknown
= 0xabababab;
8043 memset(&ios2
.base_ios
, 0xab, sizeof(ios
));
8044 ios2
.base_ios
.delbuf
= 0;
8045 pios
= call_func2(p_stdiostream_assign
, &ios2
, &ios1
);
8046 ok(ios2
.base1
.extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base1
.extract_delim
);
8047 ok(ios2
.base1
.count
== 0, "expected 0 got %d\n", ios2
.base1
.count
);
8048 ok(ios2
.base2
.unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base2
.unknown
);
8049 ok(ios2
.base_ios
.sb
== ios1
.base_ios
.sb
, "expected %p got %p\n", ios1
.base_ios
.sb
, ios2
.base_ios
.sb
);
8050 ok(ios2
.base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, ios2
.base_ios
.state
);
8051 ok(ios2
.base_ios
.delbuf
== 0, "expected 0 got %d\n", ios2
.base_ios
.delbuf
);
8052 ok(ios2
.base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, ios2
.base_ios
.tie
);
8053 ok(ios2
.base_ios
.flags
== 0, "expected 0 got %x\n", ios2
.base_ios
.flags
);
8054 ok(ios2
.base_ios
.precision
== 6, "expected 6 got %d\n", ios2
.base_ios
.precision
);
8055 ok(ios2
.base_ios
.fill
== ' ', "expected 32 got %d\n", ios2
.base_ios
.fill
);
8056 ok(ios2
.base_ios
.width
== 0, "expected 0 got %d\n", ios2
.base_ios
.width
);
8057 ok(ios2
.base_ios
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios2
.base_ios
.do_lock
);
8060 ok(_unlink(filename
) == 0, "Couldn't unlink file named '%s'\n", filename
);
8063 static void test_Iostream_init(void)
8070 memset(&ios_obj
, 0xab, sizeof(ios
));
8072 pinit
= call_func3(p_Iostream_init_ios_ctor
, NULL
, &ios_obj
, 0);
8073 ok(pinit
== NULL
, "wrong return, expected %p got %p\n", NULL
, pinit
);
8074 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
8075 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
8076 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
8077 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
8078 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
8079 ok(ios_obj
.tie
== p_cout
, "expected %p got %p\n", p_cout
, ios_obj
.tie
);
8080 ok(ios_obj
.flags
== 0xabababab, "expected %d got %x\n", 0xabababab, ios_obj
.flags
);
8081 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
8082 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
8083 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
8084 ok(ios_obj
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.do_lock
);
8086 memset(&ios_obj
, 0xab, sizeof(ios
));
8088 pinit
= call_func3(p_Iostream_init_ios_ctor
, NULL
, &ios_obj
, -1);
8089 ok(pinit
== NULL
, "wrong return, expected %p got %p\n", NULL
, pinit
);
8090 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
8091 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
8092 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
8093 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
8094 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
8095 ok(ios_obj
.tie
== pos
, "expected %p got %p\n", pos
, ios_obj
.tie
);
8096 ok(ios_obj
.flags
== 0xabababab, "expected %d got %x\n", 0xabababab, ios_obj
.flags
);
8097 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
8098 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
8099 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
8100 ok(ios_obj
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.do_lock
);
8102 memset(&ios_obj
, 0xab, sizeof(ios
));
8103 pinit
= call_func3(p_Iostream_init_ios_ctor
, NULL
, &ios_obj
, -100);
8104 ok(pinit
== NULL
, "wrong return, expected %p got %p\n", NULL
, pinit
);
8105 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
8106 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
8107 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
8108 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
8109 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
8110 ok(ios_obj
.tie
== pos
, "expected %p got %p\n", pos
, ios_obj
.tie
);
8111 ok(ios_obj
.flags
== 0xabababab, "expected %d got %x\n", 0xabababab, ios_obj
.flags
);
8112 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
8113 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
8114 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
8115 ok(ios_obj
.do_lock
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.do_lock
);
8117 if (0) /* crashes on native */
8118 pinit
= call_func3(p_Iostream_init_ios_ctor
, NULL
, NULL
, -1);
8120 memset(&ios_obj
, 0xab, sizeof(ios
));
8121 ios_obj
.flags
= 0xcdcdcdcd;
8122 ios_obj
.do_lock
= 0x34343434;
8123 pinit
= call_func3(p_Iostream_init_ios_ctor
, (void*) 0xdeadbeef, &ios_obj
, 1);
8124 ok(pinit
== (void*) 0xdeadbeef, "wrong return, expected %p got %p\n", (void*) 0xdeadbeef, pinit
);
8125 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
8126 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
8127 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
8128 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
8129 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
8130 ok(ios_obj
.tie
== p_cout
, "expected %p got %p\n", p_cout
, ios_obj
.tie
);
8131 ok(ios_obj
.flags
== (0xcdcdcdcd|FLAGS_unitbuf
), "expected %d got %x\n",
8132 0xcdcdcdcd|FLAGS_unitbuf
, ios_obj
.flags
);
8133 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
8134 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
8135 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
8136 ok(ios_obj
.do_lock
== 0x34343434, "expected %d got %d\n", 0x34343434, ios_obj
.do_lock
);
8138 memset(&ios_obj
, 0xab, sizeof(ios
));
8139 ios_obj
.flags
= 0xcdcdcdcd;
8140 ios_obj
.do_lock
= 0x34343434;
8141 pinit
= call_func3(p_Iostream_init_ios_ctor
, (void*) 0xabababab, &ios_obj
, 5);
8142 ok(pinit
== (void*) 0xabababab, "wrong return, expected %p got %p\n", (void*) 0xabababab, pinit
);
8143 ok(ios_obj
.sb
== psb
, "expected %p got %p\n", psb
, ios_obj
.sb
);
8144 ok(ios_obj
.state
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.state
);
8145 ok(ios_obj
.special
[0] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[0]);
8146 ok(ios_obj
.special
[1] == 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.special
[1]);
8147 ok(ios_obj
.delbuf
== 1, "expected 1 got %d\n", ios_obj
.delbuf
);
8148 ok(ios_obj
.tie
== p_cout
, "expected %p got %p\n", p_cout
, ios_obj
.tie
);
8149 ok(ios_obj
.flags
== (0xcdcdcdcd|FLAGS_unitbuf
), "expected %d got %x\n",
8150 0xcdcdcdcd|FLAGS_unitbuf
, ios_obj
.flags
);
8151 ok(ios_obj
.precision
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.precision
);
8152 ok(ios_obj
.fill
== (char) 0xab, "expected -85 got %d\n", ios_obj
.fill
);
8153 ok(ios_obj
.width
== 0xabababab, "expected %d got %d\n", 0xabababab, ios_obj
.width
);
8154 ok(ios_obj
.do_lock
== 0x34343434, "expected %d got %d\n", 0x34343434, ios_obj
.do_lock
);
8157 static void test_std_streams(void)
8159 filebuf
*pfb_cin
= (filebuf
*) p_cin
->base_ios
.sb
;
8160 filebuf
*pfb_cout
= (filebuf
*) p_cout
->base_ios
.sb
;
8161 filebuf
*pfb_cerr
= (filebuf
*) p_cerr
->base_ios
.sb
;
8162 filebuf
*pfb_clog
= (filebuf
*) p_clog
->base_ios
.sb
;
8163 stdiobuf
*pstb_cin
, *pstb_cout
, *pstb_cerr
, *pstb_clog
;
8165 ok(p_cin
->extract_delim
== 0, "expected 0 got %d\n", p_cin
->extract_delim
);
8166 ok(p_cin
->count
== 0, "expected 0 got %d\n", p_cin
->count
);
8167 ok(p_cin
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cin
->base_ios
.state
);
8168 ok(p_cin
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cin
->base_ios
.delbuf
);
8169 ok(p_cin
->base_ios
.tie
== p_cout
, "expected %p got %p\n", p_cout
, p_cin
->base_ios
.tie
);
8170 ok(p_cin
->base_ios
.flags
== FLAGS_skipws
, "expected %x got %x\n", FLAGS_skipws
, p_cin
->base_ios
.flags
);
8171 ok(p_cin
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cin
->base_ios
.precision
);
8172 ok(p_cin
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cin
->base_ios
.fill
);
8173 ok(p_cin
->base_ios
.width
== 0, "expected 0 got %d\n", p_cin
->base_ios
.width
);
8174 ok(p_cin
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cin
->base_ios
.do_lock
);
8175 ok(pfb_cin
->fd
== 0, "wrong fd, expected 0 got %d\n", pfb_cin
->fd
);
8176 ok(pfb_cin
->close
== 0, "wrong value, expected 0 got %d\n", pfb_cin
->close
);
8177 ok(pfb_cin
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb_cin
->base
.allocated
);
8178 ok(pfb_cin
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb_cin
->base
.unbuffered
);
8180 ok(p_cout
->unknown
== 0, "expected 0 got %d\n", p_cout
->unknown
);
8181 ok(p_cout
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cout
->base_ios
.state
);
8182 ok(p_cout
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cout
->base_ios
.delbuf
);
8183 ok(p_cout
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_cout
->base_ios
.tie
);
8184 ok(p_cout
->base_ios
.flags
== 0, "expected 0 got %x\n", p_cout
->base_ios
.flags
);
8185 ok(p_cout
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cout
->base_ios
.precision
);
8186 ok(p_cout
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cout
->base_ios
.fill
);
8187 ok(p_cout
->base_ios
.width
== 0, "expected 0 got %d\n", p_cout
->base_ios
.width
);
8188 ok(p_cout
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cout
->base_ios
.do_lock
);
8189 ok(pfb_cout
->fd
== 1, "wrong fd, expected 1 got %d\n", pfb_cout
->fd
);
8190 ok(pfb_cout
->close
== 0, "wrong value, expected 0 got %d\n", pfb_cout
->close
);
8191 ok(pfb_cout
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb_cout
->base
.allocated
);
8192 ok(pfb_cout
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb_cout
->base
.unbuffered
);
8194 ok(p_cerr
->unknown
== 0, "expected 0 got %d\n", p_cerr
->unknown
);
8195 ok(p_cerr
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cerr
->base_ios
.state
);
8196 ok(p_cerr
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cerr
->base_ios
.delbuf
);
8197 ok(p_cerr
->base_ios
.tie
== p_cout
, "expected %p got %p\n", p_cout
, p_cerr
->base_ios
.tie
);
8198 ok(p_cerr
->base_ios
.flags
== FLAGS_unitbuf
, "expected %x got %x\n", FLAGS_unitbuf
, p_cerr
->base_ios
.flags
);
8199 ok(p_cerr
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cerr
->base_ios
.precision
);
8200 ok(p_cerr
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cerr
->base_ios
.fill
);
8201 ok(p_cerr
->base_ios
.width
== 0, "expected 0 got %d\n", p_cerr
->base_ios
.width
);
8202 ok(p_cerr
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cerr
->base_ios
.do_lock
);
8203 ok(pfb_cerr
->fd
== 2, "wrong fd, expected 2 got %d\n", pfb_cerr
->fd
);
8204 ok(pfb_cerr
->close
== 0, "wrong value, expected 0 got %d\n", pfb_cerr
->close
);
8205 ok(pfb_cerr
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb_cerr
->base
.allocated
);
8206 ok(pfb_cerr
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb_cerr
->base
.unbuffered
);
8208 ok(p_clog
->unknown
== 0, "expected 0 got %d\n", p_clog
->unknown
);
8209 ok(p_clog
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_clog
->base_ios
.state
);
8210 ok(p_clog
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_clog
->base_ios
.delbuf
);
8211 ok(p_clog
->base_ios
.tie
== p_cout
, "expected %p got %p\n", p_cout
, p_clog
->base_ios
.tie
);
8212 ok(p_clog
->base_ios
.flags
== 0, "expected 0 got %x\n", p_clog
->base_ios
.flags
);
8213 ok(p_clog
->base_ios
.precision
== 6, "expected 6 got %d\n", p_clog
->base_ios
.precision
);
8214 ok(p_clog
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_clog
->base_ios
.fill
);
8215 ok(p_clog
->base_ios
.width
== 0, "expected 0 got %d\n", p_clog
->base_ios
.width
);
8216 ok(p_clog
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_clog
->base_ios
.do_lock
);
8217 ok(pfb_clog
->fd
== 2, "wrong fd, expected 2 got %d\n", pfb_clog
->fd
);
8218 ok(pfb_clog
->close
== 0, "wrong value, expected 0 got %d\n", pfb_clog
->close
);
8219 ok(pfb_clog
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pfb_clog
->base
.allocated
);
8220 ok(pfb_clog
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pfb_clog
->base
.unbuffered
);
8222 /* sync_with_stdio */
8223 ok(*p_ios_sunk_with_stdio
== 0, "expected 0 got %d\n", *p_ios_sunk_with_stdio
);
8224 p_cin
->extract_delim
= p_cin
->count
= 0xabababab;
8225 p_cin
->base_ios
.state
= 0xabababab;
8226 p_cin
->base_ios
.fill
= 0xab;
8227 p_cin
->base_ios
.precision
= p_cin
->base_ios
.width
= 0xabababab;
8228 p_cout
->unknown
= 0xabababab;
8229 p_cout
->base_ios
.state
= 0xabababab;
8230 p_cout
->base_ios
.fill
= 0xab;
8231 p_cout
->base_ios
.precision
= p_cout
->base_ios
.width
= 0xabababab;
8232 p_cerr
->unknown
= 0xabababab;
8233 p_cerr
->base_ios
.state
= 0xabababab;
8234 p_cerr
->base_ios
.fill
= 0xab;
8235 p_cerr
->base_ios
.precision
= p_cerr
->base_ios
.width
= 0xabababab;
8236 p_clog
->unknown
= 0xabababab;
8237 p_clog
->base_ios
.state
= 0xabababab;
8238 p_clog
->base_ios
.fill
= 0xab;
8239 p_clog
->base_ios
.precision
= p_clog
->base_ios
.width
= 0xabababab;
8240 p_ios_sync_with_stdio();
8241 ok(*p_ios_sunk_with_stdio
== 1, "expected 1 got %d\n", *p_ios_sunk_with_stdio
);
8243 pstb_cin
= (stdiobuf
*) p_cin
->base_ios
.sb
;
8244 ok(p_cin
->extract_delim
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cin
->extract_delim
);
8245 ok(p_cin
->count
== 0, "expected 0 got %d\n", p_cin
->count
);
8246 ok(p_cin
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cin
->base_ios
.state
);
8247 ok(p_cin
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cin
->base_ios
.delbuf
);
8248 ok(p_cin
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_cin
->base_ios
.tie
);
8249 ok(p_cin
->base_ios
.flags
== (FLAGS_skipws
|FLAGS_stdio
), "expected %x got %x\n",
8250 FLAGS_skipws
|FLAGS_stdio
, p_cin
->base_ios
.flags
);
8251 ok(p_cin
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cin
->base_ios
.precision
);
8252 ok(p_cin
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cin
->base_ios
.fill
);
8253 ok(p_cin
->base_ios
.width
== 0, "expected 0 got %d\n", p_cin
->base_ios
.width
);
8254 ok(p_cin
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cin
->base_ios
.do_lock
);
8255 ok(pstb_cin
->file
== stdin
, "wrong file pointer, expected %p got %p\n", stdin
, pstb_cin
->file
);
8256 ok(pstb_cin
->base
.allocated
== 0, "wrong allocate value, expected 0 got %d\n", pstb_cin
->base
.allocated
);
8257 ok(pstb_cin
->base
.unbuffered
== 1, "wrong unbuffered value, expected 1 got %d\n", pstb_cin
->base
.unbuffered
);
8258 ok(pstb_cin
->base
.ebuf
== NULL
, "wrong ebuf pointer, expected %p got %p\n", NULL
, pstb_cin
->base
.eback
);
8259 ok(pstb_cin
->base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, pstb_cin
->base
.eback
);
8260 ok(pstb_cin
->base
.pbase
== NULL
, "wrong put base, expected %p got %p\n", NULL
, pstb_cin
->base
.pbase
);
8262 pstb_cout
= (stdiobuf
*) p_cout
->base_ios
.sb
;
8263 ok(p_cout
->unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cout
->unknown
);
8264 ok(p_cout
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cout
->base_ios
.state
);
8265 ok(p_cout
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cout
->base_ios
.delbuf
);
8266 ok(p_cout
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_cout
->base_ios
.tie
);
8267 ok(p_cout
->base_ios
.flags
== (FLAGS_unitbuf
|FLAGS_stdio
), "expected %x got %x\n",
8268 FLAGS_unitbuf
|FLAGS_stdio
, p_cout
->base_ios
.flags
);
8269 ok(p_cout
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cout
->base_ios
.precision
);
8270 ok(p_cout
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cout
->base_ios
.fill
);
8271 ok(p_cout
->base_ios
.width
== 0, "expected 0 got %d\n", p_cout
->base_ios
.width
);
8272 ok(p_cout
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cout
->base_ios
.do_lock
);
8273 ok(pstb_cout
->file
== stdout
, "wrong file pointer, expected %p got %p\n", stdout
, pstb_cout
->file
);
8274 ok(pstb_cout
->base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", pstb_cout
->base
.allocated
);
8275 ok(pstb_cout
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pstb_cout
->base
.unbuffered
);
8276 ok(pstb_cout
->base
.ebuf
== pstb_cout
->base
.base
+ 80, "wrong ebuf pointer, expected %p got %p\n",
8277 pstb_cout
->base
.base
+ 80, pstb_cout
->base
.eback
);
8278 ok(pstb_cout
->base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, pstb_cout
->base
.eback
);
8279 ok(pstb_cout
->base
.pbase
== pstb_cout
->base
.base
, "wrong put base, expected %p got %p\n",
8280 pstb_cout
->base
.base
, pstb_cout
->base
.pbase
);
8281 ok(pstb_cout
->base
.pptr
== pstb_cout
->base
.base
, "wrong put pointer, expected %p got %p\n",
8282 pstb_cout
->base
.base
, pstb_cout
->base
.pptr
);
8283 ok(pstb_cout
->base
.epptr
== pstb_cout
->base
.base
+ 80, "wrong put end, expected %p got %p\n",
8284 pstb_cout
->base
.base
+ 80, pstb_cout
->base
.epptr
);
8286 pstb_cerr
= (stdiobuf
*) p_cerr
->base_ios
.sb
;
8287 ok(p_cerr
->unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cerr
->unknown
);
8288 ok(p_cerr
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_cerr
->base_ios
.state
);
8289 ok(p_cerr
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_cerr
->base_ios
.delbuf
);
8290 ok(p_cerr
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_cerr
->base_ios
.tie
);
8291 ok(p_cerr
->base_ios
.flags
== (FLAGS_unitbuf
|FLAGS_stdio
), "expected %x got %x\n",
8292 FLAGS_unitbuf
|FLAGS_stdio
, p_cerr
->base_ios
.flags
);
8293 ok(p_cerr
->base_ios
.precision
== 6, "expected 6 got %d\n", p_cerr
->base_ios
.precision
);
8294 ok(p_cerr
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_cerr
->base_ios
.fill
);
8295 ok(p_cerr
->base_ios
.width
== 0, "expected 0 got %d\n", p_cerr
->base_ios
.width
);
8296 ok(p_cerr
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_cerr
->base_ios
.do_lock
);
8297 ok(pstb_cerr
->file
== stderr
, "wrong file pointer, expected %p got %p\n", stderr
, pstb_cerr
->file
);
8298 ok(pstb_cerr
->base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", pstb_cerr
->base
.allocated
);
8299 ok(pstb_cerr
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pstb_cerr
->base
.unbuffered
);
8300 ok(pstb_cerr
->base
.ebuf
== pstb_cerr
->base
.base
+ 80, "wrong ebuf pointer, expected %p got %p\n",
8301 pstb_cerr
->base
.base
+ 80, pstb_cerr
->base
.eback
);
8302 ok(pstb_cerr
->base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, pstb_cerr
->base
.eback
);
8303 ok(pstb_cerr
->base
.pbase
== pstb_cerr
->base
.base
, "wrong put base, expected %p got %p\n",
8304 pstb_cerr
->base
.base
, pstb_cerr
->base
.pbase
);
8305 ok(pstb_cerr
->base
.pptr
== pstb_cerr
->base
.base
, "wrong put pointer, expected %p got %p\n",
8306 pstb_cerr
->base
.base
, pstb_cerr
->base
.pptr
);
8307 ok(pstb_cerr
->base
.epptr
== pstb_cerr
->base
.base
+ 80, "wrong put end, expected %p got %p\n",
8308 pstb_cerr
->base
.base
+ 80, pstb_cerr
->base
.epptr
);
8310 pstb_clog
= (stdiobuf
*) p_clog
->base_ios
.sb
;
8311 ok(p_clog
->unknown
== 0xabababab, "expected %d got %d\n", 0xabababab, p_clog
->unknown
);
8312 ok(p_clog
->base_ios
.state
== IOSTATE_goodbit
, "expected %d got %d\n", IOSTATE_goodbit
, p_clog
->base_ios
.state
);
8313 ok(p_clog
->base_ios
.delbuf
== 1, "expected 1 got %d\n", p_clog
->base_ios
.delbuf
);
8314 ok(p_clog
->base_ios
.tie
== NULL
, "expected %p got %p\n", NULL
, p_clog
->base_ios
.tie
);
8315 ok(p_clog
->base_ios
.flags
== FLAGS_stdio
, "expected %x got %x\n", FLAGS_stdio
, p_clog
->base_ios
.flags
);
8316 ok(p_clog
->base_ios
.precision
== 6, "expected 6 got %d\n", p_clog
->base_ios
.precision
);
8317 ok(p_clog
->base_ios
.fill
== ' ', "expected 32 got %d\n", p_clog
->base_ios
.fill
);
8318 ok(p_clog
->base_ios
.width
== 0, "expected 0 got %d\n", p_clog
->base_ios
.width
);
8319 ok(p_clog
->base_ios
.do_lock
== -1, "expected -1 got %d\n", p_clog
->base_ios
.do_lock
);
8320 ok(pstb_clog
->file
== stderr
, "wrong file pointer, expected %p got %p\n", stderr
, pstb_clog
->file
);
8321 ok(pstb_clog
->base
.allocated
== 1, "wrong allocate value, expected 1 got %d\n", pstb_clog
->base
.allocated
);
8322 ok(pstb_clog
->base
.unbuffered
== 0, "wrong unbuffered value, expected 0 got %d\n", pstb_clog
->base
.unbuffered
);
8323 ok(pstb_clog
->base
.ebuf
== pstb_clog
->base
.base
+ 512, "wrong ebuf pointer, expected %p got %p\n",
8324 pstb_clog
->base
.base
+ 512, pstb_clog
->base
.eback
);
8325 ok(pstb_clog
->base
.eback
== NULL
, "wrong get base, expected %p got %p\n", NULL
, pstb_clog
->base
.eback
);
8326 ok(pstb_clog
->base
.pbase
== pstb_clog
->base
.base
, "wrong put base, expected %p got %p\n",
8327 pstb_clog
->base
.base
, pstb_clog
->base
.pbase
);
8328 ok(pstb_clog
->base
.pptr
== pstb_clog
->base
.base
, "wrong put pointer, expected %p got %p\n",
8329 pstb_clog
->base
.base
, pstb_clog
->base
.pptr
);
8330 ok(pstb_clog
->base
.epptr
== pstb_clog
->base
.base
+ 512, "wrong put end, expected %p got %p\n",
8331 pstb_clog
->base
.base
+ 512, pstb_clog
->base
.epptr
);
8333 p_cin
->count
= 0xabababab;
8334 p_ios_sync_with_stdio();
8335 ok(*p_ios_sunk_with_stdio
== 1, "expected 1 got %d\n", *p_ios_sunk_with_stdio
);
8336 ok(p_cin
->count
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cin
->count
);
8337 p_ios_sync_with_stdio();
8338 ok(*p_ios_sunk_with_stdio
== 1, "expected 1 got %d\n", *p_ios_sunk_with_stdio
);
8339 ok(p_cin
->count
== 0xabababab, "expected %d got %d\n", 0xabababab, p_cin
->count
);
8342 static void test_fstream(void)
8350 const char *filename
= "fstream_test";
8353 pfs
= call_func5(p_fstream_open_ctor
, &fs
, filename
, OPENMODE_out
, filebuf_openprot
, TRUE
);
8354 ok(pfs
== &fs
, "constructor returned wrong pointer, expected %p got %p\n", &fs
, pfs
);
8355 ok(fs
.base_ios
.state
== IOSTATE_goodbit
, "wrong stream state, expected %d got %d\n", IOSTATE_goodbit
, fs
.base_ios
.state
);
8356 pfb
= (filebuf
*) fs
.base_ios
.sb
;
8357 ok((int) call_func1(p_filebuf_is_open
, pfb
) == TRUE
, "expected filebuf to be open\n");
8358 ok(fs
.base_ios
.delbuf
== 1, "internal filebuf not makred for deletion\n");
8360 /* integration with ostream */
8361 pos
= call_func2(p_ostream_print_str
, (ostream
*) &fs
.base2
, "ftest ");
8362 ok(pos
== (ostream
*) &fs
.base2
, "stream operation returned wrong pointer, expected %p got %p\n", &fs
, &fs
.base2
);
8363 pos
= call_func2(p_ostream_print_int
, (ostream
*) &fs
.base2
, 15);
8364 ok(pos
== (ostream
*) &fs
.base2
, "stream operation returned wrong pointer, expected %p got %p\n", &fs
, &fs
.base2
);
8366 /* make sure that OPENMODE_in is not implied */
8367 ok(_lseek(pfb
->fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
8368 ok(_read(pfb
->fd
, st
, 1) == -1, "_read succeeded on OPENMODE_out only fstream\n");
8370 /* reopen the file for reading */
8371 call_func1(p_fstream_vbase_dtor
, &fs
);
8372 pfs
= call_func5(p_fstream_open_ctor
, &fs
, filename
, OPENMODE_in
, filebuf_openprot
, TRUE
);
8373 ok(pfs
== &fs
, "constructor returned wrong pointer, expected %p got %p\n", &fs
, pfs
);
8374 ok(fs
.base_ios
.state
== IOSTATE_goodbit
, "wrong stream state, expected %d got %d\n", IOSTATE_goodbit
, fs
.base_ios
.state
);
8375 pfb
= (filebuf
*) fs
.base_ios
.sb
;
8376 ok((int) call_func1(p_filebuf_is_open
, pfb
) == TRUE
, "expected filebuf to be open\n");
8378 /* integration with istream */
8379 memset(st
, 'A', sizeof(st
));
8380 pis
= call_func2(p_istream_read_str
, (istream
*) &fs
.base1
, st
);
8381 ok(pis
== (istream
*) &fs
.base1
, "stream operation returned wrong pointer, expected %p got %p\n", &fs
, &fs
.base1
);
8383 ok(!strcmp(st
, "ftest"), "expected 'ftest' got '%s'\n", st
);
8386 pis
= call_func2(p_istream_read_int
, (istream
*) &fs
.base1
, &i
);
8387 ok(pis
== (istream
*) &fs
.base1
, "stream operation returned wrong pointer, expected %p got %p\n", &fs
, &fs
.base1
);
8388 ok(i
== 15, "expected 12 got %d\n", i
);
8390 /* make sure that OPENMODE_out is not implied */
8391 ok(_lseek(pfb
->fd
, 0, SEEK_SET
) == 0, "_lseek failed\n");
8392 ok(_write(pfb
->fd
, "blabla", 6) == -1, "_write succeeded on OPENMODE_in fstream\n");
8395 call_func1(p_fstream_vbase_dtor
, &fs
);
8396 ok(_unlink(filename
) == 0, "Couldn't unlink file named '%s', some filedescs are still open?\n", filename
);
8399 static void test_exception(void)
8401 const char *unknown
= "Unknown exception";
8402 const char *test
= "test";
8408 memset(&e
, 0, sizeof(e
));
8409 what
= call_func1(p_exception_what
, (void*) &e
);
8410 ok(!strcmp(what
, unknown
), "expected %s got %s\n", unknown
, what
);
8412 call_func2(p_exception_ctor
, (void*) &e
, &test
);
8413 what
= call_func1(p_exception_what
, (void*) &e
);
8414 ok(!strcmp(what
, test
), "expected %s got %s\n", test
, what
);
8415 call_func1(p_exception_dtor
, (void*) &e
);
8418 memset(&le
, 0xff, sizeof(le
));
8419 call_func2(p_logic_error_ctor
, (void*) &le
, &test
);
8420 ok(!strcmp(le
.e
.name
, test
), "expected %s got %s\n", test
, le
.e
.name
);
8421 ok(le
.e
.do_free
, "expected TRUE, got FALSE\n");
8422 what
= call_func1(p_exception_what
, (void*) &le
.e
);
8423 ok(!strcmp(what
, test
), "expected %s got %s\n", test
, what
);
8424 call_func1(p_logic_error_dtor
, (void*) &le
);
8427 static DWORD WINAPI
_try_enter_critical(void *crit
)
8429 BOOL ret
= TryEnterCriticalSection(crit
);
8432 LeaveCriticalSection(crit
);
8437 static void test_mtlock_mtunlock(void)
8439 CRITICAL_SECTION crit
;
8441 DWORD exit_code
, ret
;
8443 InitializeCriticalSection(&crit
);
8447 thread
= CreateThread(NULL
, 0, _try_enter_critical
, &crit
, 0, NULL
);
8448 ok(thread
!= NULL
, "failed to create a thread, error: %x\n", GetLastError());
8449 ret
= WaitForSingleObject(thread
, 1000);
8450 ok(ret
== WAIT_OBJECT_0
, "failed to wait for the thread, ret: %d, error: %x\n", ret
, GetLastError());
8451 ok(GetExitCodeThread(thread
, &exit_code
), "failed to get exit code of the thread\n");
8452 ok(exit_code
== FALSE
, "the thread entered critical section\n");
8453 ret
= CloseHandle(thread
);
8454 ok(ret
, "failed to close thread's handle, error: %x\n", GetLastError());
8458 thread
= CreateThread(NULL
, 0, _try_enter_critical
, &crit
, 0, NULL
);
8459 ok(thread
!= NULL
, "failed to create a thread, error: %x\n", GetLastError());
8460 ret
= WaitForSingleObject(thread
, 1000);
8461 ok(ret
== WAIT_OBJECT_0
, "failed to wait for the thread, ret: %d, error: %x\n", ret
, GetLastError());
8462 ok(GetExitCodeThread(thread
, &exit_code
), "failed to get exit code of the thread\n");
8463 ok(exit_code
== TRUE
, "the thread was not able to enter critical section\n");
8464 ret
= CloseHandle(thread
);
8465 ok(ret
, "failed to close thread's handle, error: %x\n", GetLastError());
8475 test_strstreambuf();
8479 test_ostream_print();
8480 test_ostream_withassign();
8484 test_istream_getint();
8485 test_istream_getdouble();
8486 test_istream_read();
8487 test_istream_withassign();
8493 test_Iostream_init();
8497 test_mtlock_mtunlock();
8499 FreeLibrary(msvcrt
);
8500 FreeLibrary(msvcirt
);