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 vfprintf function. Tests the (uppercase) |
10 | ** hexadecimal specifier (%X) |
11 | ** |
12 | ** |
13 | **==========================================================================*/ |
14 | |
15 | |
16 | |
17 | #include <palsuite.h> |
18 | #include "../vfprintf.h" |
19 | |
20 | |
21 | |
22 | int __cdecl main(int argc, char *argv[]) |
23 | { |
24 | int neg = -42; |
25 | int pos = 0x1234AB; |
26 | INT64 l = I64(0x1234567887654321); |
27 | |
28 | if (PAL_Initialize(argc, argv)) |
29 | { |
30 | return FAIL; |
31 | } |
32 | |
33 | |
34 | DoNumTest("foo %X" , pos, "foo 1234AB" ); |
35 | DoNumTest("foo %lX" , pos, "foo 1234AB" ); |
36 | DoNumTest("foo %hX" , pos, "foo 34AB" ); |
37 | DoNumTest("foo %LX" , pos, "foo 1234AB" ); |
38 | DoI64Test("foo %I64X" , l, "0x1234567887654321" , |
39 | "foo 1234567887654321" ); |
40 | DoNumTest("foo %7X" , pos, "foo 1234AB" ); |
41 | DoNumTest("foo %-7X" , pos, "foo 1234AB " ); |
42 | DoNumTest("foo %.1X" , pos, "foo 1234AB" ); |
43 | DoNumTest("foo %.7X" , pos, "foo 01234AB" ); |
44 | DoNumTest("foo %07X" , pos, "foo 01234AB" ); |
45 | DoNumTest("foo %#X" , pos, "foo 0X1234AB" ); |
46 | DoNumTest("foo %+X" , pos, "foo 1234AB" ); |
47 | DoNumTest("foo % X" , pos, "foo 1234AB" ); |
48 | DoNumTest("foo %+X" , neg, "foo FFFFFFD6" ); |
49 | DoNumTest("foo % X" , neg, "foo FFFFFFD6" ); |
50 | |
51 | PAL_Terminate(); |
52 | return PASS; |
53 | } |
54 | |
55 | |