Add tests for stdlib

This commit is contained in:
2016-03-27 12:42:42 -07:00
parent 3000e7e9fb
commit 9fefff9edf
10 changed files with 91 additions and 2 deletions

19
tests/stdlib_isxdigit.c Normal file
View 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;
}