summaryrefslogtreecommitdiff
path: root/tests/test_dom_traverse.cpp
blob: bbee0764c5ea578478a18a4d20a3818a6be8682b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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());
}