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: test11.c
8**
9** Purpose: Test #11 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
20int __cdecl main(int argc, char *argv[])
21{
22 int neg = -42;
23 int pos = 42;
24 INT64 l = 42;
25
26 if (PAL_Initialize(argc, argv) != 0)
27 return(FAIL);
28
29 DoNumTest(convert("foo %u"), pos, convert("foo 42"));
30 DoNumTest(convert("foo %lu"), 0xFFFF, convert("foo 65535"));
31 DoNumTest(convert("foo %hu"), 0xFFFF, convert("foo 65535"));
32 DoNumTest(convert("foo %Lu"), pos, convert("foo 42"));
33 DoI64NumTest(convert("foo %I64u"), l, "42", convert("foo 42"));
34 DoNumTest(convert("foo %3u"), pos, convert("foo 42"));
35 DoNumTest(convert("foo %-3u"), pos, convert("foo 42 "));
36 DoNumTest(convert("foo %.1u"), pos, convert("foo 42"));
37 DoNumTest(convert("foo %.3u"), pos, convert("foo 042"));
38 DoNumTest(convert("foo %03u"), pos, convert("foo 042"));
39 DoNumTest(convert("foo %#u"), pos, convert("foo 42"));
40 DoNumTest(convert("foo %+u"), pos, convert("foo 42"));
41 DoNumTest(convert("foo % u"), pos, convert("foo 42"));
42 DoNumTest(convert("foo %+u"), neg, convert("foo 4294967254"));
43 DoNumTest(convert("foo % u"), neg, convert("foo 4294967254"));
44
45
46 PAL_Terminate();
47 return PASS;
48}
49