|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76088 - trunk/libs/uuid/test
From: atompkins_at_[hidden]
Date: 2011-12-20 20:30:34
Author: atompkins
Date: 2011-12-20 20:30:34 EST (Tue, 20 Dec 2011)
New Revision: 76088
URL: http://svn.boost.org/trac/boost/changeset/76088
Log:
Added test for using uuid as the key in a std::map.
Added:
trunk/libs/uuid/test/test_uuid_in_map.cpp (contents, props changed)
Text files modified:
trunk/libs/uuid/test/Jamfile.v2 | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
Modified: trunk/libs/uuid/test/Jamfile.v2
==============================================================================
--- trunk/libs/uuid/test/Jamfile.v2 (original)
+++ trunk/libs/uuid/test/Jamfile.v2 2011-12-20 20:30:34 EST (Tue, 20 Dec 2011)
@@ -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: trunk/libs/uuid/test/test_uuid_in_map.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/test_uuid_in_map.cpp 2011-12-20 20:30:34 EST (Tue, 20 Dec 2011)
@@ -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