Zebediah Figura : ntdll/tests: Add more tests for printf format specifiers.

Alexandre Julliard julliard at winehq.org
Sun Feb 2 12:56:44 CST 2020


Module: wine
Branch: master
Commit: 9c3dcdfb6c36e8301a09f5e13fbec8c37571899d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9c3dcdfb6c36e8301a09f5e13fbec8c37571899d

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Jan 30 21:36:14 2020 -0600

ntdll/tests: Add more tests for printf format specifiers.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/tests/string.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/tests/string.c b/dlls/ntdll/tests/string.c
index 12027e8899..72428fca91 100644
--- a/dlls/ntdll/tests/string.c
+++ b/dlls/ntdll/tests/string.c
@@ -1349,7 +1349,28 @@ static void test__snprintf(void)
     memset(buffer, 0x7c, sizeof(buffer));
     res = p__snprintf(buffer, 3, "test");
     ok(res == -1, "res = %d\n", res);
- }
+
+    res = p__snprintf(buffer, sizeof(buffer), "%I64x %d", (ULONGLONG)0x1234567890, 1);
+    ok(res == strlen(buffer), "wrong size %d\n", res);
+    ok(!strcmp(buffer, "1234567890 1"), "got %s\n", debugstr_a(buffer));
+
+    res = p__snprintf(buffer, sizeof(buffer), "%I32x %d", 0x123456, 1);
+    ok(res == strlen(buffer), "wrong size %d\n", res);
+    ok(!strcmp(buffer, "123456 1"), "got %s\n", debugstr_a(buffer));
+
+    if (sizeof(void *) == 8)
+    {
+        res = p__snprintf(buffer, sizeof(buffer), "%Ix %d", (ULONG_PTR)0x1234567890, 1);
+        ok(res == strlen(buffer), "wrong size %d\n", res);
+        todo_wine ok(!strcmp(buffer, "1234567890 1"), "got %s\n", debugstr_a(buffer));
+    }
+    else
+    {
+        res = p__snprintf(buffer, sizeof(buffer), "%Ix %d", (ULONG_PTR)0x123456, 1);
+        ok(res == strlen(buffer), "wrong size %d\n", res);
+        ok(!strcmp(buffer, "123456 1"), "got %s\n", debugstr_a(buffer));
+    }
+}
 
 static void test__snprintf_s(void)
 {




More information about the wine-cvs mailing list