diff options
| author | Alan Conway <aconway@apache.org> | 2008-04-15 01:58:05 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-04-15 01:58:05 +0000 |
| commit | 4c49c328cbf78711341fd1b73935c2d2021d5cf3 (patch) | |
| tree | bf486ace4d214f95ef61d52ea0b5d2519f5044e1 /cpp/src/tests | |
| parent | 8543f48f658b001f063112ea4472f57d9068ed89 (diff) | |
| download | qpid-python-4c49c328cbf78711341fd1b73935c2d2021d5cf3.tar.gz | |
Struct32 encoding
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@648095 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
| -rw-r--r-- | cpp/src/tests/amqp_0_10/Map.cpp | 6 | ||||
| -rw-r--r-- | cpp/src/tests/amqp_0_10/serialize.cpp | 22 |
2 files changed, 23 insertions, 5 deletions
diff --git a/cpp/src/tests/amqp_0_10/Map.cpp b/cpp/src/tests/amqp_0_10/Map.cpp index dcba6e38c2..dcec1f49f7 100644 --- a/cpp/src/tests/amqp_0_10/Map.cpp +++ b/cpp/src/tests/amqp_0_10/Map.cpp @@ -19,8 +19,10 @@ * */ #include "unit_test.h" -#include "qpid/amqp_0_10/all_built_in_types.h" -//FIXME aconway 2008-04-08: #include "qpid/amqp_0_10/allSegmentTypes.h" +#include "qpid/amqp_0_10/Map.h" +#include "qpid/amqp_0_10/Array.h" +#include "qpid/amqp_0_10/Struct32.h" +#include "qpid/amqp_0_10/UnknownType.h" #include "qpid/amqp_0_10/Codec.h" #include <iostream> diff --git a/cpp/src/tests/amqp_0_10/serialize.cpp b/cpp/src/tests/amqp_0_10/serialize.cpp index 8928a9fbc9..f38de33bcc 100644 --- a/cpp/src/tests/amqp_0_10/serialize.cpp +++ b/cpp/src/tests/amqp_0_10/serialize.cpp @@ -30,7 +30,7 @@ #include "qpid/amqp_0_10/Codec.h" #include "qpid/amqp_0_10/specification.h" #include "qpid/amqp_0_10/ControlHolder.h" -#include "qpid/amqp_0_10/StructHolder.h" +#include "qpid/amqp_0_10/Struct32.h" #include "qpid/amqp_0_10/FrameHeader.h" #include "qpid/amqp_0_10/Map.h" #include "qpid/amqp_0_10/Unit.h" @@ -213,6 +213,22 @@ BOOST_AUTO_TEST_CASE(testControlEncodeDecode) { BOOST_CHECK_EQUAL(tune.heartbeatMax, 4u); } +BOOST_AUTO_TEST_CASE(testStruct32) { + message::DeliveryProperties dp; + dp.priority=message::MEDIUM; + dp.routingKey="foo"; + Struct32 s(dp); + string data; + Codec::encode(back_inserter(data))(s); + BOOST_CHECK_EQUAL(data.size(), Codec::size(s)); + Struct32 s2; + Codec::decode(data.begin())(s2); + message::DeliveryProperties* dp2 = s2.getIf<message::DeliveryProperties>(); + BOOST_REQUIRE(dp2); + BOOST_CHECK_EQUAL(dp2->priority, message::MEDIUM); + BOOST_CHECK_EQUAL(dp2->routingKey, "foo"); +} + struct DummyPacked { static const uint8_t PACK=1; boost::optional<char> i, j; @@ -319,10 +335,10 @@ BOOST_AUTO_TEST_CASE(testStruct) { BOOST_CHECK_EQUAL(encodedBits, packBits(dp)); data.clear(); - Struct::Holder h(dp); + Struct32 h(dp); Codec::encode(back_inserter(data))(h); - Struct::Holder h2; + Struct32 h2; Codec::decode(data.begin())(h2); BOOST_CHECK_EQUAL(h2.getClassCode(), Uint8(message::DeliveryProperties::CLASS_CODE)); BOOST_CHECK_EQUAL(h2.getCode(), Uint8(message::DeliveryProperties::CODE)); |
