From 4af5573f42a02c038e2ed3b65d07f2a1120d8faf Mon Sep 17 00:00:00 2001 From: Uli Kusterer Date: Tue, 21 Jan 2014 02:36:47 +0100 Subject: [PATCH] Tests for SetBoolFirstChild and BoolFirstChild. --- xmltest.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/xmltest.cpp b/xmltest.cpp index 6cde449..9fb021a 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -649,6 +649,61 @@ int main( int argc, const char ** argv ) } + // --------SetBoolFirstChild()----------- + { + const char* str = ""; + XMLDocument doc; + doc.Parse( str ); + XMLElement* element = doc.RootElement(); + + element->SetBoolFirstChild(true); + XMLTest( "SetBoolFirstChild() normal use (open/close).", "true", element->FirstChild()->ToElement()->Value() ); + + element->SetBoolFirstChild(false); + XMLTest( "SetBoolFirstChild() replace.", "false", element->FirstChild()->ToElement()->Value() ); + + str = ""; + doc.Parse( str ); + element = doc.RootElement(); + + element->SetBoolFirstChild(false); + XMLTest( "SetBoolFirstChild() normal use (self-closing).", "false", element->FirstChild()->ToElement()->Value() ); + } + + + // --------BoolFirstChild()----------- + { + const char* str = ""; + XMLDocument doc; + doc.Parse( str ); + XMLElement* element = doc.RootElement(); + + XMLTest( "BoolFirstChild() normal use (open/close).", false, element->BoolFirstChild() ); + + str = ""; + doc.Parse( str ); + element = doc.RootElement(); + XMLTest( "BoolFirstChild() normal use (open/close).", true, element->BoolFirstChild() ); + + str = ""; + doc.Parse( str ); + element = doc.RootElement(); + + element->SetBoolFirstChild(true); + XMLTest( "BoolFirstChild() after SetBoolFirstChild().", true, element->BoolFirstChild() ); + + element->SetBoolFirstChild(false); + XMLTest( "BoolFirstChild() after SetBoolFirstChild() replace.", false, element->BoolFirstChild() ); + + str = ""; + doc.Parse( str ); + + element = doc.RootElement(); + element->SetBoolFirstChild(false); + XMLTest( "BoolFirstChild() (self-closing) after SetBoolFirstChild() replace.", false, element->BoolFirstChild() ); + } + + // ---------- CDATA --------------- { const char* str = ""