summaryrefslogtreecommitdiff
path: root/test/source
diff options
context:
space:
mode:
Diffstat (limited to 'test/source')
-rw-r--r--test/source/main.c3
-rw-r--r--test/source/test/utf20len.i11
2 files changed, 14 insertions, 0 deletions
diff --git a/test/source/main.c b/test/source/main.c
index 38c9f68..ce73d3a 100644
--- a/test/source/main.c
+++ b/test/source/main.c
@@ -33,6 +33,7 @@ typedef bool (* zaptest_testtyp)(void);
#include "test/streq.i"
#include "test/strfill.i"
#include "test/strlen.i"
+#include "test/utf20len.i"
#include "test/utf8dec.i"
#include "test/utf8enc.i"
#include "test/win1252dec.i"
@@ -55,6 +56,7 @@ static zaptest_testtyp zaptest_tests[] = {
zaptest_test_streq,
zaptest_test_strfill,
zaptest_test_strlen,
+ zaptest_test_utf20len,
zaptest_test_utf8dec,
zaptest_test_utf8enc,
zaptest_test_win1252dec,
@@ -78,6 +80,7 @@ static char const * zaptest_testnms[] = {
"streq",
"strfill",
"strlen",
+ "utf20len",
"utf8dec",
"utf8enc",
"win1252dec",
diff --git a/test/source/test/utf20len.i b/test/source/test/utf20len.i
new file mode 100644
index 0000000..98be658
--- /dev/null
+++ b/test/source/test/utf20len.i
@@ -0,0 +1,11 @@
+#include <stdbool.h>
+
+bool zaptest_test_utf20len(void) {
+ zap_chr20 const str0[] = U"Ça va?";
+ zap_chr20 const str1[] = U"Non, ça ne va pas.";
+ zap_sz const len0 = zap_utf20len(str0);
+ zap_sz const len1 = zap_utf20len(str1);
+ zaptest_chk(len0,0x6u,zap_sz,"%zX")
+ zaptest_chk(len1,0x12u,zap_sz,"%zX")
+ return false;
+}