From 213961a20d63578f36d5c42acae175b539e2965f Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 2 Apr 2008 17:56:14 +0000 Subject: Encoding/decoding for new types: amqp_0_10::Map, amqp_0_10:UnknownType git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@643995 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/serialize.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'cpp/src/tests/serialize.cpp') diff --git a/cpp/src/tests/serialize.cpp b/cpp/src/tests/serialize.cpp index 228a4b6e3a..da71917cbd 100644 --- a/cpp/src/tests/serialize.cpp +++ b/cpp/src/tests/serialize.cpp @@ -25,6 +25,7 @@ #include "qpid/amqp_0_10/specification.h" #include "qpid/amqp_0_10/ControlHolder.h" #include "qpid/amqp_0_10/Frame.h" +#include "qpid/amqp_0_10/Map.h" #include #include @@ -76,16 +77,13 @@ template struct concat2 { typedef typename mpl::copy struct concat3 { typedef typename concat2::type>::type type; }; template struct concat4 { typedef typename concat2::type>::type type; }; -typedef mpl::vector::type IntegralTypes; +typedef mpl::vector::type IntegralTypes; typedef mpl::vector::type BinTypes; -// FIXME aconway 2008-03-07: float encoding typedef mpl::vector::type FloatTypes; typedef mpl::vector FixedSizeClassTypes; -typedef mpl::vector VariableSizeTypes; +typedef mpl::vector VariableSizeTypes; - -// FIXME aconway 2008-03-07: float encoding -typedef concat3::type FixedSizeTypes; +typedef concat4::type FixedSizeTypes; typedef concat2::type AllTypes; // TODO aconway 2008-02-20: should test 64 bit integrals for order also. @@ -107,19 +105,22 @@ BOOST_AUTO_TEST_CASE(testNetworkByteOrder) { // Assign test values to the various types. void testValue(bool& b) { b = true; } +void testValue(Bit&) { } template typename boost::enable_if >::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 void testValue(Decimal& d) { d.exponent=2; d.mantissa=0x1122; } void testValue(SequenceNo& s) { s = 42; } template void testValue(Bin& a) { a.assign(42); } -template void testValue(SerializableString& s) { +template void testValue(SerializableString& 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::type TestTypes; BOOST_AUTO_TEST_CASE_TEMPLATE(testEncodeDecode, T, AllTypes) -- cgit v1.2.1