diff options
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r-- | qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp | 6 | ||||
-rw-r--r-- | qpid/cpp/src/tests/MessagingSessionTests.cpp | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp b/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp index a67ec0360d..ba736c87ea 100644 --- a/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp +++ b/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp @@ -102,9 +102,9 @@ Variant toVariant(boost::shared_ptr<FieldValue> in) //based on AMQP 0-10 typecode, pick most appropriate variant type switch (in->getType()) { //Fixed Width types: - case 0x01: out.setEncoding(amqp0_10_binary); - case 0x02: out = in->getIntegerValue<int8_t>(); break; - case 0x03: out = in->getIntegerValue<uint8_t>(); break; + case 0x00: out.setEncoding(amqp0_10_binary); + case 0x01: out = in->getIntegerValue<int8_t>(); break; + case 0x02: out = in->getIntegerValue<uint8_t>(); break; case 0x04: break; //TODO: iso-8859-15 char case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t>()); break; case 0x10: out.setEncoding(amqp0_10_binary); diff --git a/qpid/cpp/src/tests/MessagingSessionTests.cpp b/qpid/cpp/src/tests/MessagingSessionTests.cpp index 5c3c5c41b1..82c729cd72 100644 --- a/qpid/cpp/src/tests/MessagingSessionTests.cpp +++ b/qpid/cpp/src/tests/MessagingSessionTests.cpp @@ -86,6 +86,11 @@ QPID_AUTO_TEST_CASE(testSendReceiveHeaders) out.setProperty("b", i + 100); sender.send(out); } + uint8_t v1(255u); + int8_t v2(-120); + out.getProperties()["c"] = v1; + out.getProperties()["d"] = v2; + sender.send(out); Receiver receiver = fix.session.createReceiver(fix.queue); Message in; for (uint i = 0; i < 10; ++i) { @@ -95,6 +100,13 @@ QPID_AUTO_TEST_CASE(testSendReceiveHeaders) BOOST_CHECK_EQUAL(in.getProperties()["b"].asUint32(), i + 100); fix.session.acknowledge(); } + BOOST_CHECK(receiver.fetch(in, Duration::SECOND * 5)); + Variant& c = in.getProperties()["c"]; + BOOST_CHECK_EQUAL(c.getType(), VAR_UINT8); + BOOST_CHECK_EQUAL(c.asUint8(), v1); + Variant& d = in.getProperties()["d"]; + BOOST_CHECK_EQUAL(d.getType(), VAR_INT8); + BOOST_CHECK_EQUAL(d.asInt8(), v2); } QPID_AUTO_TEST_CASE(testSenderError) |