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: test10.c
8**
9** Purpose: Test #10 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 int neg = -42;
23 int pos = 42;
24 INT64 l = 42;
25
26 if (PAL_Initialize(argc, argv) != 0)
27 return(FAIL);
28
29 DoNumTest(convert("foo %o"), pos, convert("foo 52"));
30 DoNumTest(convert("foo %lo"), 0xFFFF, convert("foo 177777"));
31 DoNumTest(convert("foo %ho"), 0xFFFF, convert("foo 177777"));
32 DoNumTest(convert("foo %Lo"), pos, convert("foo 52"));
33 DoI64NumTest(convert("foo %I64o"), l, "42", convert("foo 52"));
34 DoNumTest(convert("foo %3o"), pos, convert("foo 52"));
35 DoNumTest(convert("foo %-3o"), pos, convert("foo 52 "));
36 DoNumTest(convert("foo %.1o"), pos, convert("foo 52"));
37 DoNumTest(convert("foo %.3o"), pos, convert("foo 052"));
38 DoNumTest(convert("foo %03o"), pos, convert("foo 052"));
39 DoNumTest(convert("foo %#o"), pos, convert("foo 052"));
40 DoNumTest(convert("foo %+o"), pos, convert("foo 52"));
41 DoNumTest(convert("foo % o"), pos, convert("foo 52"));
42 DoNumTest(convert("foo %+o"), neg, convert("foo 37777777726"));
43 DoNumTest(convert("foo % o"), neg, convert("foo 37777777726"));
44
45
46 PAL_Terminate();
47 return PASS;
48}
49