diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-12-10 19:53:47 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-12-10 19:54:45 +0100 |
commit | 5d3e911f015b33d0b4dcc3aa94f7af630438cbf8 (patch) | |
tree | b24fc79ca99a9a4fdccabf5bb3ecfa66d619895d /tests | |
parent | 75d063e363f1f6c74c80246ffed71f180b8c10d5 (diff) | |
download | liberty-5d3e911f015b33d0b4dcc3aa94f7af630438cbf8.tar.gz liberty-5d3e911f015b33d0b4dcc3aa94f7af630438cbf8.tar.xz liberty-5d3e911f015b33d0b4dcc3aa94f7af630438cbf8.zip |
Add a test for utf8_iter
Diffstat (limited to 'tests')
-rw-r--r-- | tests/liberty.c | 8 |
1 files changed, 8 insertions, 0 deletions
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 |