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: test14.c
8**
9** Purpose: Test #14 for the vfprintf function. Tests the lowercase
10** exponential notation double specifier (%e)
11**
12**
13**==========================================================================*/
14
15
16
17#include <palsuite.h>
18#include "../vfprintf.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