char32: add helper functions to work with c32 case

This commit is contained in:
c4llv07e 2025-10-27 13:24:07 +03:00 committed by Daniel Eklöf
parent 19466a21d8
commit 71de0c45bc
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 37 additions and 0 deletions

View file

@ -53,6 +53,14 @@ UNITTEST
xassert(c32cmp(U"b", U"a") > 0);
}
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];
@ -127,6 +135,20 @@ UNITTEST
xassert(c32cmp(dst, U"foobar12345678") == 0);
}
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");