From 5d3e911f015b33d0b4dcc3aa94f7af630438cbf8 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Thu, 10 Dec 2015 19:53:47 +0100
Subject: Add a test for utf8_iter
---
tests/liberty.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/liberty.c b/tests/liberty.c
index ac4b315..16e68e2 100644
--- a/tests/liberty.c
+++ b/tests/liberty.c
@@ -339,6 +339,14 @@ test_utf8 (void)
const char invalid[] = "\xf0\x90\x28\xbc";
soft_assert ( utf8_validate (valid, sizeof valid));
soft_assert (!utf8_validate (invalid, sizeof invalid));
+
+ struct utf8_iter iter;
+ utf8_iter_init (&iter, "fóọ");
+
+ size_t ch_len;
+ hard_assert (utf8_iter_next (&iter, &ch_len) == 'f' && ch_len == 1);
+ hard_assert (utf8_iter_next (&iter, &ch_len) == 0x00F3 && ch_len == 2);
+ hard_assert (utf8_iter_next (&iter, &ch_len) == 0x1ECD && ch_len == 3);
}
static void
--
cgit v1.2.3-70-g09d2