summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.cpp')
-rw-r--r--src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.cpp
new file mode 100644
index 0000000..be25af2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.cpp
@@ -0,0 +1,58 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test1.c
+**
+** Purpose: Run through every possible character. For each time that
+** isxdigit returns:
+** 1, check through a list of the known hex characters to ensure that it
+** is really a hex char. Also, when it returns 0, ensure that that character
+** isn't a hex character.
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int i;
+
+ /* Initialize the PAL */
+ if ( 0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through each character and call isxdigit for each character */
+ for (i=1; i<256; i++)
+ {
+
+ if (isxdigit(i) == 0)
+ {
+ if( ((i>=48) && (i<=57)) || ((i>=97) && (i<=102)) ||
+ ((i>=65) && (i<=70)) )
+ {
+ Fail("ERROR: isxdigit() returns true for '%c' (%d)\n", i, i);
+ }
+ }
+ else
+ {
+ if( ((i<48) && (i>58)) || ((i<97) && (i>102)) ||
+ ((i<65) && (i>70)) )
+ {
+ Fail("ERROR: isxdigit() returns false for '%c' (%d)\n", i, i);
+ }
+ }
+ }
+
+ PAL_Terminate();
+ return PASS;
+}