|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76326 - branches/release/libs/uuid/test
From: atompkins_at_[hidden]
Date: 2012-01-05 21:02:18
Author: atompkins
Date: 2012-01-05 21:02:17 EST (Thu, 05 Jan 2012)
New Revision: 76326
URL: http://svn.boost.org/trac/boost/changeset/76326
Log:
Added new use test case (using a uuid as the key in a std::map).
Added:
branches/release/libs/uuid/test/test_uuid_in_map.cpp (contents, props changed)
Text files modified:
branches/release/libs/uuid/test/Jamfile.v2 | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
Modified: branches/release/libs/uuid/test/Jamfile.v2
==============================================================================
--- branches/release/libs/uuid/test/Jamfile.v2 (original)
+++ branches/release/libs/uuid/test/Jamfile.v2 2012-01-05 21:02:17 EST (Thu, 05 Jan 2012)
@@ -38,8 +38,9 @@
# test tagging an object
[ run test_tagging.cpp ]
- # test uuid class
+ # test use cases
[ run test_uuid_class.cpp ]
+ [ run test_uuid_in_map.cpp ]
# test serializing uuids
[ run test_serialization.cpp ../../serialization/build//boost_serialization ]
Added: branches/release/libs/uuid/test/test_uuid_in_map.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/uuid/test/test_uuid_in_map.cpp 2012-01-05 21:02:17 EST (Thu, 05 Jan 2012)
@@ -0,0 +1,36 @@
+// (C) Copyright Andy Tompkins 2011. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// libs/uuid/test/test_uuid_in_map.cpp -------------------------------//
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_generators.hpp>
+#include <map>
+
+#include <boost/detail/lightweight_test.hpp>
+
+int main(int, char*[])
+{
+ boost::uuids::random_generator gen;
+
+ boost::uuids::uuid u1 = gen();
+ boost::uuids::uuid u2 = gen();
+ boost::uuids::uuid u3 = gen();
+
+ std::map<boost::uuids::uuid, int> uuid_map;
+ uuid_map[u1] = 1;
+ uuid_map[u2] = 2;
+ uuid_map[u3] = 3;
+
+ BOOST_TEST_EQ(1, uuid_map[u1]);
+ BOOST_TEST_EQ(2, uuid_map[u2]);
+ BOOST_TEST_EQ(3, uuid_map[u3]);
+
+ return boost::report_errors();
+}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk