diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-05 16:51:27 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-05 16:51:27 -0400 |
commit | b6858640ec6ca17dc746863d1e92cb2452253d7d (patch) | |
tree | 28eed53fbdbdaf0b946175905ffadaaad0760949 /src/test.c | |
parent | 0102df793c02c94eb48a16370610e0e28a5c3361 (diff) |
Get started on XML decoder
Diffstat (limited to 'src/test.c')
-rw-r--r-- | src/test.c | 31 |
1 files changed, 15 insertions, 16 deletions
@@ -210,14 +210,9 @@ void test_encode(void) map->n = 2; map->payload = (map_t []) { { - .attrs = (map_t []) {{ - .attrs = NULL, - .n_attrs = 0, - .tag = "id", - .payload = "0", - .size = sizeof(char), - .n = 1 - }}, + .attrs = (attr_t []) { + { .id = "id", .value = "0" } + }, .n_attrs = 1, .tag = "document", .payload = (map_t []) { @@ -234,14 +229,9 @@ void test_encode(void) .n = 1 }, { - .attrs = (map_t []){{ - .attrs = NULL, - .n_attrs = 0, - .tag = "id", - .payload = "1", - .size = sizeof(char), - .n = 1 - }}, + .attrs = (attr_t []) { + { .id = "id", .value = "1" } + }, .n_attrs = 1, .tag = "document", .payload = "test", @@ -260,6 +250,14 @@ void test_encode(void) free(xml); } +void test_decode(void) +{ + char *xml_string="<documents><document><key>value</key></document><document><key>value</key></document></documents>"; + int len; + map_t *map = decode(xml_string, &len); + free(map); +} + int main(void) { // test_writedb(); @@ -280,6 +278,7 @@ int main(void) // test_delkeys_single(); // test_delkeys_multi(); test_encode(); + test_decode(); exit(0); } |