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: test1.c
8**
9** Purpose: Test #1 for the wcstol function. Does a simple test with radix 4.
10**
11**
12**==========================================================================*/
13
14
15
16#include <palsuite.h>
17
18
19/*
20 * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
21 * this is not currently tested.
22 */
23
24
25int __cdecl main(int argc, char *argv[])
26{
27 WCHAR *end;
28 WCHAR teststr[] = {'1','2','3','4','5',0};
29 LONG result = 27;
30 LONG l;
31
32 if ( 0 != PAL_Initialize(argc, argv))
33 {
34 return FAIL;
35 }
36
37
38 l = wcstol(teststr, &end, 4);
39
40 if (l != result)
41 {
42 Fail("ERROR: Expected wcstol to return %d, got %d\n", result, l);
43 }
44
45 if (end != teststr + 3)
46 {
47 Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
48 teststr + 3, end);
49 }
50
51 PAL_Terminate();
52 return PASS;
53}
54