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: test4.c
8**
9** Purpose:Tests swscanf with decimal 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("%d"), 1234);
30 DoNumTest(convert("1234d"), convert("%2d"), 12);
31 DoNumTest(convert("-1"), convert("%d"), -1);
32 DoNumTest(convert("0x1234"), convert("%d"), 0);
33 DoNumTest(convert("012"), convert("%d"), 12);
34 DoShortNumTest(convert("-1"), convert("%hd"), n65535);
35 DoShortNumTest(convert("65536"), convert("%hd"), 0);
36 DoNumTest(convert("-1"), convert("%ld"), -1);
37 DoNumTest(convert("65536"), convert("%ld"), 65536);
38 DoNumTest(convert("-1"), convert("%Ld"), -1);
39 DoNumTest(convert("65536"), convert("%Ld"), 65536);
40 DoI64NumTest(convert("4294967296"), convert("%I64d"), I64(4294967296));
41
42 PAL_Terminate();
43 return PASS;
44}
45