[6/6] msvcr80/tests: _itow_s tests (try 2)

Vincas Miliūnas vincas.miliunas at gmail.com
Wed Nov 3 06:49:21 CDT 2010


qsort_s and _itow_s implementation and tests for bug #24925.
Because of Thunderbird's default text formatting, the patch got broken; a good resource on solving this is http://kerneltrap.org/Linux/Email_Clients_and_Patches

---
 dlls/msvcr80/tests/msvcr80.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/dlls/msvcr80/tests/msvcr80.c b/dlls/msvcr80/tests/msvcr80.c
index 89037f7..db3dee2 100644
--- a/dlls/msvcr80/tests/msvcr80.c
+++ b/dlls/msvcr80/tests/msvcr80.c
@@ -28,6 +28,7 @@
 typedef int (CDECL *_QSORT_S_COMPARE_FN)(void *, const void *, const void *);
 
 static void (__cdecl *p_qsort_s)(void *, size_t, size_t, _QSORT_S_COMPARE_FN, void *);
+static errno_t (__cdecl *p_itow_s)(int, wchar_t *, size_t, int);
 
 static int g_context_counter;
 
@@ -128,6 +129,29 @@ static void test_qsort_s(void)
 
 /* ########## */
 
+static void test__itow_s(void)
+{
+    wchar_t actual[128], expected[128];
+    char buffer[128];
+    errno_t err;
+
+#define PERFORM(input, output, radix) \
+    err = p_itow_s(input, actual, 128, radix); \
+    ok(err == 0, "err = %u\n", err); \
+    mbstowcs(expected, #output, 128); \
+    wcstombs(buffer, actual, 128); \
+    ok(wcscmp(expected, actual) == 0, "invalid: expected = " #output ", actual = %s\n", buffer);
+
+    PERFORM(42, 42, 10)
+    PERFORM(-42, -42, 10)
+    PERFORM(42, 101010, 2)
+    PERFORM(42, 2a, 16)
+
+#undef PERFORM
+}
+
+/* ########## */
+
 START_TEST(msvcr80)
 {
     HMODULE hcrt;
@@ -140,7 +164,9 @@ START_TEST(msvcr80)
     }
 
     p_qsort_s = (void *) GetProcAddress(hcrt, "qsort_s");
+    p_itow_s = (void *) GetProcAddress(hcrt, "_itow_s");
 
     test_qsort_s();
+    test__itow_s();
 }
 
-- 
1.7.2.3




More information about the wine-patches mailing list