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 vprintf function. Test the unsigned int
10** specifier (%u).
11**
12**
13**==========================================================================*/
14
15
16
17#include <palsuite.h>
18#include "../vprintf.h"
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))
27 {
28 return FAIL;
29 }
30
31
32 DoNumTest("foo %u", pos, "foo 42");
33 DoNumTest("foo %lu", 0xFFFF, "foo 65535");
34 DoNumTest("foo %hu", 0xFFFF, "foo 65535");
35 DoNumTest("foo %Lu", pos, "foo 42");
36 DoI64Test("foo %I64u", l, "42", "foo 42");
37 DoNumTest("foo %3u", pos, "foo 42");
38 DoNumTest("foo %-3u", pos, "foo 42 ");
39 DoNumTest("foo %.1u", pos, "foo 42");
40 DoNumTest("foo %.3u", pos, "foo 042");
41 DoNumTest("foo %03u", pos, "foo 042");
42 DoNumTest("foo %#u", pos, "foo 42");
43 DoNumTest("foo %+u", pos, "foo 42");
44 DoNumTest("foo % u", pos, "foo 42");
45 DoNumTest("foo %+u", neg, "foo 4294967254");
46 DoNumTest("foo % u", neg, "foo 4294967254");
47
48 PAL_Terminate();
49 return PASS;
50}
51
52