summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-05-16 00:46:03 +0000
committerLennart Poettering <lennart@poettering.net>2006-05-16 00:46:03 +0000
commit53595938d003411e6992e10b6a5c5e51b2a15d4f (patch)
tree2e87539822e92b4d44e8c885e0e86b98dc3330fe /src/tests
parentbf58753a99368c56e561106a2e193bcca24935cd (diff)
add new test programme utf8-test.c
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@880 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/utf8-test.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tests/utf8-test.c b/src/tests/utf8-test.c
new file mode 100644
index 00000000..c8b2fabb
--- /dev/null
+++ b/src/tests/utf8-test.c
@@ -0,0 +1,26 @@
+/* $Id$ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include <polypcore/utf8.h>
+#include <polypcore/xmalloc.h>
+
+int main(int argc, char *argv[]) {
+ char *c;
+
+ assert(pa_utf8_valid("hallo"));
+ assert(pa_utf8_valid("hallo\n"));
+ assert(!pa_utf8_valid("hüpfburg\n"));
+ assert(pa_utf8_valid("hallo\n"));
+ assert(pa_utf8_valid("hüpfburg\n"));
+
+ printf("LATIN1: %s\n", c = pa_utf8_filter("hüpfburg"));
+ pa_xfree(c);
+ printf("UTF8: %sx\n", c = pa_utf8_filter("hüpfburg"));
+ pa_xfree(c);
+ printf("LATIN1: %sx\n", c = pa_utf8_filter("üxknärzmörzeltörszß³§dsjkfh"));
+ pa_xfree(c);
+
+ return 0;
+}