summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/Uuid.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-04-01 17:51:04 +0000
committerAlan Conway <aconway@apache.org>2010-04-01 17:51:04 +0000
commit01fac737f94afef33eee5eaa35df7833920c6ef2 (patch)
treedba3fcad81f4d1c2b4e8ea5ea53f119c26e03617 /qpid/cpp/src/tests/Uuid.cpp
parentb16d99f1de42e7e02cb0c09d83201a9c87275c83 (diff)
downloadqpid-python-01fac737f94afef33eee5eaa35df7833920c6ef2.tar.gz
Update cluster store status with a single atomic write() operation.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@930055 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/Uuid.cpp')
-rw-r--r--qpid/cpp/src/tests/Uuid.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/Uuid.cpp b/qpid/cpp/src/tests/Uuid.cpp
index 4c6505b139..0195455ca3 100644
--- a/qpid/cpp/src/tests/Uuid.cpp
+++ b/qpid/cpp/src/tests/Uuid.cpp
@@ -50,6 +50,7 @@ QPID_AUTO_TEST_CASE(testUuidCtor) {
boost::array<uint8_t, 16> sample = {{'\x1b', '\x4e', '\x28', '\xba', '\x2f', '\xa1', '\x11', '\xd2', '\x88', '\x3f', '\xb9', '\xa7', '\x61', '\xbd', '\xe3', '\xfb'}};
const string sampleStr("1b4e28ba-2fa1-11d2-883f-b9a761bde3fb");
+const string zeroStr("00000000-0000-0000-0000-000000000000");
QPID_AUTO_TEST_CASE(testUuidIstream) {
Uuid uuid;
@@ -57,6 +58,12 @@ QPID_AUTO_TEST_CASE(testUuidIstream) {
in >> uuid;
BOOST_CHECK(!in.fail());
BOOST_CHECK(uuid == sample);
+
+ istringstream is(zeroStr);
+ Uuid zero;
+ is >> zero;
+ BOOST_CHECK(!in.fail());
+ BOOST_CHECK_EQUAL(zero, Uuid());
}
QPID_AUTO_TEST_CASE(testUuidOstream) {
@@ -65,6 +72,23 @@ QPID_AUTO_TEST_CASE(testUuidOstream) {
out << uuid;
BOOST_CHECK(out.good());
BOOST_CHECK_EQUAL(out.str(), sampleStr);
+
+ ostringstream os;
+ os << Uuid();
+ BOOST_CHECK(out.good());
+ BOOST_CHECK_EQUAL(os.str(), zeroStr);
+}
+
+QPID_AUTO_TEST_CASE(testUuidIOstream) {
+ Uuid a(true), b(true);
+ ostringstream os;
+ os << a << endl << b;
+ Uuid aa, bb;
+ istringstream is(os.str());
+ is >> aa >> ws >> bb;
+ BOOST_CHECK(os.good());
+ BOOST_CHECK_EQUAL(a, aa);
+ BOOST_CHECK_EQUAL(b, bb);
}
QPID_AUTO_TEST_CASE(testUuidEncodeDecode) {