[APITESTS/CRT]
[reactos.git] / rostests / apitests / crt / _vscwprintf.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for _vscprintf
5 */
6
7 #include <stdio.h>
8 #include <wine/test.h>
9 #include <tchar.h>
10 #include <errno.h>
11
12 static void call_varargs(int expected_ret, LPCWSTR formatString, ...)
13 {
14 va_list args;
15 int ret;
16 /* Test the basic functionality */
17 va_start(args, formatString);
18 ret = _vscwprintf(formatString, args);
19 ok(expected_ret == ret, "Test failed: expected %i, got %i.\n", expected_ret, ret);
20 }
21
22 START_TEST(_vscwprintf)
23 {
24 /* Lesson of the day: don't mix wide and ansi char */
25 call_varargs(19, L"%s world!", "hello");
26 call_varargs(12, L"%s world!", L"hello");
27 call_varargs(17, L"Jack ate %u pies", 100);
28
29 /* Test NULL argument */
30 call_varargs(-1, NULL);
31 #if defined(TEST_MSVCRT) /* NTDLL doesn't use/set errno */
32 ok(errno == EINVAL, "Expected EINVAL, got %u\n", errno);
33 #endif
34 }