Pārlūkot izejas kodu

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 pirms 9 gadiem
vecāks
revīzija
54be713dc6
1 mainītis faili ar 42 papildinājumiem un 0 dzēšanām
  1. 42
    0
      TestXMLReader/testXMLReader.cpp

+ 42
- 0
TestXMLReader/testXMLReader.cpp Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt