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: test4.c |
8 | ** |
9 | ** Purpose: Test #4 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 | |
22 | int __cdecl main(int argc, char *argv[]) |
23 | { |
24 | void *ptr = (void*) 0x123456; |
25 | INT64 lptr = I64(0x1234567887654321); |
26 | |
27 | if (PAL_Initialize(argc, argv) != 0) |
28 | { |
29 | return(FAIL); |
30 | } |
31 | /* |
32 | ** Run only on 64 bit platforms |
33 | */ |
34 | #if defined(BIT64) |
35 | Trace("Testing for 64 Bit Platforms \n" ); |
36 | DoPointerTest("%p" , NULL, "NULL" , "0000000000000000" ); |
37 | DoPointerTest("%p" , ptr, "pointer to 0x123456" , "0000000000123456" ); |
38 | DoPointerTest("%17p" , ptr, "pointer to 0x123456" , " 0000000000123456" ); |
39 | DoPointerTest("%17p" , ptr, "pointer to 0x123456" , " 0000000000123456" ); |
40 | DoPointerTest("%-17p" , ptr, "pointer to 0x123456" , "0000000000123456 " ); |
41 | DoPointerTest("%+p" , ptr, "pointer to 0x123456" , "0000000000123456" ); |
42 | DoPointerTest("%#p" , ptr, "pointer to 0x123456" , "0X0000000000123456" ); |
43 | DoPointerTest("%lp" , ptr, "pointer to 0x123456" , "00123456" ); |
44 | DoPointerTest("%hp" , ptr, "pointer to 0x123456" , "00003456" ); |
45 | DoPointerTest("%Lp" , ptr, "pointer to 0x123456" , "00123456" ); |
46 | DoI64DoubleTest("%I64p" , lptr, "pointer to 0x1234567887654321" , |
47 | "1234567887654321" ); |
48 | #else |
49 | Trace("Testing for Non 64 Bit Platforms \n" ); |
50 | DoPointerTest("%p" , NULL, "NULL" , "00000000" ); |
51 | DoPointerTest("%p" , ptr, "pointer to 0x123456" , "00123456" ); |
52 | DoPointerTest("%9p" , ptr, "pointer to 0x123456" , " 00123456" ); |
53 | DoPointerTest("%09p" , ptr, "pointer to 0x123456" , " 00123456" ); |
54 | DoPointerTest("%-9p" , ptr, "pointer to 0x123456" , "00123456 " ); |
55 | DoPointerTest("%+p" , ptr, "pointer to 0x123456" , "00123456" ); |
56 | DoPointerTest("%#p" , ptr, "pointer to 0x123456" , "0X00123456" ); |
57 | DoPointerTest("%lp" , ptr, "pointer to 0x123456" , "00123456" ); |
58 | DoPointerTest("%hp" , ptr, "pointer to 0x123456" , "00003456" ); |
59 | DoPointerTest("%Lp" , ptr, "pointer to 0x123456" , "00123456" ); |
60 | DoI64DoubleTest("%I64p" , lptr, "pointer to 0x1234567887654321" , |
61 | "1234567887654321" ); |
62 | #endif |
63 | |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | PAL_Terminate(); |
70 | return PASS; |
71 | } |
72 | |
73 | |