]> pd.if.org Git - pdclib/blob - functions/ctype/isxdigit.c
ctype
[pdclib] / functions / ctype / isxdigit.c
1 /* $Id$ */
2
3 /* isxdigit( int )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <ctype.h>
10
11 #ifndef REGTEST
12
13 int isxdigit( int c )
14 {
15     return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_XDIGT );
16 }
17
18 #endif
19
20 #ifdef TEST
21 #include <_PDCLIB_test.h>
22
23 int main( void )
24 {
25     TESTCASE( isxdigit( '0' ) );
26     TESTCASE( isxdigit( '9' ) );
27     TESTCASE( isxdigit( 'a' ) );
28     TESTCASE( isxdigit( 'f' ) );
29     TESTCASE( ! isxdigit( 'g' ) );
30     TESTCASE( isxdigit( 'A' ) );
31     TESTCASE( isxdigit( 'F' ) );
32     TESTCASE( ! isxdigit( 'G' ) );
33     TESTCASE( ! isxdigit( '@' ) );
34     TESTCASE( ! isxdigit( ' ' ) );
35     return TEST_RESULTS;
36 }
37
38 #endif