|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool testRawData() {
|
|
|
|
|
|
|
|
|
|
|
|
std::string stageContent;
|
|
|
|
|
|
std::string elementXml, stageXml;
|
|
|
|
|
|
CodeDweller::XMLReaderElement reader("elem");
|
|
|
|
|
|
|
|
|
|
|
|
reader
|
|
|
|
|
|
.RawData(elementXml)
|
|
|
|
|
|
.Element("stage", stageContent)
|
|
|
|
|
|
.RawData(stageXml)
|
|
|
|
|
|
.End("stage")
|
|
|
|
|
|
.End("elem");
|
|
|
|
|
|
|
|
|
|
|
|
std::string xml;
|
|
|
|
|
|
|
|
|
|
|
|
xml = "<elem><stage>Content</stage></elem>";
|
|
|
|
|
|
|
|
|
|
|
|
CodeDweller::XMLReaderData confData(xml.data(), xml.size());
|
|
|
|
|
|
|
|
|
|
|
|
reader.initialize();
|
|
|
|
|
|
|
|
|
|
|
|
if (0 == reader.interpret(confData)) {
|
|
|
|
|
|
RETURN_FALSE("Error parsing XML: " + confData.Log.str());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (elementXml != xml) {
|
|
|
|
|
|
RETURN_FALSE("RawData() failure for root element");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ("<stage>Content</stage>" != stageXml) {
|
|
|
|
|
|
RETURN_FALSE("RawData() failure for child element");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ("Content" != stageContent) {
|
|
|
|
|
|
RETURN_FALSE("content failure for child element");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
bool testSimilarElementName() {
|
|
|
bool testSimilarElementName() {
|
|
|
|
|
|
|
|
|
std::string stageContent, stage1Content, stage2Content;
|
|
|
std::string stageContent, stage1Content, stage2Content;
|
|
|
|
|
|
|
|
|
<< std::endl;
|
|
|
<< std::endl;
|
|
|
|
|
|
|
|
|
RUN_TEST(testEmptyElement);
|
|
|
RUN_TEST(testEmptyElement);
|
|
|
|
|
|
RUN_TEST(testRawData);
|
|
|
RUN_TEST(testSimilarElementName);
|
|
|
RUN_TEST(testSimilarElementName);
|
|
|
RUN_TEST(testSimilarAttributeName);
|
|
|
RUN_TEST(testSimilarAttributeName);
|
|
|
RUN_TEST(testHugeAttributeValue);
|
|
|
RUN_TEST(testHugeAttributeValue);
|