msvcrt: Add a test for _vsnwprintf.

This commit is contained in:
Hans Leidekker 2009-01-27 11:58:49 +01:00 committed by Alexandre Julliard
parent 8fec17b5ad
commit 120120e37e
1 changed files with 33 additions and 0 deletions

View File

@ -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();
}