summaryrefslogtreecommitdiff
path: root/cpp/src/tests/FramingTest.cpp
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2010-10-28 21:33:52 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2010-10-28 21:33:52 +0000
commite5f27778179696429e4212611c6e5454e2a63e99 (patch)
tree58597637361766aeba3bf863ef4534cc74756643 /cpp/src/tests/FramingTest.cpp
parent3caac30ac5a8c2be453c1224e010fafa60e17ebf (diff)
downloadqpid-python-e5f27778179696429e4212611c6e5454e2a63e99.tar.gz
QPID-2916: throw an exception when a data value cannot be encoded correctly as its type.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1028501 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/FramingTest.cpp')
-rw-r--r--cpp/src/tests/FramingTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/cpp/src/tests/FramingTest.cpp b/cpp/src/tests/FramingTest.cpp
index 3d0fa0c0de..f8795316cc 100644
--- a/cpp/src/tests/FramingTest.cpp
+++ b/cpp/src/tests/FramingTest.cpp
@@ -151,6 +151,17 @@ QPID_AUTO_TEST_CASE(testMessageCancelBodyFrame)
BOOST_CHECK_EQUAL(tostring(in), tostring(out));
}
+QPID_AUTO_TEST_CASE(badStrings) {
+ char data[(65535 + 2) + (255 + 1)];
+ Buffer b(data, sizeof(data));
+ BOOST_CHECK_THROW(b.putShortString(std::string(256, 'X')),
+ Exception);
+ BOOST_CHECK_THROW(b.putMediumString(std::string(65536, 'X')),
+ Exception);
+ b.putShortString(std::string(255, 'X'));
+ b.putMediumString(std::string(65535, 'X'));
+}
+
QPID_AUTO_TEST_SUITE_END()
}} // namespace qpid::tests