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 vswprintf function.
10**
11**
12**===================================================================*/
13
14#include <palsuite.h>
15#include "../vswprintf.h"
16
17/* memcmp is used to verify the results, so this test is dependent on it. */
18/* ditto with wcslen */
19
20int __cdecl main(int argc, char *argv[])
21{
22 double val = 256.0;
23 double neg = -256.0;
24
25 if (PAL_Initialize(argc, argv) != 0)
26 return(FAIL);
27
28 DoDoubleTest(convert("foo %e"), val, convert("foo 2.560000e+002"),
29 convert("foo 2.560000e+02"));
30 DoDoubleTest(convert("foo %le"), val, convert("foo 2.560000e+002"),
31 convert("foo 2.560000e+02"));
32 DoDoubleTest(convert("foo %he"), val, convert("foo 2.560000e+002"),
33 convert("foo 2.560000e+02"));
34 DoDoubleTest(convert("foo %Le"), val, convert("foo 2.560000e+002"),
35 convert("foo 2.560000e+02"));
36 DoDoubleTest(convert("foo %I64e"), val, convert("foo 2.560000e+002"),
37 convert("foo 2.560000e+02"));
38 DoDoubleTest(convert("foo %14e"), val, convert("foo 2.560000e+002"),
39 convert("foo 2.560000e+02"));
40 DoDoubleTest(convert("foo %-14e"), val, convert("foo 2.560000e+002 "),
41 convert("foo 2.560000e+02 "));
42 DoDoubleTest(convert("foo %.1e"), val, convert("foo 2.6e+002"),
43 convert("foo 2.6e+02"));
44 DoDoubleTest(convert("foo %.8e"), val, convert("foo 2.56000000e+002"),
45 convert("foo 2.56000000e+02"));
46 DoDoubleTest(convert("foo %014e"), val, convert("foo 02.560000e+002"),
47 convert("foo 002.560000e+02"));
48 DoDoubleTest(convert("foo %#e"), val, convert("foo 2.560000e+002"),
49 convert("foo 2.560000e+02"));
50 DoDoubleTest(convert("foo %+e"), val, convert("foo +2.560000e+002"),
51 convert("foo +2.560000e+02"));
52 DoDoubleTest(convert("foo % e"), val, convert("foo 2.560000e+002"),
53 convert("foo 2.560000e+02"));
54 DoDoubleTest(convert("foo %+e"), neg, convert("foo -2.560000e+002"),
55 convert("foo -2.560000e+02"));
56 DoDoubleTest(convert("foo % e"), neg, convert("foo -2.560000e+002"),
57 convert("foo -2.560000e+02"));
58
59 PAL_Terminate();
60 return PASS;
61}
62