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 (fprintf)
8**
9** Purpose: Tests the lowercase 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
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 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