diff options
Diffstat (limited to 'cpp/src/tests')
-rw-r--r-- | cpp/src/tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | cpp/src/tests/Uuid.cpp | 29 | ||||
-rw-r--r-- | cpp/src/tests/Variant.cpp | 7 |
3 files changed, 45 insertions, 1 deletions
diff --git a/cpp/src/tests/CMakeLists.txt b/cpp/src/tests/CMakeLists.txt index 469d777dce..957c10eeb4 100644 --- a/cpp/src/tests/CMakeLists.txt +++ b/cpp/src/tests/CMakeLists.txt @@ -264,6 +264,16 @@ target_link_libraries (sender qpidclient) #sender_SOURCES=sender.cpp TestOptions.h ConnectionOptions.h remember_location(sender) +add_executable (qpid_recv qpid_recv.cpp ${platform_test_additions}) +target_link_libraries (qpid_recv qpidclient) +#qpid_recv_SOURCES=qpid_recv.cpp TestOptions.h ConnectionOptions.h +remember_location(qpid_recv) + +add_executable (qpid_send qpid_send.cpp ${platform_test_additions}) +target_link_libraries (qpid_send qpidclient) +#qpid_send_SOURCES=qpid_send.cpp TestOptions.h ConnectionOptions.h +remember_location(qpid_send) + if (CMAKE_SYSTEM_NAME STREQUAL Windows) set (ENV{OUTDIR} ${EXECUTABLE_OUTPUT_PATH}) set (test_script_suffix ".ps1") diff --git a/cpp/src/tests/Uuid.cpp b/cpp/src/tests/Uuid.cpp index a6ddb9b5a5..6d6c07169f 100644 --- a/cpp/src/tests/Uuid.cpp +++ b/cpp/src/tests/Uuid.cpp @@ -18,6 +18,7 @@ #include "qpid/framing/Uuid.h" #include "qpid/framing/Buffer.h" +#include "qpid/messaging/Uuid.h" #include "qpid/sys/alloca.h" #include "unit_test.h" @@ -79,6 +80,34 @@ QPID_AUTO_TEST_CASE(testUuidEncodeDecode) { string(decoded.begin(), decoded.end())); } +QPID_AUTO_TEST_CASE(testMessagingUuid) +{ + //tests for the Uuid class in the messaging namespace (introduced + //to avoid pulling in dependencies from framing) + messaging::Uuid a; + messaging::Uuid b(true); + messaging::Uuid c(true); + messaging::Uuid d(b); + messaging::Uuid e; + e = c; + + BOOST_CHECK(!a); + BOOST_CHECK(b); + + BOOST_CHECK(a != b); + BOOST_CHECK(b != c); + + BOOST_CHECK_EQUAL(b, d); + BOOST_CHECK_EQUAL(c, e); + + ostringstream out; + out << b; + istringstream in(out.str()); + in >> a; + BOOST_CHECK(!in.fail()); + BOOST_CHECK_EQUAL(a, b); +} + QPID_AUTO_TEST_SUITE_END() }} // namespace qpid::tests diff --git a/cpp/src/tests/Variant.cpp b/cpp/src/tests/Variant.cpp index 21005779f0..c0bb9772c8 100644 --- a/cpp/src/tests/Variant.cpp +++ b/cpp/src/tests/Variant.cpp @@ -136,12 +136,14 @@ QPID_AUTO_TEST_CASE(testMap) const std::string red("red"); const float pi(3.14f); const int16_t x(1000); + const Uuid u(true); Variant value = Variant::Map(); value.asMap()["colour"] = red; value.asMap()["pi"] = pi; value.asMap()["my-key"] = x; - BOOST_CHECK_EQUAL(3u, value.asMap().size()); + value.asMap()["id"] = u; + BOOST_CHECK_EQUAL(4u, value.asMap().size()); BOOST_CHECK_EQUAL(VAR_STRING, value.asMap()["colour"].getType()); BOOST_CHECK_EQUAL(red, value.asMap()["colour"].asString()); @@ -152,6 +154,9 @@ QPID_AUTO_TEST_CASE(testMap) BOOST_CHECK_EQUAL(VAR_INT16, value.asMap()["my-key"].getType()); BOOST_CHECK_EQUAL(x, value.asMap()["my-key"].asInt16()); + BOOST_CHECK_EQUAL(VAR_UUID, value.asMap()["id"].getType()); + BOOST_CHECK_EQUAL(u, value.asMap()["id"].asUuid()); + value.asMap()["my-key"] = "now it's a string"; BOOST_CHECK_EQUAL(VAR_STRING, value.asMap()["my-key"].getType()); BOOST_CHECK_EQUAL(std::string("now it's a string"), value.asMap()["my-key"].asString()); |