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: test16.c
8**
9** Purpose: Test #16 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 = 2560.001;
23 double neg = -2560.001;
24
25 if (PAL_Initialize(argc, argv) != 0)
26 return(FAIL);
27
28 DoDoubleTest(convert("foo %f"), val, convert("foo 2560.001000"),
29 convert("foo 2560.001000"));
30 DoDoubleTest(convert("foo %lf"), val, convert("foo 2560.001000"),
31 convert("foo 2560.001000"));
32 DoDoubleTest(convert("foo %hf"), val, convert("foo 2560.001000"),
33 convert("foo 2560.001000"));
34 DoDoubleTest(convert("foo %Lf"), val, convert("foo 2560.001000"),
35 convert("foo 2560.001000"));
36 DoDoubleTest(convert("foo %I64f"), val, convert("foo 2560.001000"),
37 convert("foo 2560.001000"));
38 DoDoubleTest(convert("foo %12f"), val, convert("foo 2560.001000"),
39 convert("foo 2560.001000"));
40 DoDoubleTest(convert("foo %-12f"), val, convert("foo 2560.001000 "),
41 convert("foo 2560.001000 "));
42 DoDoubleTest(convert("foo %.1f"), val, convert("foo 2560.0"),
43 convert("foo 2560.0"));
44 DoDoubleTest(convert("foo %.8f"), val, convert("foo 2560.00100000"),
45 convert("foo 2560.00100000"));
46 DoDoubleTest(convert("foo %012f"), val, convert("foo 02560.001000"),
47 convert("foo 02560.001000"));
48 DoDoubleTest(convert("foo %#f"), val, convert("foo 2560.001000"),
49 convert("foo 2560.001000"));
50 DoDoubleTest(convert("foo %+f"), val, convert("foo +2560.001000"),
51 convert("foo +2560.001000"));
52 DoDoubleTest(convert("foo % f"), val, convert("foo 2560.001000"),
53 convert("foo 2560.001000"));
54 DoDoubleTest(convert("foo %+f"), neg, convert("foo -2560.001000"),
55 convert("foo -2560.001000"));
56 DoDoubleTest(convert("foo % f"), neg, convert("foo -2560.001000"),
57 convert("foo -2560.001000"));
58
59 PAL_Terminate();
60 return PASS;
61}
62