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 swprintf with exponential format doubles (lowercase)
10**
11**
12**==========================================================================*/
13
14
15
16#include <palsuite.h>
17#include "../swprintf.h"
18
19/*
20 * Uses memcmp & wcslen
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
34 DoDoubleTest(convert("foo %e"), val, convert("foo 2.560000e+002"),
35 convert("foo 2.560000e+02"));
36 DoDoubleTest(convert("foo %le"), val, convert("foo 2.560000e+002"),
37 convert("foo 2.560000e+02"));
38 DoDoubleTest(convert("foo %he"), val, convert("foo 2.560000e+002"),
39 convert("foo 2.560000e+02"));
40 DoDoubleTest(convert("foo %Le"), val, convert("foo 2.560000e+002"),
41 convert("foo 2.560000e+02"));
42 DoDoubleTest(convert("foo %I64e"), val, convert("foo 2.560000e+002"),
43 convert("foo 2.560000e+02"));
44 DoDoubleTest(convert("foo %14e"), val, convert("foo 2.560000e+002"),
45 convert("foo 2.560000e+02"));
46 DoDoubleTest(convert("foo %-14e"), val, convert("foo 2.560000e+002 "),
47 convert("foo 2.560000e+02 "));
48 DoDoubleTest(convert("foo %.1e"), val, convert("foo 2.6e+002"),
49 convert("foo 2.6e+02"));
50 DoDoubleTest(convert("foo %.8e"), val, convert("foo 2.56000000e+002"),
51 convert("foo 2.56000000e+02"));
52 DoDoubleTest(convert("foo %014e"), val, convert("foo 02.560000e+002"),
53 convert("foo 002.560000e+02"));
54 DoDoubleTest(convert("foo %#e"), val, convert("foo 2.560000e+002"),
55 convert("foo 2.560000e+02"));
56 DoDoubleTest(convert("foo %+e"), val, convert("foo +2.560000e+002"),
57 convert("foo +2.560000e+02"));
58 DoDoubleTest(convert("foo % e"), val, convert("foo 2.560000e+002"),
59 convert("foo 2.560000e+02"));
60 DoDoubleTest(convert("foo %+e"), neg, convert("foo -2.560000e+002"),
61 convert("foo -2.560000e+02"));
62 DoDoubleTest(convert("foo % e"), neg, convert("foo -2.560000e+002"),
63 convert("foo -2.560000e+02"));
64
65 PAL_Terminate();
66 return PASS;
67}
68