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