diff options
Diffstat (limited to 'tests/test_dom_modify.cpp')
-rw-r--r-- | tests/test_dom_modify.cpp | 34 |
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"))); |