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: Test #15 for the vsprintf function.
10**
11**
12**===================================================================*/
13
14#include <palsuite.h>
15#include "../vsprintf.h"
16
17/*
18 * Notes: memcmp is used, as is strlen.
19 */
20
21int __cdecl main(int argc, char *argv[])
22{
23 double val = 256.0;
24 double neg = -256.0;
25
26 if (PAL_Initialize(argc, argv) != 0)
27 {
28 return(FAIL);
29 }
30
31 DoDoubleTest("foo %E", val, "foo 2.560000E+002",
32 "foo 2.560000E+02");
33 DoDoubleTest("foo %lE", val, "foo 2.560000E+002",
34 "foo 2.560000E+02");
35 DoDoubleTest("foo %hE", val, "foo 2.560000E+002",
36 "foo 2.560000E+02");
37 DoDoubleTest("foo %LE", val, "foo 2.560000E+002",
38 "foo 2.560000E+02");
39 DoDoubleTest("foo %I64E", val, "foo 2.560000E+002",
40 "foo 2.560000E+02");
41 DoDoubleTest("foo %14E", val, "foo 2.560000E+002",
42 "foo 2.560000E+02");
43 DoDoubleTest("foo %-14E", val, "foo 2.560000E+002 ",
44 "foo 2.560000E+02 ");
45 DoDoubleTest("foo %.1E", val, "foo 2.6E+002",
46 "foo 2.6E+02");
47 DoDoubleTest("foo %.8E", val, "foo 2.56000000E+002",
48 "foo 2.56000000E+02");
49 DoDoubleTest("foo %014E", val, "foo 02.560000E+002",
50 "foo 002.560000E+02");
51 DoDoubleTest("foo %#E", val, "foo 2.560000E+002",
52 "foo 2.560000E+02");
53 DoDoubleTest("foo %+E", val, "foo +2.560000E+002",
54 "foo +2.560000E+02");
55 DoDoubleTest("foo % E", val, "foo 2.560000E+002",
56 "foo 2.560000E+02");
57 DoDoubleTest("foo %+E", neg, "foo -2.560000E+002",
58 "foo -2.560000E+02");
59 DoDoubleTest("foo % E", neg, "foo -2.560000E+002",
60 "foo -2.560000E+02");
61
62 PAL_Terminate();
63 return PASS;
64}
65