mirror of
https://github.com/zoriya/xmlParser.git
synced 2026-06-01 01:28:14 +00:00
Adding complete support of strings
This commit is contained in:
+8
-6
@@ -35,18 +35,20 @@ Test(xml, withparam)
|
||||
|
||||
Test(xml, withnext)
|
||||
{
|
||||
char *xml = strdup("<yes params=\"Test\"/><nop/>");
|
||||
char *xml = strdup("<yes params=\"Test\"><nop/><yep/></yes>");
|
||||
node *n = xml_parsenode(&xml);
|
||||
|
||||
cr_assert_str_eq(n->name, "yes");
|
||||
cr_assert_eq(n->child, NULL);
|
||||
cr_assert_str_eq(n->child->name, "nop");
|
||||
cr_assert_eq(n->child->child, NULL);
|
||||
cr_assert_eq(n->child->properties, NULL);
|
||||
cr_assert_str_eq(n->child->next->name, "yep");
|
||||
cr_assert_eq(n->child->next->child, NULL);
|
||||
cr_assert_eq(n->child->next->properties, NULL);
|
||||
cr_assert_eq(n->child->next->next, NULL);
|
||||
cr_assert_str_eq(n->properties->key, "params");
|
||||
cr_assert_str_eq(n->properties->value, "Test");
|
||||
cr_assert_eq(n->properties->next, NULL);
|
||||
cr_assert_str_eq(n->next->name, "nop");
|
||||
cr_assert_eq(n->next->child, NULL);
|
||||
cr_assert_eq(n->next->properties, NULL);
|
||||
cr_assert_eq(n->next->next, NULL);
|
||||
}
|
||||
|
||||
Test(xml, withchild)
|
||||
|
||||
@@ -20,4 +20,25 @@ Test(xml, complete)
|
||||
cr_assert_eq(n->child->child, NULL);
|
||||
cr_assert_eq(n->child->properties, NULL);
|
||||
cr_assert_eq(n->child->next, NULL);
|
||||
}
|
||||
|
||||
Test(xml, completewstring)
|
||||
{
|
||||
node *n = xmlparse("tests/teststring.txt");
|
||||
|
||||
cr_assert_str_eq(n->name, "entity");
|
||||
cr_assert_eq(n->next, NULL);
|
||||
cr_assert_str_eq(n->properties->key, "id");
|
||||
cr_assert_str_eq(n->properties->value, "0");
|
||||
cr_assert_eq(n->properties->next, NULL);
|
||||
cr_assert_str_eq(n->child->name, "PositionComponent");
|
||||
cr_assert_eq(n->child->properties, NULL);
|
||||
cr_assert_eq(n->child->next, NULL);
|
||||
cr_assert_str_eq(n->child->child->name, "pos");
|
||||
cr_assert_str_eq(n->child->child->child->properties->value, "5,5");
|
||||
cr_assert_str_eq(n->child->child->next->name, "size");
|
||||
cr_assert_str_eq(n->child->child->next->properties->key, "x");
|
||||
cr_assert_str_eq(n->child->child->next->properties->value, "500");
|
||||
cr_assert_str_eq(n->child->child->next->properties->next->key, "y");
|
||||
cr_assert_str_eq(n->child->child->next->properties->next->value, "500");
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<entity id="0">
|
||||
<PositionComponent>
|
||||
<pos>5, 5</pos>
|
||||
<size x="500" y="500"/>
|
||||
</PositionComponent>
|
||||
</entity>
|
||||
Reference in New Issue
Block a user