diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2014-01-17 05:55:31 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2014-01-17 05:55:31 +0000 |
| commit | 0e3d465bfd951e2d5627ae996b104b1e0f7387a6 (patch) | |
| tree | db41f44c672d2d4a1af9566308caeb24269ac6f1 /cpp/src/tests/Uuid.cpp | |
| parent | d8cefa06a43b0a29062d9c52733b436b852ea10d (diff) | |
| download | qpid-python-0e3d465bfd951e2d5627ae996b104b1e0f7387a6.tar.gz | |
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/qpid@1559017 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/Uuid.cpp')
| -rw-r--r-- | cpp/src/tests/Uuid.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/cpp/src/tests/Uuid.cpp b/cpp/src/tests/Uuid.cpp index aa9580e25e..5fb848a500 100644 --- a/cpp/src/tests/Uuid.cpp +++ b/cpp/src/tests/Uuid.cpp @@ -24,6 +24,8 @@ #include <set> +#include <boost/array.hpp> + namespace qpid { namespace tests { @@ -51,17 +53,12 @@ boost::array<uint8_t, 16> 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) |
