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: test18.c |
8 | ** |
9 | ** Purpose: Test #18 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 | double val = 2560.001; |
24 | double neg = -2560.001; |
25 | |
26 | if (PAL_Initialize(argc, argv) != 0) |
27 | { |
28 | return(FAIL); |
29 | } |
30 | |
31 | DoDoubleTest("foo %G" , val, "foo 2560" , "foo 2560" ); |
32 | DoDoubleTest("foo %lG" , val, "foo 2560" , "foo 2560" ); |
33 | DoDoubleTest("foo %hG" , val, "foo 2560" , "foo 2560" ); |
34 | DoDoubleTest("foo %LG" , val, "foo 2560" , "foo 2560" ); |
35 | DoDoubleTest("foo %I64G" , val, "foo 2560" , "foo 2560" ); |
36 | DoDoubleTest("foo %5G" , val, "foo 2560" , "foo 2560" ); |
37 | DoDoubleTest("foo %-5G" , val, "foo 2560 " , "foo 2560 " ); |
38 | DoDoubleTest("foo %.1G" , val, "foo 3E+003" , "foo 3E+03" ); |
39 | DoDoubleTest("foo %.2G" , val, "foo 2.6E+003" , "foo 2.6E+03" ); |
40 | DoDoubleTest("foo %.12G" , val, "foo 2560.001" , "foo 2560.001" ); |
41 | DoDoubleTest("foo %06G" , val, "foo 002560" , "foo 002560" ); |
42 | DoDoubleTest("foo %#G" , val, "foo 2560.00" , "foo 2560.00" ); |
43 | DoDoubleTest("foo %+G" , val, "foo +2560" , "foo +2560" ); |
44 | DoDoubleTest("foo % G" , val, "foo 2560" , "foo 2560" ); |
45 | DoDoubleTest("foo %+G" , neg, "foo -2560" , "foo -2560" ); |
46 | DoDoubleTest("foo % G" , neg, "foo -2560" , "foo -2560" ); |
47 | |
48 | PAL_Terminate(); |
49 | return PASS; |
50 | } |
51 | |