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: test15.c |
8 | ** |
9 | ** Purpose: Tests the uppercase exponential |
10 | ** notation double specifier (%E). |
11 | ** This test is modeled after the sprintf series. |
12 | ** |
13 | ** |
14 | **==========================================================================*/ |
15 | |
16 | #include <palsuite.h> |
17 | #include "../fwprintf.h" |
18 | |
19 | /* |
20 | * Depends on memcmp, strlen, fopen, fseek and fgets. |
21 | */ |
22 | |
23 | int __cdecl main(int argc, char *argv[]) |
24 | { |
25 | double val = 256.0; |
26 | double neg = -256.0; |
27 | |
28 | if (PAL_Initialize(argc, argv) != 0) |
29 | { |
30 | return(FAIL); |
31 | } |
32 | |
33 | DoDoubleTest(convert("foo %E" ), val, "foo 2.560000E+002" , |
34 | "foo 2.560000E+02" ); |
35 | DoDoubleTest(convert("foo %lE" ), val, "foo 2.560000E+002" , |
36 | "foo 2.560000E+02" ); |
37 | DoDoubleTest(convert("foo %hE" ), val, "foo 2.560000E+002" , |
38 | "foo 2.560000E+02" ); |
39 | DoDoubleTest(convert("foo %LE" ), val, "foo 2.560000E+002" , |
40 | "foo 2.560000E+02" ); |
41 | DoDoubleTest(convert("foo %I64E" ), val, "foo 2.560000E+002" , |
42 | "foo 2.560000E+02" ); |
43 | DoDoubleTest(convert("foo %14E" ), val, "foo 2.560000E+002" , |
44 | "foo 2.560000E+02" ); |
45 | DoDoubleTest(convert("foo %-14E" ), val, "foo 2.560000E+002 " , |
46 | "foo 2.560000E+02 " ); |
47 | DoDoubleTest(convert("foo %.1E" ), val, "foo 2.6E+002" , |
48 | "foo 2.6E+02" ); |
49 | DoDoubleTest(convert("foo %.8E" ), val, "foo 2.56000000E+002" , |
50 | "foo 2.56000000E+02" ); |
51 | DoDoubleTest(convert("foo %014E" ), val, "foo 02.560000E+002" , |
52 | "foo 002.560000E+02" ); |
53 | DoDoubleTest(convert("foo %#E" ), val, "foo 2.560000E+002" , |
54 | "foo 2.560000E+02" ); |
55 | DoDoubleTest(convert("foo %+E" ), val, "foo +2.560000E+002" , |
56 | "foo +2.560000E+02" ); |
57 | DoDoubleTest(convert("foo % E" ), val, "foo 2.560000E+002" , |
58 | "foo 2.560000E+02" ); |
59 | DoDoubleTest(convert("foo %+E" ), neg, "foo -2.560000E+002" , |
60 | "foo -2.560000E+02" ); |
61 | DoDoubleTest(convert("foo % E" ), neg, "foo -2.560000E+002" , |
62 | "foo -2.560000E+02" ); |
63 | |
64 | PAL_Terminate(); |
65 | return PASS; |
66 | } |
67 | |