[6/6] msvcirt/tests: Add tests of istream_withassign assignment operators.

Iván Matellanes matellanesivan at gmail.com
Fri Aug 5 06:12:56 CDT 2016


Signed-off-by: Iván Matellanes <matellanesivan at gmail.com>
---
 dlls/msvcirt/tests/msvcirt.c | 71 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c
index 6db235c..0f09688 100644
--- a/dlls/msvcirt/tests/msvcirt.c
+++ b/dlls/msvcirt/tests/msvcirt.c
@@ -358,6 +358,9 @@ static istream_withassign* (*__thiscall p_istream_withassign_copy_ctor)(istream_
 static istream_withassign* (*__thiscall p_istream_withassign_ctor)(istream_withassign*, BOOL);
 static void (*__thiscall p_istream_withassign_dtor)(ios*);
 static void (*__thiscall p_istream_withassign_vbase_dtor)(istream_withassign*);
+static istream_withassign* (*__thiscall p_istream_withassign_assign_sb)(istream_withassign*, streambuf*);
+static istream_withassign* (*__thiscall p_istream_withassign_assign_is)(istream_withassign*, const istream*);
+static istream_withassign* (*__thiscall p_istream_withassign_assign)(istream_withassign*, const istream_withassign*);
 
 /* Emulate a __thiscall */
 #ifdef __i386__
@@ -600,6 +603,9 @@ static BOOL init(void)
         SET(p_istream_withassign_ctor, "??0istream_withassign@@QEAA at XZ");
         SET(p_istream_withassign_dtor, "??1ostream_withassign@@UEAA at XZ");
         SET(p_istream_withassign_vbase_dtor, "??_Distream_withassign@@QEAAXXZ");
+        SET(p_istream_withassign_assign_sb, "??4istream_withassign@@QEAAAEAVistream@@PEAVstreambuf@@@Z");
+        SET(p_istream_withassign_assign_is, "??4istream_withassign@@QEAAAEAVistream@@AEBV1@@Z");
+        SET(p_istream_withassign_assign, "??4istream_withassign@@QEAAAEAV0 at AEBV0@@Z");
     } else {
         p_operator_new = (void*)GetProcAddress(msvcrt, "??2 at YAPAXI@Z");
         p_operator_delete = (void*)GetProcAddress(msvcrt, "??3 at YAXPAX@Z");
@@ -764,6 +770,9 @@ static BOOL init(void)
         SET(p_istream_withassign_ctor, "??0istream_withassign@@QAE at XZ");
         SET(p_istream_withassign_dtor, "??1istream_withassign@@UAE at XZ");
         SET(p_istream_withassign_vbase_dtor, "??_Distream_withassign@@QAEXXZ");
+        SET(p_istream_withassign_assign_sb, "??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z");
+        SET(p_istream_withassign_assign_is, "??4istream_withassign@@QAEAAVistream@@ABV1@@Z");
+        SET(p_istream_withassign_assign, "??4istream_withassign@@QAEAAV0 at ABV0@@Z");
     }
     SET(p_ios_static_lock, "?x_lockc at ios@@0U_CRT_CRITICAL_SECTION@@A");
     SET(p_ios_lockc, "?lockc at ios@@KAXXZ");
@@ -5572,6 +5581,68 @@ static void test_istream_withassign(void)
     ok(isa2.base_ios.fill == (char) 0xab, "expected -85 got %d\n", isa2.base_ios.fill);
     ok(isa2.base_ios.width == 0xabababab, "expected %d got %d\n", 0xabababab, isa2.base_ios.width);
     call_func1(p_istream_withassign_dtor, &isa2.base_ios);
