summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/Uuid.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2014-04-29 13:29:45 +0000
committerAndrew Stitcher <astitcher@apache.org>2014-04-29 13:29:45 +0000
commit59f76262e85c190395f9b68ffbb1f37f6119e5c6 (patch)
treece1bfbdc415cfe90a958aa35c64ee8cdb40bd3ec /qpid/cpp/src/tests/Uuid.cpp
parenta12f1607be9e1b00254480df31c09d646d6da2df (diff)
downloadqpid-python-59f76262e85c190395f9b68ffbb1f37f6119e5c6.tar.gz
QPID-5489: More cleaning up of the Uuid code
- Rewrite the Uuid iosteam extractor and insertor operators to not require any underlying uuid library. - Create a specific uuid implementation for FreeBSD git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1590978 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/Uuid.cpp')
-rw-r--r--qpid/cpp/src/tests/Uuid.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/qpid/cpp/src/tests/Uuid.cpp b/qpid/cpp/src/tests/Uuid.cpp
index 5fb848a500..f9a67d9db0 100644
--- a/qpid/cpp/src/tests/Uuid.cpp
+++ b/qpid/cpp/src/tests/Uuid.cpp
@@ -49,9 +49,11 @@ QPID_AUTO_TEST_CASE(testUuidCtor) {
for_each(uuids.begin(), uuids.end(), unique);
}
-boost::array<uint8_t, 16> sample = {{0x1b, 0x4e, 0x28, 0xba, 0x2f, 0xa1, 0x11, 0xd2, 0x88, 0x3f, 0xb9, 0xa7, 0x61, 0xbd, 0xe3, 0xfb}};
-const string sampleStr("1b4e28ba-2fa1-11d2-883f-b9a761bde3fb");
+boost::array<uint8_t, 16> sample = {{0x1b, 0x4e, 0x28, 0xba, 0x2f, 0xa1, 0x11, 0x02, 0x88, 0x3f, 0xb9, 0xa7, 0x61, 0xbd, 0xe3, 0xfb}};
+const string sampleStr("1b4e28ba-2fa1-1102-883f-b9a761bde3fb");
const string zeroStr("00000000-0000-0000-0000-000000000000");
+const string badUuid1("1b4e28ba-2fa1-11d2-883f-b9761bde3fb");
+const string badUuid2("1b4e28ba-2fa1-11d23883f-b9761dbde3fb");
QPID_AUTO_TEST_CASE(testUuidIstream) {
Uuid uuid;
@@ -63,7 +65,7 @@ QPID_AUTO_TEST_CASE(testUuidIstream) {
istringstream is(zeroStr);
Uuid zero;
is >> zero;
- BOOST_CHECK(!in.fail());
+ BOOST_CHECK(!is.fail());
BOOST_CHECK_EQUAL(zero, Uuid());
}
@@ -80,6 +82,16 @@ QPID_AUTO_TEST_CASE(testUuidOstream) {
BOOST_CHECK_EQUAL(os.str(), zeroStr);
}
+QPID_AUTO_TEST_CASE(testBadUuidIstream) {
+ Uuid a;
+ istringstream is(badUuid1);
+ is >> a;
+ BOOST_CHECK(!is.good());
+ istringstream is2(badUuid2);
+ is2 >> a;
+ BOOST_CHECK(!is2.good());
+}
+
QPID_AUTO_TEST_CASE(testUuidIOstream) {
Uuid a(true), b(true);
ostringstream os;