diff options
author | Alan Conway <aconway@apache.org> | 2008-04-02 17:56:14 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2008-04-02 17:56:14 +0000 |
commit | 213961a20d63578f36d5c42acae175b539e2965f (patch) | |
tree | 1d71d1ac8f854f94972cf72affd17a250d81c958 /cpp/src/tests/serialize.cpp | |
parent | e2611af099984e1e2eea65cded8140a21136ddbf (diff) | |
download | qpid-python-213961a20d63578f36d5c42acae175b539e2965f.tar.gz |
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
Diffstat (limited to 'cpp/src/tests/serialize.cpp')
-rw-r--r-- | cpp/src/tests/serialize.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
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 <boost/test/test_case_template.hpp> #include <boost/type_traits/is_arithmetic.hpp> @@ -76,16 +77,13 @@ template <class A, class B> struct concat2 { typedef typename mpl::copy<B, typen template <class A, class B, class C> struct concat3 { typedef typename concat2<A, typename concat2<B, C>::type>::type type; }; template <class A, class B, class C, class D> struct concat4 { typedef typename concat2<A, typename concat3<B, C, D>::type>::type type; }; -typedef mpl::vector<Bit, Boolean, Char, Int32, Int64, Int8, Uint16, CharUtf32, Uint32, Uint64, Bin8, Uint8>::type IntegralTypes; +typedef mpl::vector<Boolean, Char, Int32, Int64, Int8, Uint16, CharUtf32, Uint32, Uint64, Bin8, Uint8>::type IntegralTypes; typedef mpl::vector<Bin1024, Bin128, Bin16, Bin256, Bin32, Bin40, Bin512, Bin64, Bin72>::type BinTypes; -// FIXME aconway 2008-03-07: float encoding typedef mpl::vector<Double, Float>::type FloatTypes; typedef mpl::vector<SequenceNo, Uuid, Datetime, Dec32, Dec64> FixedSizeClassTypes; -typedef mpl::vector<Vbin8, Str8Latin, Str8, Str8Utf16, Vbin16, Str16Latin, Str16, Str16Utf16, Vbin32> VariableSizeTypes; +typedef mpl::vector<Map, Vbin8, Str8Latin, Str8, Str8Utf16, Vbin16, Str16Latin, Str16, Str16Utf16, Vbin32> VariableSizeTypes; - -// FIXME aconway 2008-03-07: float encoding -typedef concat3<IntegralTypes, BinTypes, /*FloatTypes, */ FixedSizeClassTypes>::type FixedSizeTypes; +typedef concat4<IntegralTypes, BinTypes, FloatTypes, FixedSizeClassTypes>::type FixedSizeTypes; typedef concat2<FixedSizeTypes, VariableSizeTypes>::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 <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> void testValue(SerializableString<T, S>& s) { +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; BOOST_AUTO_TEST_CASE_TEMPLATE(testEncodeDecode, T, AllTypes) |