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: test13.c
8**
9** Purpose: Test #13 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 = 0x1234ab;
24 INT64 l = I64(0x1234567887654321);
25
26 if (PAL_Initialize(argc, argv) != 0)
27 return(FAIL);
28
29 DoNumTest(convert("foo %X"), pos, convert("foo 1234AB"));
30 DoNumTest(convert("foo %lX"), pos, convert("foo 1234AB"));
31 DoNumTest(convert("foo %hX"), pos, convert("foo 34AB"));
32 DoNumTest(convert("foo %LX"), pos, convert("foo 1234AB"));
33 DoI64NumTest(convert("foo %I64X"), l, "0x1234567887654321",
34 convert("foo 1234567887654321"));
35 DoNumTest(convert("foo %7X"), pos, convert("foo 1234AB"));
36 DoNumTest(convert("foo %-7X"), pos, convert("foo 1234AB "));
37 DoNumTest(convert("foo %.1X"), pos, convert("foo 1234AB"));
38 DoNumTest(convert("foo %.7X"), pos, convert("foo 01234AB"));
39 DoNumTest(convert("foo %07X"), pos, convert("foo 01234AB"));
40 DoNumTest(convert("foo %#X"), pos, convert("foo 0X1234AB"));
41 DoNumTest(convert("foo %+X"), pos, convert("foo 1234AB"));
42 DoNumTest(convert("foo % X"), pos, convert("foo 1234AB"));
43 DoNumTest(convert("foo %+X"), neg, convert("foo FFFFFFD6"));
44 DoNumTest(convert("foo % X"), neg, convert("foo FFFFFFD6"));
45
46 PAL_Terminate();
47 return PASS;
48}
49