aboutsummaryrefslogtreecommitdiff
path: root/xmltest.cpp
diff options
context:
space:
mode:
authornetcan <1469709759@qq.com>2020-02-15 21:35:58 +0800
committernetcan <1469709759@qq.com>2020-03-02 22:26:03 +0800
commitdfb45cb73b24fed35c6749e00b3695f3da1ae2a6 (patch)
tree8e98f59935c671ea72e4164da7aa1e322d73494a /xmltest.cpp
parentff61650517cc32d524689366f977716e73d4f924 (diff)
downloadtinyxml2-dfb45cb73b24fed35c6749e00b3695f3da1ae2a6.tar.gz
support IntText(),UnsignedText(),Int64Text() for hex value
Diffstat (limited to 'xmltest.cpp')
-rwxr-xr-xxmltest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/xmltest.cpp b/xmltest.cpp
index 5a07547..a4c71a2 100755
--- a/xmltest.cpp
+++ b/xmltest.cpp
@@ -1577,6 +1577,24 @@ int main( int argc, const char ** argv )
XMLTest("FloatText()) test", true, test6);
}
+ {
+ //API:IntText(),UnsignedText(),Int64Text(), hex value test
+ const char* xml = "<point> <IntText> -0x2020</IntText> <UnsignedText>0x2020</UnsignedText> \
+ <Int64Text> +0x1234</Int64Text></point>";
+ XMLDocument doc;
+ doc.Parse(xml);
+
+ const XMLElement* pointElement = doc.RootElement();
+ int test1 = pointElement->FirstChildElement("IntText")->IntText();
+ XMLTest("IntText() hex value test", -0x2020, test1);
+
+ unsigned test2 = pointElement->FirstChildElement("UnsignedText")->UnsignedText();
+ XMLTest("UnsignedText() hex value test", static_cast<unsigned>(0x2020), test2);
+
+ int64_t test3 = pointElement->FirstChildElement("Int64Text")->Int64Text();
+ XMLTest("Int64Text() hex value test", static_cast<int64_t>(+0x1234), test3);
+ }
+
{
//API:ShallowEqual() test
const char* xml = "<playlist id = 'playlist'>"