From 4f2a1df0d2f2acb99bf44cf2b7886dd93018ea6d Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 27 Jul 1996 00:32:20 +0000 Subject: [PATCH] Fri Jul 26 00:36:50 1996 Roland McGrath * ctype/test_ctype.c: Test EOF too. --- ctype/test_ctype.c | 64 +++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/ctype/test_ctype.c b/ctype/test_ctype.c index 622e5bf762..de21b8adfe 100644 --- a/ctype/test_ctype.c +++ b/ctype/test_ctype.c @@ -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); }