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: test8.c
8**
9** Purpose: Test #8 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 %d"), pos, convert("foo 42"));
30 DoNumTest(convert("foo %ld"), 0xFFFF, convert("foo 65535"));
31 DoNumTest(convert("foo %hd"), 0xFFFF, convert("foo -1"));
32 DoNumTest(convert("foo %Ld"), pos, convert("foo 42"));
33 DoI64NumTest(convert("foo %I64d"), l, "42", convert("foo 42"));
34 DoNumTest(convert("foo %3d"), pos, convert("foo 42"));
35 DoNumTest(convert("foo %-3d"), pos, convert("foo 42 "));
36 DoNumTest(convert("foo %.1d"), pos, convert("foo 42"));
37 DoNumTest(convert("foo %.3d"), pos, convert("foo 042"));
38 DoNumTest(convert("foo %03d"), pos, convert("foo 042"));
39 DoNumTest(convert("foo %#d"), pos, convert("foo 42"));
40 DoNumTest(convert("foo %+d"), pos, convert("foo +42"));
41 DoNumTest(convert("foo % d"), pos, convert("foo 42"));
42 DoNumTest(convert("foo %+d"), neg, convert("foo -42"));
43 DoNumTest(convert("foo % d"), neg, convert("foo -42"));
44
45 PAL_Terminate();
46 return PASS;
47}
48