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: Test #15 for the printf function. Tests the uppercase
10** exponential notation double specifier (%E)
11**
12**
13**==========================================================================*/
14
15
16
17#include <palsuite.h>
18#include "../printf.h"
19
20
21
22int __cdecl main(int argc, char *argv[])
23{
24 double val = 256.0;
25 double neg = -256.0;
26
27 if (PAL_Initialize(argc, argv))
28 {
29 return FAIL;
30 }
31
32
33 DoDoubleTest("foo %E", 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 %hE", val, "foo 2.560000E+002", "foo 2.560000E+02");
36 DoDoubleTest("foo %LE", val, "foo 2.560000E+002", "foo 2.560000E+02");
37 DoDoubleTest("foo %I64E", val, "foo 2.560000E+002", "foo 2.560000E+02");
38 DoDoubleTest("foo %14E", val, "foo 2.560000E+002", "foo 2.560000E+02");
39 DoDoubleTest("foo %-14E", val, "foo 2.560000E+002 ",
40 "foo 2.560000E+02 ");
41 DoDoubleTest("foo %.1E", val, "foo 2.6E+002", "foo 2.6E+02");
42 DoDoubleTest("foo %.8E", val, "foo 2.56000000E+002",
43 "foo 2.56000000E+02");
44 DoDoubleTest("foo %014E", val, "foo 02.560000E+002",
45 "foo 002.560000E+02");
46 DoDoubleTest("foo %#E", val, "foo 2.560000E+002", "foo 2.560000E+02");
47 DoDoubleTest("foo %+E", val, "foo +2.560000E+002", "foo +2.560000E+02");
48 DoDoubleTest("foo % E", val, "foo 2.560000E+002", "foo 2.560000E+02");
49 DoDoubleTest("foo %+E", neg, "foo -2.560000E+002", "foo -2.560000E+02");
50 DoDoubleTest("foo % E", neg, "foo -2.560000E+002", "foo -2.560000E+02");
51
52 PAL_Terminate();
53 return PASS;
54}
55