2012-07-21 20:00:56 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS api tests
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* PURPOSE: Test for _vscprintf
|
|
|
|
*/
|
|
|
|
|
2013-09-22 17:52:42 +00:00
|
|
|
#include <apitest.h>
|
|
|
|
|
2012-07-21 20:00:56 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <tchar.h>
|
2012-07-21 20:15:12 +00:00
|
|
|
#include <errno.h>
|
2012-07-21 20:00:56 +00:00
|
|
|
|
|
|
|
static void call_varargs(int expected_ret, LPCWSTR formatString, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
int ret;
|
|
|
|
/* Test the basic functionality */
|
|
|
|
va_start(args, formatString);
|
|
|
|
ret = _vscwprintf(formatString, args);
|
2012-08-31 17:20:56 +00:00
|
|
|
ok(expected_ret == ret, "expected %i, got %i.\n", expected_ret, ret);
|
2012-07-21 20:00:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(_vscwprintf)
|
|
|
|
{
|
|
|
|
/* Lesson of the day: don't mix wide and ansi char */
|
2012-08-31 17:20:56 +00:00
|
|
|
/* Lesson of the week: don't ignore the lesson of the day */
|
|
|
|
call_varargs(12, L"%hs world!", "hello");
|
2012-07-21 20:00:56 +00:00
|
|
|
call_varargs(12, L"%s world!", L"hello");
|
|
|
|
call_varargs(17, L"Jack ate %u pies", 100);
|
2012-08-31 14:16:17 +00:00
|
|
|
/* Do not test NULL argument. That is verified to SEGV on a */
|
|
|
|
/* release-build with VC10 and MS' msvcrt. */
|
2012-07-21 20:00:56 +00:00
|
|
|
}
|