From: Paul Eggert Date: Wed, 23 Sep 2015 19:02:35 +0000 (-0700) Subject: c-ctype: improve c_isascii testing X-Git-Tag: v1.0~6952 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=5b09f8c067109f560ce7d4b70127a33862f42733;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 7f7910bed6..493c915f82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-09-23 Paul Eggert + + 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 savewd: remove SAVEWD_CHDIR_READABLE diff --git a/tests/test-c-ctype.c b/tests/test-c-ctype.c index 63d0af9581..80eb69de60 100644 --- a/tests/test-c-ctype.c +++ b/tests/test-c-ctype.c @@ -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