summaryrefslogtreecommitdiff
path: root/src/test.c
diff options
context:
space:
mode:
authorbpc2003 <wpesfriendnva@gmail.com>2025-05-05 16:51:27 -0400
committerbpc2003 <wpesfriendnva@gmail.com>2025-05-05 16:51:27 -0400
commitb6858640ec6ca17dc746863d1e92cb2452253d7d (patch)
tree28eed53fbdbdaf0b946175905ffadaaad0760949 /src/test.c
parent0102df793c02c94eb48a16370610e0e28a5c3361 (diff)
Get started on XML decoder
Diffstat (limited to 'src/test.c')
-rw-r--r--src/test.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/test.c b/src/test.c
index 13745b8..56b0933 100644
--- a/src/test.c
+++ b/src/test.c
@@ -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);
}