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:Tests swprintf with exponential format doubles (uppercase)
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