Hans Leidekker : msvcrt: Add a test for _vsnwprintf.

Alexandre Julliard julliard at winehq.org
Tue Jan 27 09:08:11 CST 2009


Module: wine
Branch: master
Commit: 120120e37ea470fcac13e83ff7a3399be2ef5e99
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=120120e37ea470fcac13e83ff7a3399be2ef5e99

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Jan 27 11:58:49 2009 +0100

msvcrt: Add a test for _vsnwprintf.

---

 dlls/msvcrt/tests/printf.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c
index 9d31f86..d25734e 100644
--- a/dlls/msvcrt/tests/printf.c
+++ b/dlls/msvcrt/tests/printf.c
@@ -27,6 +27,10 @@
  
 #include <stdio.h>
 
+#include "windef.h"
+#include "winbase.h"
+#include "winnls.h"
+
 #include "wine/test.h"
 
 static void test_sprintf( void )
@@ -694,10 +698,39 @@ static void test_fcvt(void)
     ok( 0 == sign, "sign wrong\n");
 }
 
+static int _vsnwprintf_wrapper(wchar_t *str, size_t len, const wchar_t *format, ...)
+{
+    int ret;
+    __ms_va_list valist;
+    __ms_va_start(valist, format);
+    ret = _vsnwprintf(str, len, format, valist);
+    __ms_va_end(valist);
+    return ret;
+}
+
+static void test_vsnwprintf(void)
+{
+    const wchar_t format[] = {'%','w','s','%','w','s','%','w','s',0};
+    const wchar_t one[]    = {'o','n','e',0};
+    const wchar_t two[]    = {'t','w','o',0};
+    const wchar_t three[]  = {'t','h','r','e','e',0};
+
+    int ret;
+    wchar_t str[32];
+    char buf[32];
+
+    ret = _vsnwprintf_wrapper( str, sizeof(str)/sizeof(str[0]), format, one, two, three );
+
+    ok( ret == 11, "got %d expected 11\n", ret );
+    WideCharToMultiByte( CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL );
+    ok( !strcmp(buf, "onetwothree"), "got %s expected 'onetwothree'\n", buf );
+}
+
 START_TEST(printf)
 {
     test_sprintf();
     test_swprintf();
     test_snprintf();
     test_fcvt();
+    test_vsnwprintf();
 }




More information about the wine-cvs mailing list