From dc4ef6282e60541161216d92c9693a87c64ae671 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Fri, 17 Jan 2014 05:55:31 +0000 Subject: QPID-5489: Uuid code improvements - Don't use uuid_compare() as it will get the wrong version of the function under FreeBSD which has a uuid library build into libc with different function signatures from libuuid but some overlapping names. - Reorganise the uuid code to limit the used external symbols to uuid_generate(), uuid_parse(), uuid_unparse() - Minimise the framing::Uuid code so that it is a simple wrapper around types::Uuid - Use uuid_generate() as the symbol to search in CMake (uuid_compare() isn't used in qpid anymore). git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1559017 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/tests/Uuid.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'qpid/cpp/src/tests/Uuid.cpp') diff --git a/qpid/cpp/src/tests/Uuid.cpp b/qpid/cpp/src/tests/Uuid.cpp index aa9580e25e..5fb848a500 100644 --- a/qpid/cpp/src/tests/Uuid.cpp +++ b/qpid/cpp/src/tests/Uuid.cpp @@ -24,6 +24,8 @@ #include +#include + namespace qpid { namespace tests { @@ -51,17 +53,12 @@ boost::array sample = {{0x1b, 0x4e, 0x28, 0xba, 0x2f, 0xa1, 0x11, const string sampleStr("1b4e28ba-2fa1-11d2-883f-b9a761bde3fb"); const string zeroStr("00000000-0000-0000-0000-000000000000"); -QPID_AUTO_TEST_CASE(testUuidStr) { - Uuid uuid(sampleStr); - BOOST_CHECK(uuid == sample); -} - QPID_AUTO_TEST_CASE(testUuidIstream) { Uuid uuid; istringstream in(sampleStr); in >> uuid; BOOST_CHECK(!in.fail()); - BOOST_CHECK(uuid == sample); + BOOST_CHECK(::memcmp(uuid.data(), sample.data(), uuid.size())==0); istringstream is(zeroStr); Uuid zero; @@ -105,7 +102,7 @@ QPID_AUTO_TEST_CASE(testUuidEncodeDecode) { Uuid decoded; decoded.decode(rbuf); BOOST_CHECK_EQUAL(string(sample.begin(), sample.end()), - string(decoded.begin(), decoded.end())); + string(decoded.data(), decoded.data()+decoded.size())); } QPID_AUTO_TEST_CASE(testTypesUuid) -- cgit v1.2.1