summaryrefslogtreecommitdiff
path: root/tests/test_dom_modify.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-02-08 20:36:09 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-02-08 20:36:09 +0000
commitf9bbc39bd9a14124c1cba696c99d051a39e34b60 (patch)
treea870b80a24fc0a49a51d6a6df47e38f375c4cdb0 /tests/test_dom_modify.cpp
parentc3550de72b83bf70aa82f63b7395f1a0b41a4b0d (diff)
Implement long long support if PUGIXML_HAS_LONG_LONG is defined (autodetection is not implemented yet)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@962 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_dom_modify.cpp')
-rw-r--r--tests/test_dom_modify.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index 620504a..c7a3989 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -15,7 +15,7 @@ TEST_XML(dom_attr_assign, "<node/>")
node.append_attribute(STR("attr4")) = 4294967295u;
node.append_attribute(STR("attr5")) = 4294967294u;
- xml_attribute() = 2147483647;
+ xml_attribute() = 4294967295u;
node.append_attribute(STR("attr6")) = 0.5;
xml_attribute() = 0.5;
@@ -50,6 +50,38 @@ TEST_XML(dom_attr_set_value, "<node/>")
CHECK_NODE(node, STR("<node attr1=\"v1\" attr2=\"-2147483647\" attr3=\"-2147483648\" attr4=\"4294967295\" attr5=\"4294967294\" attr6=\"0.5\" attr7=\"true\" />"));
}
+#ifdef PUGIXML_HAS_LONG_LONG
+TEST_XML(dom_attr_assign_llong, "<node/>")
+{
+ xml_node node = doc.child(STR("node"));
+
+ node.append_attribute(STR("attr1")) = -9223372036854775807ll;
+ node.append_attribute(STR("attr2")) = -9223372036854775807ll - 1;
+ xml_attribute() = -9223372036854775807ll - 1;
+
+ node.append_attribute(STR("attr3")) = 18446744073709551615ull;
+ node.append_attribute(STR("attr4")) = 18446744073709551614ull;
+ xml_attribute() = 18446744073709551615ull;
+
+ CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\" />"));
+}
+
+TEST_XML(dom_attr_set_value_llong, "<node/>")
+{
+ xml_node node = doc.child(STR("node"));
+
+ CHECK(node.append_attribute(STR("attr1")).set_value(-9223372036854775807ll));
+ CHECK(node.append_attribute(STR("attr2")).set_value(-9223372036854775807ll - 1));
+ CHECK(!xml_attribute().set_value(-9223372036854775807ll - 1));
+
+ CHECK(node.append_attribute(STR("attr3")).set_value(18446744073709551615ull));
+ CHECK(node.append_attribute(STR("attr4")).set_value(18446744073709551614ull));
+ CHECK(!xml_attribute().set_value(18446744073709551615ull));
+
+ CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\" />"));
+}
+#endif
+
TEST_XML(dom_node_set_name, "<node>text</node>")
{
CHECK(doc.child(STR("node")).set_name(STR("n")));