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 (fprintf) |
8 | ** |
9 | ** Purpose: Tests the uppercase exponential |
10 | ** notation double specifier (%E). |
11 | ** This test is modeled after the fprintf series. |
12 | ** |
13 | ** |
14 | **==========================================================================*/ |
15 | |
16 | #include <palsuite.h> |
17 | #include "../fprintf.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 | return(FAIL); |
30 | |
31 | DoDoubleTest("foo %E" , val, "foo 2.560000E+002" , "foo 2.560000E+02" ); |
32 | DoDoubleTest("foo %lE" , val, "foo 2.560000E+002" , "foo 2.560000E+02" ); |
33 | DoDoubleTest("foo %hE" , val, "foo 2.560000E+002" , "foo 2.560000E+02" ); |
34 | DoDoubleTest("foo %LE" , val, "foo 2.560000E+002" , "foo 2.560000E+02" ); |
35 | DoDoubleTest("foo %I64E" , val, "foo 2.560000E+002" , "foo 2.560000E+02" ); |
36 | DoDoubleTest("foo %14E" , val, "foo 2.560000E+002" , "foo 2.560000E+02" ); |
37 | DoDoubleTest("foo %-14E" , val, "foo 2.560000E+002 " , "foo 2.560000E+02 " ); |
38 | DoDoubleTest("foo %.1E" , val, "foo 2.6E+002" , "foo 2.6E+02" ); |
39 | DoDoubleTest("foo %.8E" , val, "foo 2.56000000E+002" , "foo 2.56000000E+02" ); |
40 | DoDoubleTest("foo %014E" , val, "foo 02.560000E+002" , "foo 002.560000E+02" ); |
41 | DoDoubleTest("foo %#E" , val, "foo 2.560000E+002" , "foo 2.560000E+02" ); |
42 | DoDoubleTest("foo %+E" , val, "foo +2.560000E+002" , "foo +2.560000E+02" ); |
43 | DoDoubleTest("foo % E" , val, "foo 2.560000E+002" , "foo 2.560000E+02" ); |
44 | DoDoubleTest("foo %+E" , neg, "foo -2.560000E+002" , "foo -2.560000E+02" ); |
45 | DoDoubleTest("foo % E" , neg, "foo -2.560000E+002" , "foo -2.560000E+02" ); |
46 | |
47 | PAL_Terminate(); |
48 | return PASS; |
49 | } |
50 | |