diff options
Diffstat (limited to 'algorithms/list_test.c')
-rw-r--r-- | algorithms/list_test.c | 50 |
1 files changed, 50 insertions, 0 deletions
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 <stdio.h> +#include <stdlib.h> +#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; +} + |