diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-10 21:36:03 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-10 21:36:03 +0000 |
commit | 6db04f4320cd5d24ae625dbc1df5a8a71b93e51d (patch) | |
tree | e6e5c79464b4d4c05c75fd6dbb8f4d3e800edbcc /tests/test_dom_traverse.cpp | |
parent | ab28c3b45e611b5d49a03024bd6ae7b184d37d4a (diff) |
tests: Added simple test framework, added a couple of tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@140 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_dom_traverse.cpp')
-rw-r--r-- | tests/test_dom_traverse.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp new file mode 100644 index 0000000..bbee076 --- /dev/null +++ b/tests/test_dom_traverse.cpp @@ -0,0 +1,51 @@ +#include "common.hpp"
+
+TEST_XML(dom_attr_bool_ops, "<node attr='1'/>")
+{
+ xml_attribute attr1;
+ xml_attribute attr2 = doc.child("node").attribute("attr");
+
+ CHECK(!attr1);
+ CHECK(attr2);
+ CHECK(!!attr2);
+
+ bool attr1b = attr1;
+ bool attr2b = attr2;
+
+ CHECK(!attr1b);
+ CHECK(attr2b);
+}
+
+TEST_XML(dom_attr_empty, "<node attr='1'/>")
+{
+ xml_attribute attr1;
+ xml_attribute attr2 = doc.child("node").attribute("attr");
+
+ CHECK(attr1.empty());
+ CHECK(!attr2.empty());
+}
+
+TEST_XML(dom_node_bool_ops, "<node/>")
+{
+ xml_node node1;
+ xml_node node2 = doc.child("node");
+
+ CHECK(!node1);
+ CHECK(node2);
+ CHECK(!!node2);
+
+ bool node1b = node1;
+ bool node2b = node2;
+
+ CHECK(!node1b);
+ CHECK(node2b);
+}
+
+TEST_XML(dom_node_empty, "<node/>")
+{
+ xml_node node1;
+ xml_node node2 = doc.child("node");
+
+ CHECK(node1.empty());
+ CHECK(!node2.empty());
+}
|