summaryrefslogtreecommitdiff
path: root/cpp/src/tests/serialize.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-04-03 13:27:07 +0000
committerAlan Conway <aconway@apache.org>2008-04-03 13:27:07 +0000
commitbffa2485f1e33eb1a273d2b74149f0ccb0742c60 (patch)
treef116d78d4aab7699806882e2660bf81578b98ea7 /cpp/src/tests/serialize.cpp
parent833239ec44ea87a1b619eef3de55afde56c7ee45 (diff)
downloadqpid-python-bffa2485f1e33eb1a273d2b74149f0ccb0742c60.tar.gz
amqp_0_10/built_in_types.h
- generic Wrapper template for making distinct types. - added Bit - bool wrapper with empty encode/decode. amqp_0_10/complex_types.h: - Added constants SIZE=0, PACK=2 to Action base class. amqp_0_10/PackedCodec.h: - Decode packed struct fields according to the packing bits. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@644308 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/serialize.cpp')
-rw-r--r--cpp/src/tests/serialize.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/cpp/src/tests/serialize.cpp b/cpp/src/tests/serialize.cpp
index da71917cbd..1f576d6ee1 100644
--- a/cpp/src/tests/serialize.cpp
+++ b/cpp/src/tests/serialize.cpp
@@ -22,6 +22,7 @@
#include "unit_test.h"
#include "qpid/amqp_0_10/built_in_types.h"
#include "qpid/amqp_0_10/Codec.h"
+#include "qpid/amqp_0_10/PackedCodec.h"
#include "qpid/amqp_0_10/specification.h"
#include "qpid/amqp_0_10/ControlHolder.h"
#include "qpid/amqp_0_10/Frame.h"
@@ -170,7 +171,7 @@ BOOST_AUTO_TEST_CASE(testControlEncodeDecode) {
BOOST_CHECK_EQUAL(data.size(), Codec::size(h));
- Codec::Decode<string::iterator> decode(data.begin());
+ Codec::Decoder<string::iterator> decode(data.begin());
Control::Holder h2;
decode(h2);
@@ -226,4 +227,15 @@ BOOST_AUTO_TEST_CASE(testFrameEncodeDecode) {
}
+BOOST_AUTO_TEST_CASE(testPackedCodec) {
+ int i=-1, j=-1, k=-1, l=-1;
+ std::string data;
+ Codec::encode(std::back_inserter(data))(1)(3);
+ PackedCodec::decode(0x5, Codec::decode(data.begin()))(i)(j)(k)(l);
+ BOOST_CHECK_EQUAL(i, 1);
+ BOOST_CHECK_EQUAL(j, 0);
+ BOOST_CHECK_EQUAL(k, 3);
+ BOOST_CHECK_EQUAL(l, 0);
+}
+
QPID_AUTO_TEST_SUITE_END()