Changeset: f0ca4dc1d9a4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f0ca4dc1d9a4
Modified Files:
        monetdb5/modules/atoms/Tests/startswith.test
        monetdb5/modules/atoms/utf8.h
Branch: Jun2023
Log Message:

utf8ncasecmp patch for utf8.h lib. Allow negative return.
***
Add test for startsWith that leverages utf8ncasecmp.


diffs (42 lines):

diff --git a/monetdb5/modules/atoms/Tests/startswith.test 
b/monetdb5/modules/atoms/Tests/startswith.test
--- a/monetdb5/modules/atoms/Tests/startswith.test
+++ b/monetdb5/modules/atoms/Tests/startswith.test
@@ -86,3 +86,8 @@ drop table foo
 
 statement ok
 drop table bar
+
+query T
+select ['Camón Romasan'] startsWith ['camu', true];
+----
+false
diff --git a/monetdb5/modules/atoms/utf8.h b/monetdb5/modules/atoms/utf8.h
--- a/monetdb5/modules/atoms/utf8.h
+++ b/monetdb5/modules/atoms/utf8.h
@@ -564,7 +564,7 @@ utf8_constexpr14_impl int utf8ncasecmp(c
       const utf8_int32_t c1 = (0xe0 & *s1);
       const utf8_int32_t c2 = (0xe0 & *s2);
 
-      if (c1 < c2) {
+      if (c1 != c2) {
         return c1 - c2;
       } else {
         return 0;
@@ -575,7 +575,7 @@ utf8_constexpr14_impl int utf8ncasecmp(c
       const utf8_int32_t c1 = (0xf0 & *s1);
       const utf8_int32_t c2 = (0xf0 & *s2);
 
-      if (c1 < c2) {
+      if (c1 != c2) {
         return c1 - c2;
       } else {
         return 0;
@@ -586,7 +586,7 @@ utf8_constexpr14_impl int utf8ncasecmp(c
       const utf8_int32_t c1 = (0xf8 & *s1);
       const utf8_int32_t c2 = (0xf8 & *s2);
 
-      if (c1 < c2) {
+      if (c1 != c2) {
         return c1 - c2;
       } else {
         return 0;
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to