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 that errno begins as 0, and sets to ERANGE when that
10** error is forced with wcstoul.
11**
12**
13**==========================================================================*/
14
15#include <palsuite.h>
16
17int __cdecl main(int argc, char *argv[])
18{
19 WCHAR overstr[] = {'4','2','9','4','9','6','7','2','9','6',0};
20 WCHAR *end;
21
22 if (PAL_Initialize(argc, argv))
23 {
24 return FAIL;
25 }
26
27 /*
28 The only value that must be supported is
29 ERANGE, in the event that wcstoul() fails due to overflow.
30 */
31
32 wcstoul(overstr, &end, 10);
33
34 if (errno != ERANGE)
35 {
36 Fail("ERROR: wcstoul did not set errno to ERANGE. Instead "
37 "the value of errno is %d\n", errno);
38 }
39
40
41 PAL_Terminate();
42 return PASS;
43}
44