|
|
@@ -121,6 +121,47 @@ bool testEmptyElement() { |
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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() {
|
|
|
|
|
|
|
|
std::string stageContent, stage1Content, stage2Content;
|
|
|
@@ -502,6 +543,7 @@ int main() |
|
|
|
<< std::endl;
|
|
|
|
|
|
|
|
RUN_TEST(testEmptyElement);
|
|
|
|
RUN_TEST(testRawData);
|
|
|
|
RUN_TEST(testSimilarElementName);
|
|
|
|
RUN_TEST(testSimilarAttributeName);
|
|
|
|
RUN_TEST(testHugeAttributeValue);
|