diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-12 13:25:29 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-12 13:25:29 -0400 |
commit | e99a79f1499b6cfb60007587ebeda645c32d38dc (patch) | |
tree | d30220cda791f8ea0adecb8f8e4262be4335f150 /src/test.c | |
parent | 5bb744d350a68ff75e5af32b9070983b7e0aa716 (diff) |
Have decoder working properly
Diffstat (limited to 'src/test.c')
-rw-r--r-- | src/test.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1,5 +1,6 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "include/engine/engine.h" #include "include/xml/xml.h" @@ -265,6 +266,16 @@ void test_decode(void) "<set><key1>value1</key1><key2>value2</key2></set>"; int len = 0, start = 0; map_t *map = decode(xml, &start, &len); + printf("%s\n", (xml = encode(map, 1))); + free(xml); + // TODO: create a freemap function + free(map->tag); + map_t *pl = (map_t *) map->payload; + free(pl[0].tag); + free(pl[1].tag); + free(pl[0].payload); + free(pl[1].payload); + free(map->payload); free(map); } |