bug-libunistring
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-libunistring] Testcase contribution to libunistring


From: Bruno Haible
Subject: Re: [bug-libunistring] Testcase contribution to libunistring
Date: Wed, 11 Oct 2023 16:43:49 +0200

[Please keep the mailing list in CC.]

Sharma, Arindam wrote:
> Many thanks for the swift response. I am attaching the patch file generated 
> using `diff -u` while using the source from the latest libunistring tar from 
> the website.
> 
> Since GNUTLS (which is what this testcase has been extracted from) is on 
> LGPLv2.1+ license, which is quite permissive, it should be compatible with 
> the GPLv3+ requirement mentioned by you.
> Expanding on the previous email, this testcase exercises a new branch in the 
> uc_general_category_and_not function and hence exercises a previously 
> unexplored path. We have verified this increase against the trunk of the git 
> repository as well.
> 
> Please do let me know if there are any issues with the application of the 
> patch file or if you have any other concerns.

Thanks. Indeed, your test case takes a different code path in
lib/unictype/categ_and_not.c .

I am using a simpler test case, so as to not blow up the dependencies
of this test case module.

Also, lib/unictype/categ_and_not.c has a third 'return' statement. I am
adding a test case for that one as well.

Bruno


2023-10-11  Bruno Haible  <bruno@clisp.org>

        unictype/category-and-not: Add more tests.
        Suggested by Arindam Sharma <arindam.sharma@imperial.ac.uk>.
        * 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 -w 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,6 +25,26 @@
 int
 main ()
 {
+  { /* 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),
@@ -34,6 +54,7 @@ main ()
     ASSERT (uc_is_general_category ('a', ct));
     ASSERT (!uc_is_general_category ('7', ct));
     ASSERT (uc_is_general_category (0x00B2, ct));
+  }
 
   return 0;
 }
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:







reply via email to

[Prev in Thread] Current Thread [Next in Thread]