[PATCH] msvcrt/tests: Add tests for mbstowcs and wcstombs with a negative count.

Alex Henrie alexhenrie24 at gmail.com
Sun Jun 12 15:07:17 CDT 2016


Cc: Piotr Caban <piotr at codeweavers.com>

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/msvcrt/tests/string.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c
index 8e78695..c4cad67 100644
--- a/dlls/msvcrt/tests/string.c
+++ b/dlls/msvcrt/tests/string.c
@@ -1858,6 +1858,15 @@ static void test_mbstowcs(void)
     ret = mbstowcs(NULL, mSimple, 0);
     ok(ret == 4, "mbstowcs did not return 4\n");
 
+    ret = mbstowcs(wOut, mSimple, -1);
+todo_wine
+    ok(ret == -1 || broken(ret == 4) /* xp */, "mbstowcs returned %i instead of -1\n", ret);
+
+    ret = mbstowcs(wOut, mSimple, -1000);
+todo_wine
+    ok(ret == -1 || broken(ret == 4) /* xp */, "mbstowcs returned %i instead of -1\n", ret);
+
+    wOut[4] = '!'; /* xp overwrites it */
     ret = mbstowcs(wOut, mSimple, 4);
     ok(ret == 4, "mbstowcs did not return 4\n");
     ok(!memcmp(wOut, wSimple, 4*sizeof(wchar_t)), "wOut = %s\n", wine_dbgstr_w(wOut));
@@ -1866,6 +1875,14 @@ static void test_mbstowcs(void)
     ret = wcstombs(NULL, wSimple, 0);
     ok(ret == 4, "wcstombs did not return 4\n");
 
+    ret = wcstombs(mOut, wSimple, -1);
+todo_wine
+    ok(ret == -1 || broken(ret == 4) /* xp */, "wcstombs returned %i instead of -1\n", ret);
+
+    ret = wcstombs(mOut, wSimple, -1000);
+todo_wine
+    ok(ret == -1 || broken(ret == 4) /* xp */, "wcstombs returned %i instead of -1\n", ret);
+
     ret = wcstombs(mOut, wSimple, 6);
     ok(ret == 4, "wcstombs did not return 4\n");
     ok(!memcmp(mOut, mSimple, 5*sizeof(char)), "mOut = %s\n", mOut);
-- 
2.8.3




More information about the wine-patches mailing list