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

View File

@@ -0,0 +1,27 @@
#include "stdlib.h"
#define NULL 0x00
int main(void)
{
const char *uptest = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const char *lowtest = "abcdefghijklmnopqrstuvwcyz";
char *ptr = NULL;
for ( ptr = (char *)uptest; *ptr != '\0' ; ptr++ ) {
if ( isupper((int)*ptr) != 1 ) return (int)(ptr - uptest);
}
for ( ptr = (char *)lowtest; *ptr != '\0' ; ptr++ ) {
if ( isupper((int)*ptr) != 0 ) return (int)(26 + (ptr - lowtest));
}
for ( ptr = (char *)lowtest; *ptr != '\0' ; ptr++ ) {
if ( islower((int)*ptr) != 1 ) return (int)(52 + (ptr - uptest));
}
for ( ptr = (char *)uptest; *ptr != '\0' ; ptr++ ) {
if ( islower((int)*ptr) != 0 ) return (int)(78 + (ptr - lowtest));
}
return 0;
}