summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-09-21 00:35:57 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-09-21 00:35:57 -0700
commit3229e677120550a5a40b5b37ec46de6c2cad974c (patch)
tree172bbed7c7045f2047960660c52cdb54cc2381ac /tests
parentb0b84277fadc234fa994a41fa2e9c042581b3eba (diff)
Fix parsing of integers that start with +
This matches the format strtol supports.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_dom_traverse.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp
index 1fbc317..c7408cb 100644
--- a/tests/test_dom_traverse.cpp
+++ b/tests/test_dom_traverse.cpp
@@ -1224,4 +1224,21 @@ TEST_XML(dom_as_ullong_hex_overflow, "<node attr1='-0x1' attr2='0x10000000000000
CHECK(node.attribute(STR("attr2")).as_ullong() == 18446744073709551615ull);
CHECK(node.attribute(STR("attr3")).as_ullong() == 18446744073709551615ull);
}
-#endif \ No newline at end of file
+#endif
+
+TEST_XML(dom_as_int_plus, "<node attr1='+1' attr2='+0xa' />")
+{
+ xml_node node = doc.child(STR("node"));
+
+ CHECK(node.attribute(STR("attr1")).as_int() == 1);
+ CHECK(node.attribute(STR("attr1")).as_uint() == 1);
+ CHECK(node.attribute(STR("attr2")).as_int() == 10);
+ CHECK(node.attribute(STR("attr2")).as_uint() == 10);
+
+#ifdef PUGIXML_HAS_LONG_LONG
+ CHECK(node.attribute(STR("attr1")).as_llong() == 1);
+ CHECK(node.attribute(STR("attr1")).as_ullong() == 1);
+ CHECK(node.attribute(STR("attr2")).as_llong() == 10);
+ CHECK(node.attribute(STR("attr2")).as_ullong() == 10);
+#endif
+} \ No newline at end of file