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