summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-04-18 14:12:36 +0000
committerAlan Conway <aconway@apache.org>2008-04-18 14:12:36 +0000
commitff4a39a88a6bb1ebfdb407c9535862d828954093 (patch)
tree347892602336a53105c6ac930468f4c258ee3dcc /cpp/src
parentd80112d4976b7f44a3fd7b6f85636d44c70401fb (diff)
downloadqpid-python-ff4a39a88a6bb1ebfdb407c9535862d828954093.tar.gz
Uncommented tests.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@649547 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/tests/amqp_0_10/serialize.cpp567
1 files changed, 283 insertions, 284 deletions
diff --git a/cpp/src/tests/amqp_0_10/serialize.cpp b/cpp/src/tests/amqp_0_10/serialize.cpp
index 901779d8a3..b5f040c722 100644
--- a/cpp/src/tests/amqp_0_10/serialize.cpp
+++ b/cpp/src/tests/amqp_0_10/serialize.cpp
@@ -81,296 +81,295 @@ typedef mpl::vector<Map, Vbin8, Str8Latin, Str8, Str8Utf16, Vbin16, Str16Latin,
typedef concat4<IntegralTypes, BinTypes, FloatTypes, FixedSizeClassTypes>::type FixedSizeTypes;
typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes;
-// FIXME aconway 2008-04-15:
-// // TODO aconway 2008-02-20: should test 64 bit integrals for order also.
-// QPID_AUTO_TEST_CASE(testNetworkByteOrder) {
-// string data;
-
-// uint32_t l = 0x11223344;
-// Codec::encode(std::back_inserter(data))(l);
-// uint32_t enc=reinterpret_cast<const uint32_t&>(*data.data());
-// uint32_t l2 = ntohl(enc);
-// BOOST_CHECK_EQUAL(l, l2);
-
-// data.clear();
-// uint16_t s = 0x1122;
-// Codec::encode(std::back_inserter(data))(s);
-// uint32_t s2 = ntohs(*reinterpret_cast<const uint32_t*>(data.data()));
-// BOOST_CHECK_EQUAL(s, s2);
-// }
-
-// QPID_AUTO_TEST_CASE(testSetLimit) {
-// typedef Codec::Encoder<back_insert_iterator<string> > Encoder;
-// string data;
-// Encoder encode(back_inserter(data), 3);
-// encode('1')('2')('3');
-// try {
-// encode('4');
-// BOOST_FAIL("Expected exception");
-// } catch (...) {} // FIXME aconway 2008-04-03: catch proper exception
-// BOOST_CHECK_EQUAL(data, "123");
-// }
-
-// QPID_AUTO_TEST_CASE(testScopedLimit) {
-// typedef Codec::Encoder<back_insert_iterator<string> > Encoder;
-// string data;
-// Encoder encode(back_inserter(data), 10);
-// encode(Str8("123")); // 4 bytes
-// {
-// Encoder::ScopedLimit l(encode, 3);
-// encode('a')('b')('c');
-// try {
-// encode('d');
-// BOOST_FAIL("Expected exception");
-// } catch(...) {} // FIXME aconway 2008-04-03: catch proper exception
-// }
-// BOOST_CHECK_EQUAL(data, "\003123abc");
-// encode('x')('y')('z');
-// try {
-// encode('!');
-// BOOST_FAIL("Expected exception");
-// } catch(...) {} // FIXME aconway 2008-04-03: catch proper exception
-// BOOST_CHECK_EQUAL(data.size(), 10u);
-// }
-
-// // Assign test values to the various types.
-// void testValue(bool& b) { b = true; }
-// void testValue(Bit&) { }
-// template <class T> typename boost::enable_if<boost::is_arithmetic<T> >::type testValue(T& n) { n=42; }
-// void testValue(CharUtf32& c) { c = 43; }
-// void testValue(long long& l) { l = 0x012345; }
-// void testValue(Datetime& dt) { dt = qpid::sys::now(); }
-// void testValue(Uuid& uuid) { uuid=Uuid(true); }
-// template <class E, class M> void testValue(Decimal<E,M>& d) { d.exponent=2; d.mantissa=0x1122; }
-// void testValue(SequenceNo& s) { s = 42; }
-// template <size_t N> void testValue(Bin<N>& a) { a.assign(42); }
-// template <class T, class S, int Unique> void testValue(SerializableString<T, S, Unique>& s) {
-// char msg[]="foobar";
-// s.assign(msg, msg+sizeof(msg));
-// }
-// void testValue(Str16& s) { s = "the quick brown fox jumped over the lazy dog"; }
-// void testValue(Str8& s) { s = "foobar"; }
-// void testValue(Map& m) { m["s"] = Str8("foobar"); m["b"] = true; m["c"] = uint16_t(42); }
-
-// //typedef mpl::vector<Str8, Str16>::type TestTypes;
-// QPID_AUTO_TEST_CASE_TEMPLATE(testEncodeDecode, T, AllTypes)
-// {
-// string data;
-// T t;
-// testValue(t);
-// Codec::encode(std::back_inserter(data))(t);
-
-// BOOST_CHECK_EQUAL(Codec::size(t), data.size());
-
-// T t2;
-// Codec::decode(data.begin())(t2);
-// BOOST_CHECK_EQUAL(t,t2);
-// }
-
-// struct TestMe {
-// bool encoded, decoded;
-// char value;
-// TestMe(char v) : encoded(), decoded(), value(v) {}
-// template <class S> void encode(S& s) const {
-// const_cast<TestMe*>(this)->encoded=true; s(value);
-// }
-// template <class S> void decode(S& s) { decoded=true; s(value); }
-// template <class S> void serialize(S& s) { s.split(*this); }
-// };
-
-// QPID_AUTO_TEST_CASE(testSplit) {
-// string data;
-// TestMe t1('x');
-// Codec::encode(std::back_inserter(data))(t1);
-// BOOST_CHECK(t1.encoded);
-// BOOST_CHECK(!t1.decoded);
-// BOOST_CHECK_EQUAL(data, "x");
-
-// TestMe t2('y');
-// Codec::decode(data.begin())(t2);
-// BOOST_CHECK(!t2.encoded);
-// BOOST_CHECK(t2.decoded);
-// BOOST_CHECK_EQUAL(t2.value, 'x');
-// }
-
-// QPID_AUTO_TEST_CASE(testControlEncodeDecode) {
-// string data;
-// Control::Holder h(in_place<connection::Tune>(1,2,3,4));
-// Codec::encode(std::back_inserter(data))(h);
+// TODO aconway 2008-02-20: should test 64 bit integrals for order also.
+QPID_AUTO_TEST_CASE(testNetworkByteOrder) {
+ string data;
+
+ uint32_t l = 0x11223344;
+ Codec::encode(std::back_inserter(data))(l);
+ uint32_t enc=reinterpret_cast<const uint32_t&>(*data.data());
+ uint32_t l2 = ntohl(enc);
+ BOOST_CHECK_EQUAL(l, l2);
+
+ data.clear();
+ uint16_t s = 0x1122;
+ Codec::encode(std::back_inserter(data))(s);
+ uint32_t s2 = ntohs(*reinterpret_cast<const uint32_t*>(data.data()));
+ BOOST_CHECK_EQUAL(s, s2);
+}
+
+QPID_AUTO_TEST_CASE(testSetLimit) {
+ typedef Codec::Encoder<back_insert_iterator<string> > Encoder;
+ string data;
+ Encoder encode(back_inserter(data), 3);
+ encode('1')('2')('3');
+ try {
+ encode('4');
+ BOOST_FAIL("Expected exception");
+ } catch (...) {} // FIXME aconway 2008-04-03: catch proper exception
+ BOOST_CHECK_EQUAL(data, "123");
+}
+
+QPID_AUTO_TEST_CASE(testScopedLimit) {
+ typedef Codec::Encoder<back_insert_iterator<string> > Encoder;
+ string data;
+ Encoder encode(back_inserter(data), 10);
+ encode(Str8("123")); // 4 bytes
+ {
+ Encoder::ScopedLimit l(encode, 3);
+ encode('a')('b')('c');
+ try {
+ encode('d');
+ BOOST_FAIL("Expected exception");
+ } catch(...) {} // FIXME aconway 2008-04-03: catch proper exception
+ }
+ BOOST_CHECK_EQUAL(data, "\003123abc");
+ encode('x')('y')('z');
+ try {
+ encode('!');
+ BOOST_FAIL("Expected exception");
+ } catch(...) {} // FIXME aconway 2008-04-03: catch proper exception
+ BOOST_CHECK_EQUAL(data.size(), 10u);
+}
+
+// Assign test values to the various types.
+void testValue(bool& b) { b = true; }
+void testValue(Bit&) { }
+template <class T> typename boost::enable_if<boost::is_arithmetic<T> >::type testValue(T& n) { n=42; }
+void testValue(CharUtf32& c) { c = 43; }
+void testValue(long long& l) { l = 0x012345; }
+void testValue(Datetime& dt) { dt = qpid::sys::now(); }
+void testValue(Uuid& uuid) { uuid=Uuid(true); }
+template <class E, class M> void testValue(Decimal<E,M>& d) { d.exponent=2; d.mantissa=0x1122; }
+void testValue(SequenceNo& s) { s = 42; }
+template <size_t N> void testValue(Bin<N>& a) { a.assign(42); }
+template <class T, class S, int Unique> void testValue(SerializableString<T, S, Unique>& s) {
+ char msg[]="foobar";
+ s.assign(msg, msg+sizeof(msg));
+}
+void testValue(Str16& s) { s = "the quick brown fox jumped over the lazy dog"; }
+void testValue(Str8& s) { s = "foobar"; }
+void testValue(Map& m) { m["s"] = Str8("foobar"); m["b"] = true; m["c"] = uint16_t(42); }
+
+//typedef mpl::vector<Str8, Str16>::type TestTypes;
+QPID_AUTO_TEST_CASE_TEMPLATE(testEncodeDecode, T, AllTypes)
+{
+ string data;
+ T t;
+ testValue(t);
+ Codec::encode(std::back_inserter(data))(t);
+
+ BOOST_CHECK_EQUAL(Codec::size(t), data.size());
+
+ T t2;
+ Codec::decode(data.begin())(t2);
+ BOOST_CHECK_EQUAL(t,t2);
+}
+
+struct TestMe {
+ bool encoded, decoded;
+ char value;
+ TestMe(char v) : encoded(), decoded(), value(v) {}
+ template <class S> void encode(S& s) const {
+ const_cast<TestMe*>(this)->encoded=true; s(value);
+ }
+ template <class S> void decode(S& s) { decoded=true; s(value); }
+ template <class S> void serialize(S& s) { s.split(*this); }
+};
+
+QPID_AUTO_TEST_CASE(testSplit) {
+ string data;
+ TestMe t1('x');
+ Codec::encode(std::back_inserter(data))(t1);
+ BOOST_CHECK(t1.encoded);
+ BOOST_CHECK(!t1.decoded);
+ BOOST_CHECK_EQUAL(data, "x");
+
+ TestMe t2('y');
+ Codec::decode(data.begin())(t2);
+ BOOST_CHECK(!t2.encoded);
+ BOOST_CHECK(t2.decoded);
+ BOOST_CHECK_EQUAL(t2.value, 'x');
+}
+
+QPID_AUTO_TEST_CASE(testControlEncodeDecode) {
+ string data;
+ Control::Holder h(in_place<connection::Tune>(1,2,3,4));
+ Codec::encode(std::back_inserter(data))(h);
-// BOOST_CHECK_EQUAL(data.size(), Codec::size(h));
-
-// Codec::Decoder<string::iterator> decode(data.begin());
-// Control::Holder h2;
-// decode(h2);
-
-// BOOST_REQUIRE(h2.get());
-// BOOST_CHECK_EQUAL(h2.get()->getClassCode(), connection::CODE);
-// BOOST_CHECK_EQUAL(h2.get()->getCode(), uint8_t(connection::Tune::CODE));
-// connection::Tune& tune=static_cast<connection::Tune&>(*h2.get());
-// BOOST_CHECK_EQUAL(tune.channelMax, 1u);
-// BOOST_CHECK_EQUAL(tune.maxFrameSize, 2u);
-// BOOST_CHECK_EQUAL(tune.heartbeatMin, 3u);
-// BOOST_CHECK_EQUAL(tune.heartbeatMax, 4u);
-// }
-
-// QPID_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);
-
-// uint32_t structSize; // Starts with size
-// Codec::decode(data.begin())(structSize);
-// BOOST_CHECK_EQUAL(structSize, Codec::size(dp) + 2); // +2 for code
-// BOOST_CHECK_EQUAL(structSize, data.size()-4); // encoded body
+ BOOST_CHECK_EQUAL(data.size(), Codec::size(h));
+
+ Codec::Decoder<string::iterator> decode(data.begin());
+ Control::Holder h2;
+ decode(h2);
+
+ BOOST_REQUIRE(h2.get());
+ BOOST_CHECK_EQUAL(h2.get()->getClassCode(), connection::CODE);
+ BOOST_CHECK_EQUAL(h2.get()->getCode(), uint8_t(connection::Tune::CODE));
+ connection::Tune& tune=static_cast<connection::Tune&>(*h2.get());
+ BOOST_CHECK_EQUAL(tune.channelMax, 1u);
+ BOOST_CHECK_EQUAL(tune.maxFrameSize, 2u);
+ BOOST_CHECK_EQUAL(tune.heartbeatMin, 3u);
+ BOOST_CHECK_EQUAL(tune.heartbeatMax, 4u);
+}
+
+QPID_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);
+
+ uint32_t structSize; // Starts with size
+ Codec::decode(data.begin())(structSize);
+ BOOST_CHECK_EQUAL(structSize, Codec::size(dp) + 2); // +2 for code
+ BOOST_CHECK_EQUAL(structSize, data.size()-4); // encoded body
-// 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");
-// }
-
-// QPID_AUTO_TEST_CASE(testStruct32Unknown) {
-// // Verify we can recode an unknown struct unchanged.
-// Struct32 s;
-// string data;
-// Codec::encode(back_inserter(data))(uint32_t(10));
-// data.append(10, 'X');
-// Codec::decode(data.begin())(s);
-// string data2;
-// Codec::encode(back_inserter(data2))(s);
-// BOOST_CHECK_EQUAL(data.size(), data2.size());
-// BOOST_CHECK_EQUAL(data, data2);
-// }
-
-// struct DummyPacked {
-// static const uint8_t PACK=1;
-// boost::optional<char> i, j;
-// char k;
-// Bit l,m;
-// DummyPacked(char a=0, char b=0, char c=0) : i(a), j(b), k(c), l(), m() {}
-// template <class S> void serialize(S& s) { s(i)(j)(k)(l)(m); }
-// };
-
-// Packer<DummyPacked> serializable(DummyPacked& d) { return Packer<DummyPacked>(d); }
-
-// QPID_AUTO_TEST_CASE(testPackBits) {
-// DummyPacked d('a','b','c');
-// BOOST_CHECK_EQUAL(packBits(d), 7u);
-// d.j = boost::none;
-// BOOST_CHECK_EQUAL(packBits(d), 5u);
-// d.m = true;
-// BOOST_CHECK_EQUAL(packBits(d), 0x15u);
-// }
-
-
-// QPID_AUTO_TEST_CASE(testPacked) {
-// string data;
-
-// Codec::encode(back_inserter(data))('a')(boost::optional<char>('b'))(boost::optional<char>())('c');
-// BOOST_CHECK_EQUAL(data, "abc");
-// data.clear();
+ 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");
+}
+
+QPID_AUTO_TEST_CASE(testStruct32Unknown) {
+ // Verify we can recode an unknown struct unchanged.
+ Struct32 s;
+ string data;
+ Codec::encode(back_inserter(data))(uint32_t(10));
+ data.append(10, 'X');
+ Codec::decode(data.begin())(s);
+ string data2;
+ Codec::encode(back_inserter(data2))(s);
+ BOOST_CHECK_EQUAL(data.size(), data2.size());
+ BOOST_CHECK_EQUAL(data, data2);
+}
+
+struct DummyPacked {
+ static const uint8_t PACK=1;
+ boost::optional<char> i, j;
+ char k;
+ Bit l,m;
+ DummyPacked(char a=0, char b=0, char c=0) : i(a), j(b), k(c), l(), m() {}
+ template <class S> void serialize(S& s) { s(i)(j)(k)(l)(m); }
+};
+
+Packer<DummyPacked> serializable(DummyPacked& d) { return Packer<DummyPacked>(d); }
+
+QPID_AUTO_TEST_CASE(testPackBits) {
+ DummyPacked d('a','b','c');
+ BOOST_CHECK_EQUAL(packBits(d), 7u);
+ d.j = boost::none;
+ BOOST_CHECK_EQUAL(packBits(d), 5u);
+ d.m = true;
+ BOOST_CHECK_EQUAL(packBits(d), 0x15u);
+}
+
+
+QPID_AUTO_TEST_CASE(testPacked) {
+ string data;
+
+ Codec::encode(back_inserter(data))('a')(boost::optional<char>('b'))(boost::optional<char>())('c');
+ BOOST_CHECK_EQUAL(data, "abc");
+ data.clear();
-// DummyPacked dummy('a','b','c');
-
-// Codec::encode(back_inserter(data))(dummy);
-// BOOST_CHECK_EQUAL(data.size(), 4u);
-// BOOST_CHECK_EQUAL(data, string("\007abc"));
-// data.clear();
-
-// dummy.i = boost::none;
-// Codec::encode(back_inserter(data))(dummy);
-// BOOST_CHECK_EQUAL(data, string("\6bc"));
-// data.clear();
-
-// const char* missing = "\5xy";
-// Codec::decode(missing)(dummy);
-// BOOST_CHECK(dummy.i);
-// BOOST_CHECK_EQUAL(*dummy.i, 'x');
-// BOOST_CHECK(!dummy.j);
-// BOOST_CHECK_EQUAL(dummy.k, 'y');
-// }
-
-// QPID_AUTO_TEST_CASE(testUnitControl) {
-// string data;
-// Control::Holder h(in_place<connection::Tune>(1,2,3,4));
-// Codec::encode(std::back_inserter(data))(h);
-
-// Unit unit(FrameHeader(FIRST_FRAME|LAST_FRAME, CONTROL));
-// Codec::decode(data.begin())(unit);
-
-// BOOST_REQUIRE(unit.get<ControlHolder>());
-
-// string data2;
-// Codec::encode(back_inserter(data2))(unit);
+ DummyPacked dummy('a','b','c');
+
+ Codec::encode(back_inserter(data))(dummy);
+ BOOST_CHECK_EQUAL(data.size(), 4u);
+ BOOST_CHECK_EQUAL(data, string("\007abc"));
+ data.clear();
+
+ dummy.i = boost::none;
+ Codec::encode(back_inserter(data))(dummy);
+ BOOST_CHECK_EQUAL(data, string("\6bc"));
+ data.clear();
+
+ const char* missing = "\5xy";
+ Codec::decode(missing)(dummy);
+ BOOST_CHECK(dummy.i);
+ BOOST_CHECK_EQUAL(*dummy.i, 'x');
+ BOOST_CHECK(!dummy.j);
+ BOOST_CHECK_EQUAL(dummy.k, 'y');
+}
+
+QPID_AUTO_TEST_CASE(testUnitControl) {
+ string data;
+ Control::Holder h(in_place<connection::Tune>(1,2,3,4));
+ Codec::encode(std::back_inserter(data))(h);
+
+ Unit unit(FrameHeader(FIRST_FRAME|LAST_FRAME, CONTROL));
+ Codec::decode(data.begin())(unit);
+
+ BOOST_REQUIRE(unit.get<ControlHolder>());
+
+ string data2;
+ Codec::encode(back_inserter(data2))(unit);
-// BOOST_CHECK_EQUAL(data, data2);
-// }
-
-// QPID_AUTO_TEST_CASE(testArray) {
-// ArrayDomain<char> a;
-// a.resize(3, 'x');
-// string data;
-// Codec::encode(back_inserter(data))(a);
-
-// ArrayDomain<char> b;
-// Codec::decode(data.begin())(b);
-// BOOST_CHECK_EQUAL(b.size(), 3u);
-// string data3;
-// Codec::encode(back_inserter(data3))(a);
-// BOOST_CHECK_EQUAL(data, data3);
+ BOOST_CHECK_EQUAL(data, data2);
+}
+
+QPID_AUTO_TEST_CASE(testArray) {
+ ArrayDomain<char> a;
+ a.resize(3, 'x');
+ string data;
+ Codec::encode(back_inserter(data))(a);
+
+ ArrayDomain<char> b;
+ Codec::decode(data.begin())(b);
+ BOOST_CHECK_EQUAL(b.size(), 3u);
+ string data3;
+ Codec::encode(back_inserter(data3))(a);
+ BOOST_CHECK_EQUAL(data, data3);
-// Array x;
-// Codec::decode(data.begin())(x);
-// BOOST_CHECK_EQUAL(x.size(), 3u);
-// BOOST_CHECK_EQUAL(x[0].size(), 1u);
-// BOOST_CHECK_EQUAL(*x[0].begin(), 'x');
-// BOOST_CHECK_EQUAL(*x[2].begin(), 'x');
-
-// string data2;
-// Codec::encode(back_inserter(data2))(x);
-// BOOST_CHECK_EQUAL(data,data2);
-// }
-
-// QPID_AUTO_TEST_CASE(testStruct) {
-// string data;
-
-// message::DeliveryProperties dp;
-// BOOST_CHECK(!dp.discardUnroutable);
-// dp.immediate = true;
-// dp.redelivered = false;
-// dp.priority = message::MEDIUM;
-// dp.exchange = "foo";
-
-// Codec::encode(back_inserter(data))(dp);
-// uint16_t encodedBits=uint8_t(data[1]); // Little-endian
-// encodedBits <<= 8;
-// encodedBits += uint8_t(data[0]);
-// BOOST_CHECK_EQUAL(encodedBits, packBits(dp));
+ Array x;
+ Codec::decode(data.begin())(x);
+ BOOST_CHECK_EQUAL(x.size(), 3u);
+ BOOST_CHECK_EQUAL(x[0].size(), 1u);
+ BOOST_CHECK_EQUAL(*x[0].begin(), 'x');
+ BOOST_CHECK_EQUAL(*x[2].begin(), 'x');
+
+ string data2;
+ Codec::encode(back_inserter(data2))(x);
+ BOOST_CHECK_EQUAL(data,data2);
+}
+
+QPID_AUTO_TEST_CASE(testStruct) {
+ string data;
+
+ message::DeliveryProperties dp;
+ BOOST_CHECK(!dp.discardUnroutable);
+ dp.immediate = true;
+ dp.redelivered = false;
+ dp.priority = message::MEDIUM;
+ dp.exchange = "foo";
+
+ Codec::encode(back_inserter(data))(dp);
+ uint16_t encodedBits=uint8_t(data[1]); // Little-endian
+ encodedBits <<= 8;
+ encodedBits += uint8_t(data[0]);
+ BOOST_CHECK_EQUAL(encodedBits, packBits(dp));
-// data.clear();
-// Struct32 h(dp);
-// Codec::encode(back_inserter(data))(h);
-
-// 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));
-// message::DeliveryProperties* dp2 =
-// dynamic_cast<message::DeliveryProperties*>(h2.get());
-// BOOST_CHECK(dp2);
-// BOOST_CHECK(!dp2->discardUnroutable);
-// BOOST_CHECK(dp2->immediate);
-// BOOST_CHECK(!dp2->redelivered);
-// BOOST_CHECK_EQUAL(dp2->priority, message::MEDIUM);
-// BOOST_CHECK_EQUAL(dp2->exchange, "foo");
-// }
+ data.clear();
+ Struct32 h(dp);
+ Codec::encode(back_inserter(data))(h);
+
+ 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));
+ message::DeliveryProperties* dp2 =
+ dynamic_cast<message::DeliveryProperties*>(h2.get());
+ BOOST_CHECK(dp2);
+ BOOST_CHECK(!dp2->discardUnroutable);
+ BOOST_CHECK(dp2->immediate);
+ BOOST_CHECK(!dp2->redelivered);
+ BOOST_CHECK_EQUAL(dp2->priority, message::MEDIUM);
+ BOOST_CHECK_EQUAL(dp2->exchange, "foo");
+}
struct RecodeUnit {
template <class T>