From: Bruno Haible Date: Wed, 11 Oct 2023 14:43:07 +0000 (+0200) Subject: unictype/category-and-not: Add more tests. X-Git-Tag: v1.0~724 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=9d18cdba2862788b8f0fcc2a002ad71bf44a50eb;p=gnulib.git unictype/category-and-not: Add more tests. Suggested by Arindam Sharma . * tests/unictype/test-categ_and_not.c (main): Add two more test cases. * modules/unictype/category-and-not-tests (Depends-on): Add unictype/category-Cc. --- diff --git a/ChangeLog b/ChangeLog index ef036d1585..22205096a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-10-11 Bruno Haible + + unictype/category-and-not: Add more tests. + Suggested by Arindam Sharma . + * tests/unictype/test-categ_and_not.c (main): Add two more test cases. + * modules/unictype/category-and-not-tests (Depends-on): Add + unictype/category-Cc. + 2023-10-09 Bruno Haible tests: Refactor functions for signalling NaNs. diff --git a/modules/unictype/category-and-not-tests b/modules/unictype/category-and-not-tests index ba1edb873f..5021ae9eb3 100644 --- a/modules/unictype/category-and-not-tests +++ b/modules/unictype/category-and-not-tests @@ -9,6 +9,7 @@ unictype/category-L unictype/category-N unictype/category-Lu unictype/category-Nd +unictype/category-Cc configure.ac: diff --git a/tests/unictype/test-categ_and_not.c b/tests/unictype/test-categ_and_not.c index 74c75aee5f..1a49cd0e14 100644 --- a/tests/unictype/test-categ_and_not.c +++ b/tests/unictype/test-categ_and_not.c @@ -25,15 +25,36 @@ int main () { - uc_general_category_t ct = - uc_general_category_and_not ( - uc_general_category_or (UC_LETTER, UC_NUMBER), - uc_general_category_or (UC_UPPERCASE_LETTER, UC_DECIMAL_DIGIT_NUMBER)); - - ASSERT (!uc_is_general_category ('A', ct)); - ASSERT (uc_is_general_category ('a', ct)); - ASSERT (!uc_is_general_category ('7', ct)); - ASSERT (uc_is_general_category (0x00B2, ct)); + { /* A case where the result's bit mask is 0. */ + uc_general_category_t ct = + uc_general_category_and_not (UC_UPPERCASE_LETTER, UC_LETTER); + + ASSERT (!uc_is_general_category ('A', ct)); + ASSERT (!uc_is_general_category ('a', ct)); + } + { /* A case where the result's bit mask is the same as the first argument. */ + uc_general_category_t ct = + uc_general_category_and_not ( + uc_general_category_or (UC_LETTER, UC_NUMBER), + UC_CONTROL); + + ASSERT (uc_is_general_category ('A', ct)); + ASSERT (uc_is_general_category ('a', ct)); + ASSERT (uc_is_general_category ('7', ct)); + ASSERT (uc_is_general_category (0x00B2, ct)); + } + { /* The general case, where the result's bit mask is neither 0 nor the first + argument. */ + uc_general_category_t ct = + uc_general_category_and_not ( + uc_general_category_or (UC_LETTER, UC_NUMBER), + uc_general_category_or (UC_UPPERCASE_LETTER, UC_DECIMAL_DIGIT_NUMBER)); + + ASSERT (!uc_is_general_category ('A', ct)); + ASSERT (uc_is_general_category ('a', ct)); + ASSERT (!uc_is_general_category ('7', ct)); + ASSERT (uc_is_general_category (0x00B2, ct)); + } return 0; }