Browse Source

Added test for huge (10 MB) attribute value.


git-svn-id: https://svn.microneil.com/svn/CodeDweller-Tests/trunk@57 b3372362-9eaa-4a85-aa2b-6faa1ab7c995
master
adeniz 8 years ago
parent
commit
54be713dc6
1 changed files with 42 additions and 0 deletions
  1. 42
    0
      TestXMLReader/testXMLReader.cpp

+ 42
- 0
TestXMLReader/testXMLReader.cpp View File

@@ -221,6 +221,47 @@ bool testSimilarAttributeName() {
}
bool testHugeAttributeValue() {
std::string xml = "<data name='messageContent' value='";
std::string expectedValue;
size_t nSize = 1000 * 1000 * 10;
expectedValue.reserve(nSize);
expectedValue.assign(nSize, 'x');
xml.reserve(nSize + 512);
xml.append(expectedValue);
xml.append("'/>");
CodeDweller::XMLReaderData confData(xml.data(), xml.size());
CodeDweller::XMLReaderElement reader("data");
std::string nameAttr, valueAttr;
reader
.Attribute("name", nameAttr)
.Attribute("value", valueAttr, ">")
.End("data");
reader.initialize();
if (0 == reader.interpret(confData)) {
RETURN_FALSE("Error parsing XML: " + confData.Log.str());
}
if ("messageContent" != nameAttr) {
RETURN_FALSE("\"name\" attribute read failure");
}
if (expectedValue != valueAttr) {
RETURN_FALSE("\"value\" attribute read failure");
}
return true;
}
bool testNullAttributeValue() {
std::string xml = "<data name='messageContent' value=''/>";
@@ -463,6 +504,7 @@ int main()
RUN_TEST(testEmptyElement);
RUN_TEST(testSimilarElementName);
RUN_TEST(testSimilarAttributeName);
RUN_TEST(testHugeAttributeValue);
RUN_TEST(testNullAttributeValue);
RUN_TEST(testIndicator);
RUN_TEST(testIndicatorFunctor);

Loading…
Cancel
Save