Fri Jul 26 00:36:50 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>

* ctype/test_ctype.c: Test EOF too.
This commit is contained in:
Roland McGrath 1996-07-27 00:32:20 +00:00
parent 4627647c99
commit 4f2a1df0d2

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1994, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -45,6 +45,22 @@ DEFUN(main, (argc, argv), int argc AND char **argv)
register unsigned short int c;
int lose = 0;
#define TRYEM do { \
TRY (isascii); \
TRY (isalnum); \
TRY (isalpha); \
TRY (iscntrl); \
TRY (isdigit); \
TRY (isgraph); \
TRY (islower); \
TRY (isprint); \
TRY (ispunct); \
TRY (isspace); \
TRY (isupper); \
TRY (isxdigit); \
TRY (isblank); \
} while (0)
for (c = 0; c <= UCHAR_MAX; ++c)
{
print_char (c);
@ -55,32 +71,10 @@ DEFUN(main, (argc, argv), int argc AND char **argv)
++lose;
}
if (isascii(c))
fputs(" isascii", stdout);
if (isalnum(c))
fputs(" isalnum", stdout);
if (isalpha(c))
fputs(" isalpha", stdout);
if (iscntrl(c))
fputs(" iscntrl", stdout);
if (isdigit(c))
fputs(" isdigit", stdout);
if (isgraph(c))
fputs(" isgraph", stdout);
if (islower(c))
fputs(" islower", stdout);
if (isprint(c))
fputs(" isprint", stdout);
if (ispunct(c))
fputs(" ispunct", stdout);
if (isspace(c))
fputs(" isspace", stdout);
if (isupper(c))
fputs(" isupper", stdout);
if (isxdigit(c))
fputs(" isxdigit", stdout);
if (isblank(c))
fputs(" isblank", stdout);
#define TRY(isfoo) if (isfoo (c)) fputs (" " #isfoo, stdout)
TRYEM;
#undef TRY
fputs("; lower = ", stdout);
print_char(tolower(c));
fputs("; upper = ", stdout);
@ -88,5 +82,21 @@ DEFUN(main, (argc, argv), int argc AND char **argv)
putchar('\n');
}
fputs ("EOF", stdout);
if (tolower (EOF) != EOF)
{
++lose;
printf (" tolower BOGUS %d;", tolower (EOF));
}
if (toupper (EOF) != EOF)
{
++lose;
printf (" toupper BOGUS %d;", toupper (EOF));
}
#define TRY(isfoo) if (isfoo (EOF)) fputs (" " #isfoo, stdout), ++lose
TRYEM;
#undef TRY
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
}