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: Run through every possible character. For each time that
10** isxdigit returns:
11** 1, check through a list of the known hex characters to ensure that it
12** is really a hex char. Also, when it returns 0, ensure that that character
13** isn't a hex character.
14**
15**
16**==========================================================================*/
17
18
19
20#include <palsuite.h>
21
22
23int __cdecl main(int argc, char *argv[])
24{
25 int i;
26
27 /* Initialize the PAL */
28 if ( 0 != PAL_Initialize(argc, argv))
29 {
30 return FAIL;
31 }
32
33
34 /* Loop through each character and call isxdigit for each character */
35 for (i=1; i<256; i++)
36 {
37
38 if (isxdigit(i) == 0)
39 {
40 if( ((i>=48) && (i<=57)) || ((i>=97) && (i<=102)) ||
41 ((i>=65) && (i<=70)) )
42 {
43 Fail("ERROR: isxdigit() returns true for '%c' (%d)\n", i, i);
44 }
45 }
46 else
47 {
48 if( ((i<48) && (i>58)) || ((i<97) && (i>102)) ||
49 ((i<65) && (i>70)) )
50 {
51 Fail("ERROR: isxdigit() returns false for '%c' (%d)\n", i, i);
52 }
53 }
54 }
55
56 PAL_Terminate();
57 return PASS;
58}
59