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 vsprintf function. |
10 | ** |
11 | ** |
12 | **===================================================================*/ |
13 | |
14 | #include <palsuite.h> |
15 | #include "../vsprintf.h" |
16 | |
17 | /* |
18 | * Notes: memcmp is used, as is strlen. |
19 | */ |
20 | |
21 | int __cdecl main(int argc, char *argv[]) |
22 | { |
23 | int neg = -42; |
24 | int pos = 42; |
25 | INT64 l = 42; |
26 | |
27 | if (PAL_Initialize(argc, argv) != 0) |
28 | { |
29 | return(FAIL); |
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 | |