>From a7a072a14945dfbe5fdd207926846b2c286b4b83 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 23 Sep 2015 12:02:35 -0700 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ tests/test-c-ctype.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7f7910b..493c915 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 63d0af9..80eb69d 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 -- 2.1.0