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: test6.c
8**
9** Purpose:Tests swscanf with octal numbers
10**
11**
12**==========================================================================*/
13
14
15
16#include <palsuite.h>
17#include "../swscanf.h"
18
19
20int __cdecl main(int argc, char *argv[])
21{
22 int n65535 = 65535; /* Walkaround compiler strictness */
23
24 if (PAL_Initialize(argc, argv))
25 {
26 return FAIL;
27 }
28
29 DoNumTest(convert("1234d"), convert("%o"), 668);
30 DoNumTest(convert("1234d"), convert("%2o"), 10);
31 DoNumTest(convert("-1"), convert("%o"), -1);
32 DoNumTest(convert("0x1234"), convert("%o"), 0);
33 DoNumTest(convert("012"), convert("%o"), 10);
34 DoShortNumTest(convert("-1"), convert("%ho"), n65535);
35 DoShortNumTest(convert("200000"), convert("%ho"), 0);
36 DoNumTest(convert("-1"), convert("%lo"), -1);
37 DoNumTest(convert("200000"), convert("%lo"), 65536);
38 DoNumTest(convert("-1"), convert("%Lo"), -1);
39 DoNumTest(convert("200000"), convert("%Lo"), 65536);
40 DoI64NumTest(convert("40000000000"), convert("%I64o"), I64(4294967296));
41
42 PAL_Terminate();
43 return PASS;
44}
45