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: Tests the lowercase 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
23int __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