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