diff --git a/upptst/XmlNode/0.xml b/upptst/XmlNode/0.xml new file mode 100644 index 000000000..b8c37fc76 --- /dev/null +++ b/upptst/XmlNode/0.xml @@ -0,0 +1,9 @@ + + + + + + Some text + + + diff --git a/upptst/XmlNode/XmlNode.cpp b/upptst/XmlNode/XmlNode.cpp new file mode 100644 index 000000000..f271cf86b --- /dev/null +++ b/upptst/XmlNode/XmlNode.cpp @@ -0,0 +1,23 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + XmlNode a = ParseXMLFile(GetDataFile("0.xml")); + XmlNode b = a; // pick copy + ASSERT(a.IsPicked()); + ASSERT(!b.IsPicked()); + + DDUMP(AsXML(b, XML_HEADER|XML_DOCTYPE)); + a <<= b; + ASSERT(!a.IsPicked()); + ASSERT(!b.IsPicked()); + DDUMP(AsXML(a, XML_HEADER|XML_DOCTYPE)); + DDUMP(AsXML(b, XML_HEADER|XML_DOCTYPE)); + AsXML(b, XML_HEADER|XML_DOCTYPE); + + DLOG("================ OK"); +} diff --git a/upptst/XmlNode/XmlNode.upp b/upptst/XmlNode/XmlNode.upp new file mode 100644 index 000000000..f2ea21adb --- /dev/null +++ b/upptst/XmlNode/XmlNode.upp @@ -0,0 +1,10 @@ +uses + Core; + +file + XmlNode.cpp, + 0.xml; + +mainconfig + "" = "SSE2"; + diff --git a/upptst/XmlNode/init b/upptst/XmlNode/init new file mode 100644 index 000000000..279707b18 --- /dev/null +++ b/upptst/XmlNode/init @@ -0,0 +1,4 @@ +#ifndef _XmlNode_icpp_init_stub +#define _XmlNode_icpp_init_stub +#include "Core/init" +#endif diff --git a/upptst/XmlStream/1.xml b/upptst/XmlStream/1.xml new file mode 100644 index 000000000..b48027e72 --- /dev/null +++ b/upptst/XmlStream/1.xml @@ -0,0 +1,10 @@ + + + + + + + A410065 + + + diff --git a/upptst/XmlStream/2.xml b/upptst/XmlStream/2.xml new file mode 100644 index 000000000..8b5b63b87 --- /dev/null +++ b/upptst/XmlStream/2.xml @@ -0,0 +1 @@ +A410065 diff --git a/upptst/XmlStream/XmlStream.cpp b/upptst/XmlStream/XmlStream.cpp index f941e4b74..00dd9ce67 100644 --- a/upptst/XmlStream/XmlStream.cpp +++ b/upptst/XmlStream/XmlStream.cpp @@ -9,6 +9,8 @@ void Check0(const String& xml0, bool full) String xml = AsXML(ParseXML(xml0, pstyle), astyle); String p = GetHomeDirFile("XML.xml"); SaveFile(p, xml); + XmlNode h = ParseXMLFile(p, pstyle); + AsXML(h); String xml2 = AsXML(ParseXMLFile(p, pstyle), astyle); SaveFile(GetHomeDirFile("XML2.xml"), xml2); String xml1 = AsXML(ParseXML(xml, pstyle), astyle); @@ -54,28 +56,32 @@ void GenNode(XmlNode& n) void CheckFile(const char *path) { - Cout() << path << '\n'; + LOG("======= " << path); Check(AsXML(ParseXML(LoadFile(path), 0))); } CONSOLE_APP_MAIN { + StdLogSetup(LOG_COUT|LOG_FILE); + + + for(FindFile ff(GetDataFile("*.xml")); ff; ff.Next()) + CheckFile(ff.GetPath()); + + LOG("----- Fixed files OK"); + SeedRandom(); for(int i = 0; i < 100; i++) { - Cout() << i << '\n'; + LOG("* " << i); XmlNode n; XmlNode& nn = n.Add(); nn.CreateTag(GenID()); for(int i = 0; i < 100; i++) { GenNode(nn); String xml = AsXML(n); - LOG("============"); - LOG(xml); Check(AsXML(n)); } } - for(FindFile ff(GetDataFile("*.xml")); ff; ff.Next()) - CheckFile(ff.GetPath()); } diff --git a/upptst/XmlStream/XmlStream.upp b/upptst/XmlStream/XmlStream.upp index a3d77d678..12dc3f593 100644 --- a/upptst/XmlStream/XmlStream.upp +++ b/upptst/XmlStream/XmlStream.upp @@ -3,7 +3,9 @@ uses file XmlStream.cpp, - 0.xml; + 0.xml, + 1.xml, + 2.xml; mainconfig "" = "SSE2 TEST_XML";