+
+    /* assignment */
+    isa2.extract_delim = isa2.count = 0xabababab;
+    isa2.base_ios.delbuf = 0xabababab;
+    pisa = call_func2(p_istream_withassign_assign_sb, &isa2, &sb);
+    ok(pisa == &isa2, "wrong return, expected %p got %p\n", &isa2, pisa);
+    ok(isa2.extract_delim == 0xabababab, "expected %d got %d\n", 0xabababab, isa2.extract_delim);
+    ok(isa2.count == 0, "expected 0 got %d\n", isa2.count);
+    ok(isa2.base_ios.sb == &sb, "expected %p got %p\n", &sb, isa2.base_ios.sb);
+    ok(isa2.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, isa2.base_ios.state);
+    ok(isa2.base_ios.delbuf == 0, "expected 0 got %d\n", isa2.base_ios.delbuf);
+    ok(isa2.base_ios.tie == NULL, "expected %p got %p\n", NULL, isa2.base_ios.tie);
+    ok(isa2.base_ios.flags == FLAGS_skipws, "expected %x got %x\n", FLAGS_skipws, isa2.base_ios.flags);
+    ok(isa2.base_ios.precision == 6, "expected 6 got %d\n", isa2.base_ios.precision);
+    ok(isa2.base_ios.fill == ' ', "expected 32 got %d\n", isa2.base_ios.fill);
+    ok(isa2.base_ios.width == 0, "expected 0 got %d\n", isa2.base_ios.width);
+    isa2.count = 0xabababab;
+    memset(&isa2.base_ios, 0xab, sizeof(ios));
+    isa2.base_ios.delbuf = 0;
+    pisa = call_func2(p_istream_withassign_assign_sb, &isa2, NULL);
+    ok(pisa == &isa2, "wrong return, expected %p got %p\n", &isa2, pisa);
+    ok(isa2.extract_delim == 0xabababab, "expected %d got %d\n", 0xabababab, isa2.extract_delim);
+    ok(isa2.count == 0, "expected 0 got %d\n", isa2.count);
+    ok(isa2.base_ios.sb == NULL, "expected %p got %p\n", NULL, isa2.base_ios.sb);
+    ok(isa2.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, isa2.base_ios.state);
+    ok(isa2.base_ios.delbuf == 0, "expected 0 got %d\n", isa2.base_ios.delbuf);
+    ok(isa2.base_ios.tie == NULL, "expected %p got %p\n", NULL, isa2.base_ios.tie);
+    ok(isa2.base_ios.flags == FLAGS_skipws, "expected %x got %x\n", FLAGS_skipws, isa2.base_ios.flags);
+    ok(isa2.base_ios.precision == 6, "expected 6 got %d\n", isa2.base_ios.precision);
+    ok(isa2.base_ios.fill == ' ', "expected 32 got %d\n", isa2.base_ios.fill);
+    ok(isa2.base_ios.width == 0, "expected 0 got %d\n", isa2.base_ios.width);
+    isa2.count = 0xabababab;
+    memset(&isa2.base_ios, 0xab, sizeof(ios));
+    isa2.base_ios.delbuf = 0;
+    pisa = call_func2(p_istream_withassign_assign_is, &isa2, &isa1);
+    ok(pisa == &isa2, "wrong return, expected %p got %p\n", &isa2, pisa);
+    ok(isa2.extract_delim == 0xabababab, "expected %d got %d\n", 0xabababab, isa2.extract_delim);
+    ok(isa2.count == 0, "expected 0 got %d\n", isa2.count);
+    ok(isa2.base_ios.sb == NULL, "expected %p got %p\n", NULL, isa2.base_ios.sb);
+    ok(isa2.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, isa2.base_ios.state);
+    ok(isa2.base_ios.delbuf == 0, "expected 0 got %d\n", isa2.base_ios.delbuf);
+    ok(isa2.base_ios.tie == NULL, "expected %p got %p\n", NULL, isa2.base_ios.tie);
+    ok(isa2.base_ios.flags == FLAGS_skipws, "expected %x got %x\n", FLAGS_skipws, isa2.base_ios.flags);
+    ok(isa2.base_ios.precision == 6, "expected 6 got %d\n", isa2.base_ios.precision);
+    ok(isa2.base_ios.fill == ' ', "expected 32 got %d\n", isa2.base_ios.fill);
+    ok(isa2.base_ios.width == 0, "expected 0 got %d\n", isa2.base_ios.width);
+    isa1.base_ios.sb = &sb;
+    isa2.count = 0xabababab;
+    memset(&isa2.base_ios, 0xab, sizeof(ios));
+    isa2.base_ios.delbuf = 0;
+    pisa = call_func2(p_istream_withassign_assign, &isa2, &isa1);
+    ok(pisa == &isa2, "wrong return, expected %p got %p\n", &isa2, pisa);
+    ok(isa2.extract_delim == 0xabababab, "expected %d got %d\n", 0xabababab, isa2.extract_delim);
+    ok(isa2.count == 0, "expected 0 got %d\n", isa2.count);
+    ok(isa2.base_ios.sb == &sb, "expected %p got %p\n", &sb, isa2.base_ios.sb);
+    ok(isa2.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, isa2.base_ios.state);
+    ok(isa2.base_ios.delbuf == 0, "expected 0 got %d\n", isa2.base_ios.delbuf);
+    ok(isa2.base_ios.tie == NULL, "expected %p got %p\n", NULL, isa2.base_ios.tie);
+    ok(isa2.base_ios.flags == FLAGS_skipws, "expected %x got %x\n", FLAGS_skipws, isa2.base_ios.flags);
+    ok(isa2.base_ios.precision == 6, "expected 6 got %d\n", isa2.base_ios.precision);
+    ok(isa2.base_ios.fill == ' ', "expected 32 got %d\n", isa2.base_ios.fill);
+    ok(isa2.base_ios.width == 0, "expected 0 got %d\n", isa2.base_ios.width);
 }
 
 START_TEST(msvcirt)
-- 
2.7.4




More information about the wine-patches mailing list