From cf3a29feb5887344b6633ead1b4b6d5657a15a4b Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sun, 15 Jun 2014 03:24:33 +0200 Subject: old stuff: algorithms --- algorithms/list_test.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 algorithms/list_test.c (limited to 'algorithms/list_test.c') diff --git a/algorithms/list_test.c b/algorithms/list_test.c new file mode 100644 index 0000000..23990c2 --- /dev/null +++ b/algorithms/list_test.c @@ -0,0 +1,50 @@ +#include +#include +#include "list.h" + + +void +test1(void) +{ + char test1str[]="Hier gibts nichts mit Kommata zu splitten."; + List *l; + char *str; + + l = list_split(test1str, ","); + str = list_join(l, "Das hier darf nicht vorkommen"); + printf("Soll: %s\n", test1str); + printf("Ist: %s\n", str); + list_free(l); + free(str); + l = list_split(test1str, " "); + str = list_join(l, "um "); + printf("Soll: %s\n", "Hierum gibtsum nichtsum mitum" + " Kommataum zuum splitten."); + printf("Ist: %s\n", str); + list_free(l); + free(str); +} + +void +test2(void) +{ + char test2str[]="3, 4, 5, "; + List *l; + char *str; + + l = list_split(test2str, ", "); + str = list_join(l, "/"); + printf("Soll: %s\n", "3/4/5/"); + printf("Ist: %s\n", str); + list_free(l); + free(str); +} + +int main(void) +{ + test1(); + test2(); + + return 0; +} + -- cgit v1.2.3