This repository has been archived on 2026-05-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
piquant/tests/stdlib_isxdigit.c
2016-03-27 12:42:42 -07:00

20 lines
505 B
C

#include "stdlib.h"
#define NULL 0x00
int main(void)
{
const char *postest = "ABCDEFabcdef0123456789";
const char *negtest = "GHIJKLMNOPQRSTUVWXYZghijklmnopqrstuvwxyz~!@#$%^&*()_+{}|[]\\:\";'<>?,./`/*-.";
char *ptr = NULL;
for ( ptr = (char *)postest; *ptr != '\0' ; ptr++ ) {
if ( isxdigit((int)*ptr) != 1 ) return (int)(ptr - postest);
}
for ( ptr = (char *)negtest; *ptr != '\0' ; ptr++ ) {
if ( isxdigit((int)*ptr) != 0 ) return (int)(100 + (ptr - negtest));
}
return 0;
}