Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2008-03-24 13:34:48


Author: danieljames
Date: 2008-03-24 13:34:47 EDT (Mon, 24 Mar 2008)
New Revision: 43841
URL: http://svn.boost.org/trac/boost/changeset/43841

Log:
Add equality compile test for unordered_set/multiset.
Text files modified:
   branches/unordered/dev/libs/unordered/test/objects/minimal.hpp | 23 +++++++++++++++++++++++
   branches/unordered/dev/libs/unordered/test/unordered/compile_set.cpp | 24 ++++++++++++++++++++++++
   2 files changed, 47 insertions(+), 0 deletions(-)

Modified: branches/unordered/dev/libs/unordered/test/objects/minimal.hpp
==============================================================================
--- branches/unordered/dev/libs/unordered/test/objects/minimal.hpp (original)
+++ branches/unordered/dev/libs/unordered/test/objects/minimal.hpp 2008-03-24 13:34:47 EDT (Mon, 24 Mar 2008)
@@ -87,6 +87,29 @@
         assignable() {}
     };
 
+ class assignable_equality_comparable
+ {
+ public:
+ static assignable_equality_comparable create() { return assignable_equality_comparable(); }
+ assignable_equality_comparable(assignable_equality_comparable const&) {}
+ assignable_equality_comparable& operator=(assignable_equality_comparable const&) { return *this; }
+ ~assignable_equality_comparable() {}
+ private:
+ assignable_equality_comparable() {}
+ };
+
+ bool operator==(assignable_equality_comparable, assignable_equality_comparable) {
+ return true;
+ }
+
+ bool operator!=(assignable_equality_comparable, assignable_equality_comparable) {
+ return false;
+ }
+
+ std::size_t hash_value(assignable_equality_comparable) {
+ return 1;
+ }
+
     template <class T>
     class hash
     {

Modified: branches/unordered/dev/libs/unordered/test/unordered/compile_set.cpp
==============================================================================
--- branches/unordered/dev/libs/unordered/test/unordered/compile_set.cpp (original)
+++ branches/unordered/dev/libs/unordered/test/unordered/compile_set.cpp 2008-03-24 13:34:47 EDT (Mon, 24 Mar 2008)
@@ -38,6 +38,30 @@
     equality_test(multiset, assignable);
 }
 
+UNORDERED_AUTO_TEST(equality_tests) {
+ typedef std::pair<test::minimal::assignable const,
+ test::minimal::copy_constructible_equality_comparable> value_type;
+ value_type value(
+ test::minimal::assignable::create(),
+ test::minimal::copy_constructible_equality_comparable::create());
+
+ boost::unordered_set<
+ test::minimal::assignable_equality_comparable,
+ test::minimal::hash<test::minimal::assignable_equality_comparable>,
+ test::minimal::equal_to<test::minimal::assignable_equality_comparable>,
+ test::minimal::allocator<value_type> > set;
+
+ equality_test(set, value);
+
+ boost::unordered_multiset<
+ test::minimal::assignable_equality_comparable,
+ test::minimal::hash<test::minimal::assignable_equality_comparable>,
+ test::minimal::equal_to<test::minimal::assignable_equality_comparable>,
+ test::minimal::allocator<value_type> > multiset;
+
+ equality_test(multiset, value);
+}
+
 UNORDERED_AUTO_TEST(test1)
 {
     boost::hash<int> hash;


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