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