[PATCH 1/3] msvcrt/tests: Add _fcvt_s tests.

Eryk Wieliczko ewdevel at gmail.com
Tue Dec 21 17:00:13 CST 2010


---
 dlls/msvcrt/tests/printf.c |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c
index 87efd16..e304755 100644
--- a/dlls/msvcrt/tests/printf.c
+++ b/dlls/msvcrt/tests/printf.c
@@ -40,6 +40,8 @@ static int (__cdecl *p__vsnwprintf_s)(wchar_t *str, size_t sizeOfBuffer,
                                       __ms_va_list valist);
 static int (__cdecl *p__ecvt_s)(char *buffer, size_t length, double number,
                                 int ndigits, int *decpt, int *sign);
+static int (__cdecl *p__fcvt_s)(char *buffer, size_t length, double number,
+                                int ndigits, int *decpt, int *sign);
 
 static void init( void )
 {
@@ -49,6 +51,7 @@ static void init( void )
     p__vscwprintf = (void *)GetProcAddress(hmod, "_vscwprintf");
     p__vsnwprintf_s = (void *)GetProcAddress(hmod, "_vsnwprintf_s");
     p__ecvt_s = (void *)GetProcAddress(hmod, "_ecvt_s");
+    p__fcvt_s = (void *)GetProcAddress(hmod, "_fcvt_s");
 }
 
 static void test_sprintf( void )
@@ -799,13 +802,13 @@ static void test_xcvt(void)
                 "_fcvt() decimal point wrong, got %d expected %d\n", decpt,
                 test_cvt_testcases[i].expdecpt_f);
         ok( sign == test_cvt_testcases[i].expsign,
-                "_ecvt() sign wrong, got %d expected %d\n", sign,
+                "_fcvt() sign wrong, got %d expected %d\n", sign,
                 test_cvt_testcases[i].expsign);
     }
 
+    str = malloc(1024);
     if (p__ecvt_s)
     {
-        str = malloc(1024);
         for( i = 0; strcmp( test_cvt_testcases[i].expstr_e, "END"); i++){
             decpt = sign = 100;
             err = p__ecvt_s(str, 1024, test_cvt_testcases[i].value, test_cvt_testcases[i].nrdigits, &decpt, &sign);
@@ -820,10 +823,30 @@ static void test_xcvt(void)
                     "_ecvt_s() sign wrong, got %d expected %d\n", sign,
                     test_cvt_testcases[i].expsign);
         }
-        free(str);
     }
     else
        win_skip("_ecvt_s not available\n");
+
+    if (p__fcvt_s)
+    {
+        for( i = 0; strcmp( test_cvt_testcases[i].expstr_e, "END"); i++){
+            decpt = sign = 100;
+            err = p__fcvt_s(str, 1024, test_cvt_testcases[i].value, test_cvt_testcases[i].nrdigits, &decpt, &sign);
+            ok(err == 0, "_fcvt_s() failed with error code %d", err);
+            ok( 0 == strncmp( str, test_cvt_testcases[i].expstr_f, 15),
+                   "_fcvt_s() bad return, got \n'%s' expected \n'%s'\n", str,
+                  test_cvt_testcases[i].expstr_e);
+            ok( decpt == test_cvt_testcases[i].expdecpt_f,
+                    "_fcvt_s() decimal point wrong, got %d expected %d\n", decpt,
+                    test_cvt_testcases[i].expdecpt_e);
+            ok( sign == test_cvt_testcases[i].expsign,
+                    "_fcvt_s() sign wrong, got %d expected %d\n", sign,
+                    test_cvt_testcases[i].expsign);
+        }
+    }
+    else
+       win_skip("_fcvt_s not available\n");
+   free(str);
 }
 
 static int __cdecl _vsnwprintf_wrapper(wchar_t *str, size_t len, const wchar_t *format, ...)
-- 
1.7.0.4




More information about the wine-patches mailing list