Add tests for stdlib
This commit is contained in:
19
tests/stdlib_isxdigit.c
Normal file
19
tests/stdlib_isxdigit.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user