瀏覽代碼

Added testRawData().


git-svn-id: https://svn.microneil.com/svn/CodeDweller-Tests/trunk@58 b3372362-9eaa-4a85-aa2b-6faa1ab7c995
master
adeniz 9 年之前
父節點
當前提交
c3c45e68d8
共有 1 個檔案被更改,包括 42 行新增0 行删除
  1. 42
    0
      TestXMLReader/testXMLReader.cpp

+ 42
- 0
TestXMLReader/testXMLReader.cpp 查看文件

@@ -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);

Loading…
取消
儲存