summaryrefslogtreecommitdiffstats
path: root/strlst-test.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-04-12 03:09:56 +0000
committerLennart Poettering <lennart@poettering.net>2005-04-12 03:09:56 +0000
commita20c01bd12216d409e0dfc5d3bbacc940352bfce (patch)
treee91508f26882306be164889a6bacc3be3517814d /strlst-test.c
parentb1d2a6b958d8d7a8ecf79765bb93aa57583d93bd (diff)
assorted work:
* new rr implementation: resource data is stored in parsed form now. * make TXT and SRV functions variadic * many other things git-svn-id: file:///home/lennart/svn/public/avahi/trunk@23 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'strlst-test.c')
-rw-r--r--strlst-test.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/strlst-test.c b/strlst-test.c
new file mode 100644
index 0000000..c4cef31
--- /dev/null
+++ b/strlst-test.c
@@ -0,0 +1,46 @@
+#include <glib.h>
+#include <stdio.h>
+
+#include "strlst.h"
+
+int main(int argc, char *argv[]) {
+ gchar *t;
+ guint8 data[1024];
+ flxStringList *a = NULL, *b;
+ guint size, n;
+
+ a = flx_string_list_add(a, "foo");
+ a = flx_string_list_add(a, "bar");
+ a = flx_string_list_add(a, "baz");
+
+ t = flx_string_list_to_string(a);
+ printf("--%s--\n", t);
+ g_free(t);
+
+ size = flx_string_list_serialize(a, data, sizeof(data));
+
+ printf("%u\n", size);
+
+ for (t = (gchar*) data, n = 0; n < size; n++, t++) {
+ if (*t <= 32)
+ printf("(%u)", *t);
+ else
+ printf("%c", *t);
+ }
+
+ printf("\n");
+
+ b = flx_string_list_parse(data, size);
+
+ g_assert(flx_string_list_equal(a, b));
+
+ t = flx_string_list_to_string(b);
+ printf("--%s--\n", t);
+ g_free(t);
+
+
+ flx_string_list_free(a);
+ flx_string_list_free(b);
+
+ return 0;
+}