Iván Matellanes : msvcirt/tests: Add tests of ostrstream::pcount.
Module: wine Branch: master Commit: 2d4e7d405055b3151c4cd5ac9a2c2f6bf0ce3b8a URL: http://source.winehq.org/git/wine.git/?a=commit;h=2d4e7d405055b3151c4cd5ac9a... Author: Iván Matellanes <matellanesivan(a)gmail.com> Date: Wed Oct 19 14:00:54 2016 +0200 msvcirt/tests: Add tests of ostrstream::pcount. Signed-off-by: Iván Matellanes <matellanesivan(a)gmail.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcirt/tests/msvcirt.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c index e656866..db3ee3b 100644 --- a/dlls/msvcirt/tests/msvcirt.c +++ b/dlls/msvcirt/tests/msvcirt.c @@ -336,6 +336,7 @@ static ostream* (*__thiscall p_ostrstream_ctor)(ostream*, BOOL); static void (*__thiscall p_ostrstream_dtor)(ios*); static void (*__thiscall p_ostrstream_vbase_dtor)(ostream*); static ostream* (*__thiscall p_ostrstream_assign)(ostream*, const ostream*); +static int (*__thiscall p_ostrstream_pcount)(const ostream*); /* istream */ static istream* (*__thiscall p_istream_copy_ctor)(istream*, const istream*, BOOL); @@ -608,6 +609,7 @@ static BOOL init(void) SET(p_ostrstream_dtor, "??1ostrstream@@UEAA(a)XZ"); SET(p_ostrstream_vbase_dtor, "??_Dostrstream@@QEAAXXZ"); SET(p_ostrstream_assign, "??4ostrstream@@QEAAAEAV0(a)AEBV0@@Z"); + SET(p_ostrstream_pcount, "?pcount(a)ostrstream@@QEBAHXZ"); SET(p_istream_copy_ctor, "??0istream@@IEAA(a)AEBV0@@Z"); SET(p_istream_ctor, "??0istream@@IEAA(a)XZ"); @@ -794,6 +796,7 @@ static BOOL init(void) SET(p_ostrstream_dtor, "??1ostrstream@@UAE(a)XZ"); SET(p_ostrstream_vbase_dtor, "??_Dostrstream@@QAEXXZ"); SET(p_ostrstream_assign, "??4ostrstream@@QAEAAV0(a)ABV0@@Z"); + SET(p_ostrstream_pcount, "?pcount(a)ostrstream@@QBEHXZ"); SET(p_istream_copy_ctor, "??0istream@@IAE(a)ABV0@@Z"); SET(p_istream_ctor, "??0istream@@IAE(a)XZ"); @@ -3996,6 +3999,7 @@ static void test_ostrstream(void) ostream os1, os2, *pos, *pos2; strstreambuf *pssb; char buffer[32]; + int ret; memset(&os1, 0xab, sizeof(ostream)); memset(&os2, 0xab, sizeof(ostream)); @@ -4253,6 +4257,28 @@ static void test_ostrstream(void) 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 == 0xabababab, "expected %d got %d\n", 0xabababab, os2.base_ios.do_lock); + + /* pcount */ + pos = call_func2(p_ostrstream_ctor, &os1, TRUE); + ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos); + ret = (int) call_func1(p_ostrstream_pcount, &os1); + ok(ret == 0, "expected 0 got %d\n", ret); + pssb = (strstreambuf*) os1.base_ios.sb; + pssb->base.pptr = (char*) 5; + ret = (int) call_func1(p_ostrstream_pcount, &os1); + ok(ret == 5, "expected 5 got %d\n", ret); + pssb->base.pbase = (char*) 2; + ret = (int) call_func1(p_ostrstream_pcount, &os1); + ok(ret == 3, "expected 3 got %d\n", ret); + pssb->base.pptr = NULL; + ret = (int) call_func1(p_ostrstream_pcount, &os1); + ok(ret == 0, "expected 0 got %d\n", ret); + if (0) /* crashes on native */ + os1.base_ios.sb = NULL; + pssb->base.pptr = (char*) 1; + ret = (int) call_func1(p_ostrstream_pcount, &os1); + ok(ret == 0, "expected 0 got %d\n", ret); + call_func1(p_ostrstream_vbase_dtor, &os1); } static void test_istream(void)
participants (1)
-
Alexandre Julliard