msvcirt/tests: Add some more tests of ostream constructors.
Signed-off-by: Iván Matellanes <matellanesivan@gmail.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a29ff2caca
commit
b7c19e1e3e
|
@ -2900,36 +2900,66 @@ static void test_ostream(void) {
|
|||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb == NULL, "expected %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 0, "expected 0 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == NULL, "expected %p got %p\n", NULL, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0, "expected 0 got %x\n", os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 6, "expected 6 got %d\n", os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == ' ', "expected 32 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0, "expected 0 got %d\n", os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == -1, "expected -1 got %d\n", os1.base_ios.do_lock);
|
||||
call_func1(p_ostream_vbase_dtor, &os1);
|
||||
memset(&os1, 0xab, sizeof(ostream));
|
||||
pos = call_func3(p_ostream_sb_ctor, &os1, &fb1.base, TRUE);
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb == &fb1.base, "expected %p got %p\n", &fb1.base, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 0, "expected 0 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == NULL, "expected %p got %p\n", NULL, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0, "expected 0 got %x\n", os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 6, "expected 6 got %d\n", os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == ' ', "expected 32 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0, "expected 0 got %d\n", os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == -1, "expected -1 got %d\n", os1.base_ios.do_lock);
|
||||
ok(fb1.base.allocated == 0xabababab, "expected %d got %d\n", 0xabababab, fb1.base.allocated);
|
||||
call_func1(p_filebuf_ctor, &fb1);
|
||||
pfb = call_func4(p_filebuf_open, &fb1, filename1, OPENMODE_out, filebuf_openprot);
|
||||
ok(pfb == &fb1, "wrong return, expected %p got %p\n", &fb1, pfb);
|
||||
ok(fb1.base.allocated == 1, "expected %d got %d\n", 1, fb1.base.allocated);
|
||||
call_func1(p_ostream_vbase_dtor, &os1);
|
||||
ok(os1.base_ios.sb == NULL, "expected %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os1.base_ios.state);
|
||||
memset(&os1.base_ios, 0xab, sizeof(ios));
|
||||
os1.unknown = 0xabababab;
|
||||
os1.base_ios.state = 0xabababab | IOSTATE_badbit;
|
||||
pos = call_func2(p_ostream_ctor, &os1, FALSE);
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb == os2.base_ios.sb, "expected %p got %p\n", os2.base_ios.sb, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.state);
|
||||
ok(os1.base_ios.state == (0xabababab|IOSTATE_badbit), "expected %d got %d\n",
|
||||
0xabababab|IOSTATE_badbit, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == os2.base_ios.tie, "expected %p got %p\n", os2.base_ios.tie, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0xabababab, "expected %x got %x\n", 0xabababab, os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == (char) 0xab, "expected -85 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.do_lock);
|
||||
call_func1(p_ostream_dtor, &os1.base_ios);
|
||||
os1.unknown = 0xabababab;
|
||||
os1.base_ios.state = 0xabababab | IOSTATE_badbit;
|
||||
os1.base_ios.delbuf = 0;
|
||||
call_func1(p_filebuf_ctor, &fb1);
|
||||
pfb = call_func4(p_filebuf_open, &fb1, filename1, OPENMODE_out, filebuf_openprot);
|
||||
ok(pfb == &fb1, "wrong return, expected %p got %p\n", &fb1, pfb);
|
||||
ok(fb1.base.allocated == 1, "expected %d got %d\n", 1, fb1.base.allocated);
|
||||
pos = call_func3(p_ostream_sb_ctor, &os1, &fb1.base, FALSE);
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb == &fb1.base, "expected %p got %p\n", &fb1.base, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 0, "expected 0 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == os2.base_ios.tie, "expected %p got %p\n", os2.base_ios.tie, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0xabababab, "expected %x got %x\n", 0xabababab, os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == (char) 0xab, "expected -85 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.do_lock);
|
||||
call_func1(p_ostream_dtor, &os1.base_ios);
|
||||
memset(&os1, 0xab, sizeof(ostream));
|
||||
pos = call_func3(p_ostream_sb_ctor, &os1, NULL, TRUE);
|
||||
|
@ -2937,11 +2967,32 @@ static void test_ostream(void) {
|
|||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb == NULL, "expected %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 0, "expected 0 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == NULL, "expected %p got %p\n", NULL, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0, "expected 0 got %x\n", os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 6, "expected 6 got %d\n", os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == ' ', "expected 32 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0, "expected 0 got %d\n", os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == -1, "expected -1 got %d\n", os1.base_ios.do_lock);
|
||||
call_func1(p_ostream_vbase_dtor, &os1);
|
||||
os1.unknown = 0xcdcdcdcd;
|
||||
memset(&os1.base_ios, 0xcd, sizeof(ios));
|
||||
memset(&os2, 0xab, sizeof(ostream));
|
||||
os2.vbtable = os1.vbtable;
|
||||
os1.unknown = 0xcdcdcdcd;
|
||||
pos = call_func3(p_ostream_copy_ctor, &os2, &os1, TRUE);
|
||||
ok(pos == &os2, "wrong return, expected %p got %p\n", &os2, pos);
|
||||
ok(os2.unknown == 0, "expected 0 got %d\n", os2.unknown);
|
||||
ok(os2.base_ios.sb == os1.base_ios.sb, "expected %p got %p\n", os1.base_ios.sb, os2.base_ios.sb);
|
||||
ok(os2.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, os2.base_ios.state);
|
||||
ok(os2.base_ios.delbuf == 0, "expected 0 got %d\n", os2.base_ios.delbuf);
|
||||
ok(os2.base_ios.tie == NULL, "expected %p got %p\n", NULL, os2.base_ios.tie);
|
||||
ok(os2.base_ios.flags == 0, "expected 0 got %x\n", os2.base_ios.flags);
|
||||
ok(os2.base_ios.precision == 6, "expected 6 got %d\n", os2.base_ios.precision);
|
||||
ok(os2.base_ios.fill == ' ', "expected 32 got %d\n", os2.base_ios.fill);
|
||||
ok(os2.base_ios.width == 0, "expected 0 got %d\n", os2.base_ios.width);
|
||||
ok(os2.base_ios.do_lock == -1, "expected -1 got %d\n", os2.base_ios.do_lock);
|
||||
call_func1(p_ostream_vbase_dtor, &os2);
|
||||
memset(&os2.base_ios, 0xab, sizeof(ios));
|
||||
os2.unknown = 0xabababab;
|
||||
os2.base_ios.state = 0xabababab | IOSTATE_badbit;
|
||||
os2.base_ios.delbuf = 0;
|
||||
os2.base_ios.tie = &os2;
|
||||
pos = call_func3(p_ostream_copy_ctor, &os2, &os1, FALSE);
|
||||
|
@ -2955,18 +3006,21 @@ static void test_ostream(void) {
|
|||
ok(os2.base_ios.precision == 0xabababab, "expected %d got %d\n", 0xabababab, os2.base_ios.precision);
|
||||
ok(os2.base_ios.fill == (char) 0xab, "expected -85 got %d\n", os2.base_ios.fill);
|
||||
ok(os2.base_ios.width == 0xabababab, "expected %d got %d\n", 0xabababab, os2.base_ios.width);
|
||||
ok(os2.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, os2.base_ios.do_lock);
|
||||
call_func1(p_ostream_dtor, &os2.base_ios);
|
||||
os1.base_ios.sb = NULL;
|
||||
pos = call_func3(p_ostream_copy_ctor, &os2, &os1, TRUE);
|
||||
ok(pos == &os2, "wrong return, expected %p got %p\n", &os2, pos);
|
||||
ok(os2.unknown == 0, "expected 0 got %d\n", os2.unknown);
|
||||
ok(os2.base_ios.sb == os1.base_ios.sb, "expected %p got %p\n", os1.base_ios.sb, os2.base_ios.sb);
|
||||
ok(os2.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, os2.base_ios.state);
|
||||
ok(os2.base_ios.sb == NULL, "expected %p got %p\n", NULL, os2.base_ios.sb);
|
||||
ok(os2.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os2.base_ios.state);
|
||||
ok(os2.base_ios.delbuf == 0, "expected 0 got %d\n", os2.base_ios.delbuf);
|
||||
ok(os2.base_ios.tie == NULL, "expected %p got %p\n", NULL, os2.base_ios.tie);
|
||||
ok(os2.base_ios.flags == 0, "expected 0 got %x\n", os2.base_ios.flags);
|
||||
ok(os2.base_ios.precision == 6, "expected 6 got %d\n", os2.base_ios.precision);
|
||||
ok(os2.base_ios.fill == ' ', "expected 32 got %d\n", os2.base_ios.fill);
|
||||
ok(os2.base_ios.width == 0, "expected 0 got %d\n", os2.base_ios.width);
|
||||
ok(os2.base_ios.do_lock == -1, "expected -1 got %d\n", os2.base_ios.do_lock);
|
||||
|
||||
/* assignment */
|
||||
pos = call_func2(p_ostream_ctor, &os1, TRUE);
|
||||
|
@ -2979,6 +3033,7 @@ static void test_ostream(void) {
|
|||
os1.base_ios.flags = 0xabababab;
|
||||
os1.base_ios.precision = 0xabababab;
|
||||
os1.base_ios.width = 0xabababab;
|
||||
os1.base_ios.do_lock = 0xabababab;
|
||||
pos = call_func2(p_ostream_assign_sb, &os1, &fb1.base);
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0xabababab, "expected 0 got %d\n", os1.unknown);
|
||||
|
@ -2990,20 +3045,41 @@ static void test_ostream(void) {
|
|||
ok(os1.base_ios.flags == 0, "expected 0 got %x\n", os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 6, "expected 6 got %d\n", os1.base_ios.precision);
|
||||
ok(os1.base_ios.width == 0, "expected 0 got %d\n", os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.do_lock);
|
||||
os1.base_ios.state = 0x8000;
|
||||
pos = call_func2(p_ostream_assign_sb, &os1, NULL);
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0xabababab, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb == NULL, "expected %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os1.base_ios.state);
|
||||
ok(os1.base_ios.special[0] == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.fill);
|
||||
ok(os1.base_ios.delbuf == 0, "expected 0 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == NULL, "expected %p got %p\n", NULL, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0, "expected 0 got %x\n", os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 6, "expected 6 got %d\n", os1.base_ios.precision);
|
||||
ok(os1.base_ios.width == 0, "expected 0 got %d\n", os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.do_lock);
|
||||
os2.unknown = 0xcdcdcdcd;
|
||||
os2.base_ios.state = 0xcdcdcdcd;
|
||||
os2.base_ios.special[0] = 0xcdcdcdcd;
|
||||
os2.base_ios.delbuf = 0xcdcdcdcd;
|
||||
os2.base_ios.tie = (ostream*) 0xcdcdcdcd;
|
||||
os2.base_ios.flags = 0xcdcdcdcd;
|
||||
os2.base_ios.precision = 0xcdcdcdcd;
|
||||
os2.base_ios.width = 0xcdcdcdcd;
|
||||
os2.base_ios.do_lock = 0xcdcdcdcd;
|
||||
pos = call_func2(p_ostream_assign, &os2, &os1);
|
||||
ok(pos == &os2, "wrong return, expected %p got %p\n", &os2, pos);
|
||||
ok(os2.unknown == 0xcdcdcdcd, "expected 0 got %d\n", os2.unknown);
|
||||
ok(os2.base_ios.sb == NULL, "expected %p got %p\n", NULL, os2.base_ios.sb);
|
||||
ok(os2.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os2.base_ios.state);
|
||||
ok(os2.base_ios.special[0] == 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, os2.base_ios.fill);
|
||||
ok(os2.base_ios.delbuf == 0, "expected 0 got %d\n", os2.base_ios.delbuf);
|
||||
ok(os2.base_ios.tie == NULL, "expected %p got %p\n", NULL, os2.base_ios.tie);
|
||||
ok(os2.base_ios.flags == 0, "expected 0 got %x\n", os2.base_ios.flags);
|
||||
ok(os2.base_ios.precision == 6, "expected 6 got %d\n", os2.base_ios.precision);
|
||||
ok(os2.base_ios.width == 0, "expected 0 got %d\n", os2.base_ios.width);
|
||||
ok(os2.base_ios.do_lock == 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, os2.base_ios.do_lock);
|
||||
|
||||
/* flush */
|
||||
if (0) /* crashes on native */
|
||||
|
|
Loading…
Reference in New Issue