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 9 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

} }
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() { bool testNullAttributeValue() {
std::string xml = "<data name='messageContent' value=''/>"; std::string xml = "<data name='messageContent' value=''/>";
RUN_TEST(testEmptyElement); RUN_TEST(testEmptyElement);
RUN_TEST(testSimilarElementName); RUN_TEST(testSimilarElementName);
RUN_TEST(testSimilarAttributeName); RUN_TEST(testSimilarAttributeName);
RUN_TEST(testHugeAttributeValue);
RUN_TEST(testNullAttributeValue); RUN_TEST(testNullAttributeValue);
RUN_TEST(testIndicator); RUN_TEST(testIndicator);
RUN_TEST(testIndicatorFunctor); RUN_TEST(testIndicatorFunctor);

Loading…
Cancel
Save