aboutsummaryrefslogtreecommitdiff
path: root/char32.c
diff options
context:
space:
mode:
authorc4llv07e <igor@c4llv07e.xyz>2025-10-27 10:24:07 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-10-30 05:35:02 +0000
commit71de0c45bc38ee773f86bb4d48f96719c8abb568 (patch)
treeb6c889633637ae884a2e46de11722207ba2b67d3 /char32.c
parentdoc: foot.ini: fix typo (diff)
char32: add helper functions to work with c32 case
Diffstat (limited to 'char32.c')
-rw-r--r--char32.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/char32.c b/char32.c
index 827cef8d..3d6c2c78 100644
--- a/char32.c
+++ b/char32.c
@@ -55,6 +55,14 @@ UNITTEST
UNITTEST
{
+ xassert(c32ncmp(U"foo", U"foot", 3) == 0);
+ xassert(c32ncmp(U"foot", U"FOOT", 4) > 0);
+ xassert(c32ncmp(U"a", U"b", 1) < 0);
+ xassert(c32ncmp(U"bb", U"aa", 2) > 0);
+}
+
+UNITTEST
+{
char32_t copy[16];
char32_t *ret = c32ncpy(copy, U"foobar", 16);
@@ -129,6 +137,20 @@ UNITTEST
UNITTEST
{
+ xassert(!isc32upper(U'a'));
+ xassert(isc32upper(U'A'));
+ xassert(!isc32upper(U'a'));
+}
+
+UNITTEST
+{
+ xassert(hasc32upper(U"abc1A"));
+ xassert(!hasc32upper(U"abc1_aaa"));
+ xassert(!hasc32upper(U""));
+}
+
+UNITTEST
+{
char32_t *c = xc32dup(U"foobar");
xassert(c32cmp(c, U"foobar") == 0);
free(c);