]> Savannah Git Hosting - gnulib.git/commitdiff
c-ctype: improve c_isascii testing
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 23 Sep 2015 19:02:35 +0000 (12:02 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 23 Sep 2015 19:03:06 +0000 (12:03 -0700)
* tests/test-c-ctype.c (test_all): Port c_isascii test to EBCDIC.
Add a test to count the number of ASCII characters.

ChangeLog
tests/test-c-ctype.c

index 7f7910bed6b7d61a041489da977e9244772df2e2..493c915f82f5b621ffb49cfd6afb460ad6b69533 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       c-ctype: improve c_isascii testing
+       * tests/test-c-ctype.c (test_all): Port c_isascii test to EBCDIC.
+       Add a test to count the number of ASCII characters.
+
 2015-09-22  Paul Eggert  <eggert@cs.ucla.edu>
 
        savewd: remove SAVEWD_CHDIR_READABLE
index 63d0af95810735f76e8890a181830c03ebcc0a41..80eb69de60924e7edc7104eaf4cffbc374f7034a 100644 (file)
@@ -37,6 +37,7 @@ static void
 test_all (void)
 {
   int c;
+  int n_isascii = 0;
 
   for (c = -0x80; c < 0x100; c++)
     {
@@ -59,7 +60,10 @@ test_all (void)
           ASSERT (to_char (c_toupper (c)) == to_char (c_toupper (c + 0x100)));
         }
 
-      ASSERT (c_isascii (c) == (c >= 0 && c < 0x80));
+      if (0 <= c)
+        n_isascii += c_isascii (c);
+
+      ASSERT (c_isascii (c) == (c_isprint (c) || c_iscntrl (c)));
 
       ASSERT (c_isalnum (c) == (c_isalpha (c) || c_isdigit (c)));
 
@@ -383,6 +387,8 @@ test_all (void)
           break;
         }
     }
+
+  ASSERT (n_isascii == 128);
 }
 
 int