XMLTest( "Programmatic DOM", true, doc->FirstChildElement()->FirstChildElement()->BoolAttribute( "attrib" ) );\r
int value1 = 10;\r
int value2 = doc->FirstChildElement()->LastChildElement()->IntAttribute( "attrib", 10 );\r
- int result = doc->FirstChildElement()->LastChildElement()->QueryIntAttribute( "attrib", &value1 );\r
- XMLTest( "Programmatic DOM", result, (int)XML_NO_ATTRIBUTE );\r
- XMLTest( "Programmatic DOM", value1, 10 );\r
- XMLTest( "Programmatic DOM", value2, 10 );\r
+ XMLError result = doc->FirstChildElement()->LastChildElement()->QueryIntAttribute( "attrib", &value1 );\r
+ XMLTest( "Programmatic DOM", XML_NO_ATTRIBUTE, result );\r
+ XMLTest( "Programmatic DOM", 10, value1 );\r
+ XMLTest( "Programmatic DOM", 10, value2 );\r
\r
doc->Print();\r
\r
\r
XMLDocument doc;\r
doc.Parse( error );\r
- XMLTest( "Bad XML", doc.ErrorID(), XML_ERROR_PARSING_ATTRIBUTE );\r
+ XMLTest( "Bad XML", XML_ERROR_PARSING_ATTRIBUTE, doc.ErrorID() );\r
}\r
\r
{\r
\r
XMLElement* ele = doc.FirstChildElement();\r
\r
- int iVal, result;\r
+ int iVal;\r
+ XMLError result;\r
double dVal;\r
\r
result = ele->QueryDoubleAttribute( "attr0", &dVal );\r
- XMLTest( "Query attribute: int as double", result, (int)XML_SUCCESS);\r
- XMLTest( "Query attribute: int as double", (int)dVal, 1 );\r
- XMLTest( "Query attribute: int as double", (int)ele->DoubleAttribute("attr0"), 1);\r
+ XMLTest( "Query attribute: int as double", XML_SUCCESS, result);\r
+ XMLTest( "Query attribute: int as double", 1, (int)dVal );\r
+ XMLTest( "Query attribute: int as double", 1, (int)ele->DoubleAttribute("attr0"));\r
\r
result = ele->QueryDoubleAttribute( "attr1", &dVal );\r
- XMLTest( "Query attribute: double as double", result, (int)XML_SUCCESS);\r
- XMLTest( "Query attribute: double as double", dVal, 2.0 );\r
- XMLTest( "Query attribute: double as double", ele->DoubleAttribute("attr1"), 2.0 );\r
+ XMLTest( "Query attribute: double as double", XML_SUCCESS, result);\r
+ XMLTest( "Query attribute: double as double", 2.0, dVal );\r
+ XMLTest( "Query attribute: double as double", 2.0, ele->DoubleAttribute("attr1") );\r
\r
result = ele->QueryIntAttribute( "attr1", &iVal );\r
- XMLTest( "Query attribute: double as int", result, (int)XML_SUCCESS);\r
- XMLTest( "Query attribute: double as int", iVal, 2 );\r
+ XMLTest( "Query attribute: double as int", XML_SUCCESS, result);\r
+ XMLTest( "Query attribute: double as int", 2, iVal );\r
\r
result = ele->QueryIntAttribute( "attr2", &iVal );\r
- XMLTest( "Query attribute: not a number", result, (int)XML_WRONG_ATTRIBUTE_TYPE );\r
- XMLTest( "Query attribute: not a number", ele->DoubleAttribute("attr2", 4.0), 4.0 );\r
+ XMLTest( "Query attribute: not a number", XML_WRONG_ATTRIBUTE_TYPE, result );\r
+ XMLTest( "Query attribute: not a number", 4.0, ele->DoubleAttribute("attr2", 4.0) );\r
\r
result = ele->QueryIntAttribute( "bar", &iVal );\r
- XMLTest( "Query attribute: does not exist", result, (int)XML_NO_ATTRIBUTE );\r
- XMLTest( "Query attribute: does not exist", ele->BoolAttribute("bar", true), true );\r
+ XMLTest( "Query attribute: does not exist", XML_NO_ATTRIBUTE, result );\r
+ XMLTest( "Query attribute: does not exist", true, ele->BoolAttribute("bar", true) );\r
}\r
\r
{\r
ele->QueryAttribute( "int", &iVal2 );\r
ele->QueryAttribute( "double", &dVal2 );\r
\r
- XMLTest( "Attribute match test", ele->Attribute( "str", "strValue" ), "strValue" );\r
+ XMLTest( "Attribute match test", "strValue", ele->Attribute( "str", "strValue" ) );\r
XMLTest( "Attribute round trip. c-string.", "strValue", cStr );\r
XMLTest( "Attribute round trip. int.", 1, iVal );\r
XMLTest( "Attribute round trip. double.", -1, (int)dVal );\r
{\r
XMLDocument doc;\r
doc.LoadFile("resources/printer.xml");\r
- XMLTest("XMLPrinter Stream mode: load", doc.ErrorID(), XML_SUCCESS, true);\r
+ XMLTest("XMLPrinter Stream mode: load", XML_SUCCESS, doc.ErrorID(), true);\r
\r
const XMLDocument& cdoc = doc;\r
\r
doc.Parse( str );\r
doc.Print();\r
\r
- XMLTest( "CDATA parse.", doc.FirstChildElement()->FirstChild()->Value(),\r
- "I am > the rules!\n...since I make symbolic puns",\r
+ XMLTest( "CDATA parse.", "I am > the rules!\n...since I make symbolic puns",\r
+ doc.FirstChildElement()->FirstChild()->Value(),\r
false );\r
}\r
\r
doc.Parse( str );\r
doc.Print();\r
\r
- XMLTest( "CDATA parse. [ tixml1:1480107 ]", doc.FirstChildElement()->FirstChild()->Value(),\r
+ XMLTest( "CDATA parse. [ tixml1:1480107 ]",\r
"<b>I am > the rules!</b>\n...since I make symbolic puns",\r
+ doc.FirstChildElement()->FirstChild()->Value(),\r
false );\r
}\r
\r
XMLNode* childNode0 = parent->InsertEndChild( childText0 );\r
XMLNode* childNode1 = parent->InsertAfterChild( childNode0, childText1 );\r
\r
- XMLTest( "Test InsertAfterChild on empty node. ", ( childNode1 == parent->LastChild() ), true );\r
+ XMLTest( "Test InsertAfterChild on empty node. ", true, ( childNode1 == parent->LastChild() ) );\r
}\r
\r
{\r
XMLDocument doc( false );\r
doc.Parse( passages );\r
\r
- XMLTest( "No entity parsing.", doc.FirstChildElement()->FirstChildElement()->Attribute( "context" ),\r
- "Line 5 has "quotation marks" and 'apostrophe marks'." );\r
- XMLTest( "No entity parsing.", doc.FirstChildElement()->FirstChildElement()->FirstChild()->Value(),\r
- "Crazy &ttk;" );\r
+ XMLTest( "No entity parsing.",\r
+ "Line 5 has "quotation marks" and 'apostrophe marks'.",\r
+ doc.FirstChildElement()->FirstChildElement()->Attribute( "context" ) );\r
+ XMLTest( "No entity parsing.", "Crazy &ttk;",\r
+ doc.FirstChildElement()->FirstChildElement()->FirstChild()->Value() );\r
doc.Print();\r
}\r
\r
\r
XMLDocument doc;\r
doc.Parse( test );\r
- XMLTest( "dot in names", doc.Error(), false );\r
- XMLTest( "dot in names", doc.FirstChildElement()->Name(), "a.elem" );\r
- XMLTest( "dot in names", doc.FirstChildElement()->Attribute( "xmi.version" ), "2.0" );\r
+ XMLTest( "dot in names", false, doc.Error() );\r
+ XMLTest( "dot in names", "a.elem", doc.FirstChildElement()->Name() );\r
+ XMLTest( "dot in names", "2.0", doc.FirstChildElement()->Attribute( "xmi.version" ) );\r
}\r
\r
{\r
\r
XMLText* text = doc.FirstChildElement()->FirstChildElement()->FirstChild()->ToText();\r
XMLTest( "Entity with one digit.",\r
- text->Value(), "1.1 Start easy ignore fin thickness\n",\r
+ "1.1 Start easy ignore fin thickness\n", text->Value(),\r
false );\r
}\r
\r
XMLDocument doc;\r
doc.Parse( "<test></test>" );\r
const char result[] = { 0x0e, 0 };\r
- XMLTest( "Low entities.", doc.FirstChildElement()->GetText(), result );\r
+ XMLTest( "Low entities.", result, doc.FirstChildElement()->GetText() );\r
doc.Print();\r
}\r
\r
// Attribute values with trailing quotes not handled correctly\r
XMLDocument doc;\r
doc.Parse( "<foo attribute=bar\" />" );\r
- XMLTest( "Throw error with bad end quotes.", doc.Error(), true );\r
+ XMLTest( "Throw error with bad end quotes.", true, doc.Error() );\r
}\r
\r
{\r
// [ 1663758 ] Failure to report error on bad XML\r
XMLDocument xml;\r
xml.Parse("<x>");\r
- XMLTest("Missing end tag at end of input", xml.Error(), true);\r
+ XMLTest("Missing end tag at end of input", true, xml.Error());\r
xml.Parse("<x> ");\r
- XMLTest("Missing end tag with trailing whitespace", xml.Error(), true);\r
+ XMLTest("Missing end tag with trailing whitespace", true, xml.Error());\r
xml.Parse("<x></y>");\r
- XMLTest("Mismatched tags", xml.ErrorID(), XML_ERROR_MISMATCHED_ELEMENT);\r
+ XMLTest("Mismatched tags", XML_ERROR_MISMATCHED_ELEMENT, xml.ErrorID() );\r
}\r
\r
\r
doc.Parse( xml );\r
\r
XMLElement* ele = XMLHandle( doc ).FirstChildElement( "element" ).FirstChild().ToElement();\r
- XMLTest( "Handle, success, mutable", ele->Value(), "sub" );\r
+ XMLTest( "Handle, success, mutable", "sub", ele->Value() );\r
\r
XMLHandle docH( doc );\r
ele = docH.FirstChildElement( "none" ).FirstChildElement( "element" ).ToElement();\r
doc.Print( &printer );\r
\r
static const char* result = "\xef\xbb\xbf<?xml version=\"1.0\" encoding=\"UTF-8\"?>";\r
- XMLTest( "BOM and default declaration", printer.CStr(), result, false );\r
- XMLTest( "CStrSize", printer.CStrSize(), 42, false );\r
+ XMLTest( "BOM and default declaration", result, printer.CStr(), false );\r
+ XMLTest( "CStrSize", 42, printer.CStrSize(), false );\r
}\r
{\r
const char* xml = "<ipxml ws='1'><info bla=' /></ipxml>";\r
pointElement->FirstChildElement( "valid" )->QueryBoolText( &boolValue );\r
\r
\r
- XMLTest( "QueryIntText", intValue, 1, false );\r
- XMLTest( "QueryUnsignedText", unsignedValue, (unsigned)1, false );\r
- XMLTest( "QueryFloatText", floatValue, 1.2f, false );\r
- XMLTest( "QueryDoubleText", doubleValue, 1.2, false );\r
- XMLTest( "QueryBoolText", boolValue, true, false );\r
+ XMLTest( "QueryIntText", 1, intValue, false );\r
+ XMLTest( "QueryUnsignedText", (unsigned)1, unsignedValue, false );\r
+ XMLTest( "QueryFloatText", 1.2f, floatValue, false );\r
+ XMLTest( "QueryDoubleText", 1.2, doubleValue, false );\r
+ XMLTest( "QueryBoolText", true, boolValue, false );\r
}\r
\r
{\r
const char* xml = "<element><_sub/><:sub/><sub:sub/><sub-sub/></element>";\r
XMLDocument doc;\r
doc.Parse( xml );\r
- XMLTest( "Non-alpha element lead letter parses.", doc.Error(), false );\r
+ XMLTest( "Non-alpha element lead letter parses.", false, doc.Error() );\r
}\r
\r
{\r
const char* xml = "<element _attr1=\"foo\" :attr2=\"bar\"></element>";\r
XMLDocument doc;\r
doc.Parse( xml );\r
- XMLTest("Non-alpha attribute lead character parses.", doc.Error(), false);\r
+ XMLTest("Non-alpha attribute lead character parses.", false, doc.Error());\r
}\r
\r
{\r
const char* xml = "<3lement></3lement>";\r
XMLDocument doc;\r
doc.Parse( xml );\r
- XMLTest("Element names with lead digit fail to parse.", doc.Error(), true);\r
+ XMLTest("Element names with lead digit fail to parse.", true, doc.Error());\r
}\r
\r
{\r
const char* xml = "<element/>WOA THIS ISN'T GOING TO PARSE";\r
XMLDocument doc;\r
doc.Parse( xml, 10 );\r
- XMLTest( "Set length of incoming data", doc.Error(), false );\r
+ XMLTest( "Set length of incoming data", false, doc.Error() );\r
}\r
\r
{\r
XMLDocument doc;\r
- XMLTest( "Document is initially empty", doc.NoChildren(), true );\r
+ XMLTest( "Document is initially empty", true, doc.NoChildren() );\r
doc.Clear();\r
- XMLTest( "Empty is empty after Clear()", doc.NoChildren(), true );\r
+ XMLTest( "Empty is empty after Clear()", true, doc.NoChildren() );\r
doc.LoadFile( "resources/dream.xml" );\r
- XMLTest( "Document has something to Clear()", doc.NoChildren(), false );\r
+ XMLTest( "Document has something to Clear()", false, doc.NoChildren() );\r
doc.Clear();\r
- XMLTest( "Document Clear()'s", doc.NoChildren(), true );\r
+ XMLTest( "Document Clear()'s", true, doc.NoChildren() );\r
}\r
\r
// ----------- Whitespace ------------\r
\r
XMLDocument doc;\r
doc.Parse(xml0);\r
- XMLTest("Test that the code changes do not affect normal parsing", doc.Error(), false);\r
+ XMLTest("Test that the code changes do not affect normal parsing", false, doc.Error() );\r
doc.Parse(xml1);\r
- XMLTest("Test that the second declaration is allowed", doc.Error(), false);\r
+ XMLTest("Test that the second declaration is allowed", false, doc.Error() );\r
doc.Parse(xml2);\r
- XMLTest("Test that declaration after a child is not allowed", doc.ErrorID(), XML_ERROR_PARSING_DECLARATION);\r
+ XMLTest("Test that declaration after a child is not allowed", XML_ERROR_PARSING_DECLARATION, doc.ErrorID() );\r
doc.Parse(xml3);\r
- XMLTest("Test that declaration after a child is not allowed", doc.ErrorID(), XML_ERROR_PARSING_DECLARATION);\r
+ XMLTest("Test that declaration after a child is not allowed", XML_ERROR_PARSING_DECLARATION, doc.ErrorID() );\r
doc.Parse(xml4);\r
- XMLTest("Test that declaration inside a child is not allowed", doc.ErrorID(), XML_ERROR_PARSING_DECLARATION);\r
+ XMLTest("Test that declaration inside a child is not allowed", XML_ERROR_PARSING_DECLARATION, doc.ErrorID() );\r
}\r
\r
{\r
// an interesting test case.\r
XMLDocument doc;\r
XMLError err = doc.Parse(xml);\r
- XMLElement* playlist = doc.FirstChildElement("playlist");\r
+ XMLTest("Crash bug parsing", XML_SUCCESS, err );\r
\r
- XMLTest("Crash bug parsing", err, XML_SUCCESS);\r
+ XMLElement* playlist = doc.FirstChildElement("playlist");\r
XMLTest("Crash bug parsing", true, playlist != 0);\r
\r
tinyxml2::XMLElement* entry = playlist->FirstChildElement("entry");\r
for (const XMLElement* p = playlist->FirstChildElement("property"); p; p = p->NextSiblingElement("property")) {\r
nProperty++;\r
}\r
- XMLTest("Crash bug parsing", nProperty, 2);\r
+ XMLTest("Crash bug parsing", 2, nProperty);\r
}\r
\r
// ----------- Line Number Tracking --------------\r