aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2012-12-13 22:43:15 +0100
committerSebastian Geerken <devnull@localhost>2012-12-13 22:43:15 +0100
commitf5380a56b1a6b83fea9b1c97140d4b1c8fe4ba49 (patch)
tree93a792dc006a046b4187acf95c6c8b79df97a920 /test
parent1471c240d49b60ef081f50230f2eee8852793716 (diff)
New function nextUtf8Char; usage in dw::Hyphenator and (partly) dw::Textblock.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am7
-rw-r--r--test/unicode_test.cc15
2 files changed, 21 insertions, 1 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 9589e09b..d8dd785e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -23,7 +23,8 @@ noinst_PROGRAMS = \
cookies \
liang \
trie \
- notsosimplevector
+ notsosimplevector \
+ unicode-test
dw_anchors_test_SOURCES = dw_anchors_test.cc
dw_anchors_test_LDADD = \
@@ -180,3 +181,7 @@ trie_LDADD = \
notsosimplevector_SOURCES = notsosimplevector.cc
notsosimplevector_LDADD = $(top_builddir)/lout/liblout.a
+
+unicode_test_SOURCES = unicode_test.cc
+
+unicode_test_LDADD = $(top_builddir)/lout/liblout.a
diff --git a/test/unicode_test.cc b/test/unicode_test.cc
new file mode 100644
index 00000000..3cd43710
--- /dev/null
+++ b/test/unicode_test.cc
@@ -0,0 +1,15 @@
+#include <string.h>
+#include <stdio.h>
+#include "../lout/unicode.hh"
+
+using namespace lout::unicode;
+
+int main (int argc, char *argv[])
+{
+ const char *t = "abcäöüабв−‐";
+
+ for (const char *s = t; s; s = nextUtf8Char (s, strlen (s)))
+ printf ("%3d -> U+%04x ('%s')\n", (int)(s - t), decodeUtf8(s), s);
+
+ return 0;
+}