Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70443 - in branches/release: boost/unordered libs/unordered libs/unordered/test/objects libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2011-03-22 20:07:19


Author: danieljames
Date: 2011-03-22 20:07:17 EDT (Tue, 22 Mar 2011)
New Revision: 70443
URL: http://svn.boost.org/trac/boost/changeset/70443

Log:
Unordered: Fix some overly strict tests.

Properties modified:
   branches/release/boost/unordered/ (props changed)
   branches/release/libs/unordered/ (props changed)
Text files modified:
   branches/release/libs/unordered/test/objects/test.hpp | 65 ++++++++++++++++-----------------------
   branches/release/libs/unordered/test/unordered/insert_tests.cpp | 4 +-
   branches/release/libs/unordered/test/unordered/unnecessary_copy_tests.cpp | 2
   3 files changed, 30 insertions(+), 41 deletions(-)

Modified: branches/release/libs/unordered/test/objects/test.hpp
==============================================================================
--- branches/release/libs/unordered/test/objects/test.hpp (original)
+++ branches/release/libs/unordered/test/objects/test.hpp 2011-03-22 20:07:17 EDT (Tue, 22 Mar 2011)
@@ -20,11 +20,13 @@
     // Note that the default hash function will work for any equal_to (but not
     // very well).
     class object;
+ class implicitly_convertible;
     class hash;
     class less;
     class equal_to;
     template <class T> class allocator;
     object generate(object const*);
+ implicitly_convertible generate(implicitly_convertible const*);
 
     class object : globally_counted_object
     {
@@ -64,6 +66,31 @@
         }
     };
 
+ class implicitly_convertible : globally_counted_object
+ {
+ int tag1_, tag2_;
+ public:
+
+ explicit implicitly_convertible(int t1 = 0, int t2 = 0)
+ : tag1_(t1), tag2_(t2)
+ {}
+
+ operator object() const
+ {
+ return object(tag1_, tag2_);
+ }
+
+ friend implicitly_convertible generate(implicitly_convertible const*) {
+ int* x = 0;
+ return implicitly_convertible(generate(x), generate(x));
+ }
+
+ friend std::ostream& operator<<(std::ostream& out, implicitly_convertible const& o)
+ {
+ return out<<"("<<o.tag1_<<","<<o.tag2_<<")";
+ }
+ };
+
     class hash
     {
         int type_;
@@ -279,44 +306,6 @@
     {
         return x == y;
     }
-
-#if BOOST_WORKAROUND(__GNUC__, < 3)
- void swap(test::object& x, test::object& y) {
- test::object tmp;
- tmp = x;
- x = y;
- y = tmp;
- }
-
- void swap(test::hash& x, test::hash& y) {
- test::hash tmp;
- tmp = x;
- x = y;
- y = tmp;
- }
-
- void swap(test::less& x, test::less& y) {
- test::less tmp;
- tmp = x;
- x = y;
- y = tmp;
- }
-
- void swap(test::equal_to& x, test::equal_to& y) {
- test::equal_to tmp;
- tmp = x;
- x = y;
- y = tmp;
- }
-
- template <class T>
- void swap(test::allocator<T>& x, test::allocator<T>& y) {
- test::allocator<T> tmp;
- tmp = x;
- x = y;
- y = tmp;
- }
-#endif
 }
 
 #endif

Modified: branches/release/libs/unordered/test/unordered/insert_tests.cpp
==============================================================================
--- branches/release/libs/unordered/test/unordered/insert_tests.cpp (original)
+++ branches/release/libs/unordered/test/unordered/insert_tests.cpp 2011-03-22 20:07:17 EDT (Tue, 22 Mar 2011)
@@ -372,10 +372,10 @@
     std::cerr<<"map_insert_range_test2\n";
 
     typedef test::list<
- std::pair<BOOST_DEDUCED_TYPENAME X::key_type const, int>
+ std::pair<BOOST_DEDUCED_TYPENAME X::key_type const, test::implicitly_convertible>
> list;
     test::random_values<
- boost::unordered_map<BOOST_DEDUCED_TYPENAME X::key_type, int>
+ boost::unordered_map<BOOST_DEDUCED_TYPENAME X::key_type, test::implicitly_convertible>
> v(1000, generator);
     list l(v.begin(), v.end());
 

Modified: branches/release/libs/unordered/test/unordered/unnecessary_copy_tests.cpp
==============================================================================
--- branches/release/libs/unordered/test/unordered/unnecessary_copy_tests.cpp (original)
+++ branches/release/libs/unordered/test/unordered/unnecessary_copy_tests.cpp 2011-03-22 20:07:17 EDT (Tue, 22 Mar 2011)
@@ -261,7 +261,7 @@
         // copied.
         reset();
         x.emplace(source<std::pair<count_copies, count_copies> >());
- COPY_COUNT(2); MOVE_COUNT(0);
+ COPY_COUNT(2); MOVE_COUNT_RANGE(0,2);
 
         // TODO: This doesn't work on older versions of gcc.
         //count_copies part;


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