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: Test #14 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
21
22int __cdecl main(int argc, char *argv[])
23{
24 double val = 256.0;
25 double neg = -256.0;
26
27 if (PAL_Initialize(argc, argv) != 0)
28 {
29 return(FAIL);
30 }
31
32 DoDoubleTest("foo %e", val, "foo 2.560000e+002", "foo 2.560000e+02");
33 DoDoubleTest("foo %le", val, "foo 2.560000e+002", "foo 2.560000e+02");
34 DoDoubleTest("foo %he", val, "foo 2.560000e+002", "foo 2.560000e+02");
35 DoDoubleTest("foo %Le", val, "foo 2.560000e+002", "foo 2.560000e+02");
36 DoDoubleTest("foo %I64e", 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 %-14e", val, "foo 2.560000e+002 ", "foo 2.560000e+02 ");
39 DoDoubleTest("foo %.1e", val, "foo 2.6e+002", "foo 2.6e+02");
40 DoDoubleTest("foo %.8e", val, "foo 2.56000000e+002", "foo 2.56000000e+02");
41 DoDoubleTest("foo %014e", val, "foo 02.560000e+002", "foo 002.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", val, "foo 2.560000e+002", "foo 2.560000e+02");
45 DoDoubleTest("foo %+e", neg, "foo -2.560000e+002", "foo -2.560000e+02");
46 DoDoubleTest("foo % e", neg, "foo -2.560000e+002", "foo -2.560000e+02");
47
48 PAL_Terminate();
49 return PASS;
50}
51