1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5/*=====================================================================
6**
7** Source: test2.c
8**
9** Purpose: Test #2 for the vswprintf function.
10**
11**
12**===================================================================*/
13
14#include <palsuite.h>
15#include "../vswprintf.h"
16
17/* memcmp is used to verify the results, so this test is dependent on it. */
18/* ditto with wcslen */
19
20
21int __cdecl main(int argc, char *argv[])
22{
23 if (PAL_Initialize(argc, argv) != 0)
24 return(FAIL);
25
26 DoWStrTest(convert("foo %s"), convert("bar"), convert("foo bar"));
27 DoStrTest(convert("foo %hs"), "bar", convert("foo bar"));
28 DoWStrTest(convert("foo %ls"), convert("bar"), convert("foo bar"));
29 DoWStrTest(convert("foo %ws"), convert("bar"), convert("foo bar"));
30 DoWStrTest(convert("foo %Ls"), convert("bar"), convert("foo bar"));
31 DoWStrTest(convert("foo %I64s"), convert("bar"), convert("foo bar"));
32 DoWStrTest(convert("foo %5s"), convert("bar"), convert("foo bar"));
33 DoWStrTest(convert("foo %.2s"), convert("bar"), convert("foo ba"));
34 DoWStrTest(convert("foo %5.2s"), convert("bar"), convert("foo ba"));
35 DoWStrTest(convert("foo %-5s"), convert("bar"), convert("foo bar "));
36 DoWStrTest(convert("foo %05s"), convert("bar"), convert("foo 00bar"));
37 DoWStrTest(convert("foo %s"), NULL, convert("foo (null)"));
38 DoStrTest(convert("foo %hs"), NULL, convert("foo (null)"));
39 DoWStrTest(convert("foo %ls"), NULL, convert("foo (null)"));
40 DoWStrTest(convert("foo %ws"), NULL, convert("foo (null)"));
41 DoWStrTest(convert("foo %Ls"), NULL, convert("foo (null)"));
42 DoWStrTest(convert("foo %I64s"), NULL, convert("foo (null)"));
43
44 PAL_Terminate();
45 return PASS;
46}
47