$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: daniel_james_at_[hidden]
Date: 2008-01-07 16:27:38
Author: danieljames
Date: 2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
New Revision: 42590
URL: http://svn.boost.org/trac/boost/changeset/42590
Log:
Merge from boost trunk.
Added:
   branches/unordered/trunk/libs/unordered/test/exception/assign_exception_tests.cpp
      - copied unchanged from r42588, /trunk/libs/unordered/test/exception/assign_exception_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/constructor_exception_tests.cpp
      - copied unchanged from r42588, /trunk/libs/unordered/test/exception/constructor_exception_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/copy_exception_tests.cpp
      - copied unchanged from r42588, /trunk/libs/unordered/test/exception/copy_exception_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/erase_exception_tests.cpp
      - copied unchanged from r42588, /trunk/libs/unordered/test/exception/erase_exception_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/insert_exception_tests.cpp
      - copied unchanged from r42588, /trunk/libs/unordered/test/exception/insert_exception_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/rehash_exception_tests.cpp
      - copied unchanged from r42588, /trunk/libs/unordered/test/exception/rehash_exception_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/swap_exception_tests.cpp
      - copied unchanged from r42588, /trunk/libs/unordered/test/exception/swap_exception_tests.cpp
   branches/unordered/trunk/libs/unordered/test/unordered/compile_map.cpp
      - copied unchanged from r42588, /trunk/libs/unordered/test/unordered/compile_map.cpp
   branches/unordered/trunk/libs/unordered/test/unordered/compile_set.cpp
      - copied unchanged from r42588, /trunk/libs/unordered/test/unordered/compile_set.cpp
Removed:
   branches/unordered/trunk/libs/unordered/test/exception/assign_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/constructor_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/copy_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/erase_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/insert_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/rehash_tests.cpp
   branches/unordered/trunk/libs/unordered/test/exception/swap_tests.cpp
   branches/unordered/trunk/libs/unordered/test/unordered/map_compile.cpp
   branches/unordered/trunk/libs/unordered/test/unordered/set_compile.cpp
Properties modified: 
   branches/unordered/trunk/   (props changed)
Text files modified: 
   branches/unordered/trunk/boost/unordered/detail/hash_table_impl.hpp |    22 ++------------                          
   branches/unordered/trunk/libs/unordered/test/exception/Jamfile.v2   |    14 ++++----                                
   branches/unordered/trunk/libs/unordered/test/objects/test.hpp       |    57 +++++++++++++++++++++++---------------- 
   branches/unordered/trunk/libs/unordered/test/unordered/Jamfile.v2   |     4 +-                                      
   4 files changed, 46 insertions(+), 51 deletions(-)
Modified: branches/unordered/trunk/boost/unordered/detail/hash_table_impl.hpp
==============================================================================
--- branches/unordered/trunk/boost/unordered/detail/hash_table_impl.hpp	(original)
+++ branches/unordered/trunk/boost/unordered/detail/hash_table_impl.hpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
@@ -58,26 +58,8 @@
             typedef BOOST_DEDUCED_TYPENAME allocator_reference<value_allocator>::type reference;
             typedef BOOST_DEDUCED_TYPENAME allocator_reference<bucket_allocator>::type bucket_reference;
 
-#if 1
             typedef bucket_ptr link_ptr;
-#else
-            // This alternative version of link_ptr is used to check that the
-            // implementation is type safe wrt bucket_ptr and link_ptr.
-            //
-            // It's a sort of strict typedef.
 
-            struct link_ptr {
-                link_ptr() : ptr_() { BOOST_UNORDERED_MSVC_RESET_PTR(ptr_); }
-                explicit link_ptr(bucket_ptr p) : ptr_(p) {}
-                bucket_reference operator*() const { return *ptr_; }
-                bucket* operator->() const { return &*ptr_; }
-                operator bool() const { return ptr_; }
-                bool operator==(link_ptr const& x) const { return ptr_ == x.ptr_; }
-                bool operator!=(link_ptr const& x) const { return ptr_ != x.ptr_; }
-            private:
-                bucket_ptr ptr_;
-            };
-#endif
             // Hash Bucket
             //
             // all no throw
@@ -1243,6 +1225,8 @@
             // no throw
             size_type max_size() const
             {
+                using namespace std;
+
                 // size < mlf_ * count
                 return float_to_size_t(ceil(
                         max_bucket_count() * mlf_)) - 1;
@@ -1321,6 +1305,8 @@
             // factor. This is to try to avoid excessive rehashes.
             bool reserve_extra(size_type n)
             {
+                using namespace std;
+
                 bool need_to_reserve = n >= max_load_;
                 // throws - basic:
                 if (need_to_reserve) {
Modified: branches/unordered/trunk/libs/unordered/test/exception/Jamfile.v2
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/exception/Jamfile.v2	(original)
+++ branches/unordered/trunk/libs/unordered/test/exception/Jamfile.v2	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
@@ -15,12 +15,12 @@
 
 test-suite unordered-exception
     :
-        [ run constructor_tests.cpp framework ]
-        [ run copy_tests.cpp framework ]
-        [ run assign_tests.cpp framework ]
-        [ run insert_tests.cpp framework ]
-        [ run erase_tests.cpp framework ]
-        [ run rehash_tests.cpp framework ]
-        [ run swap_tests.cpp framework : : :
+        [ run constructor_exception_tests.cpp framework ]
+        [ run copy_exception_tests.cpp framework ]
+        [ run assign_exception_tests.cpp framework ]
+        [ run insert_exception_tests.cpp framework ]
+        [ run erase_exception_tests.cpp framework ]
+        [ run rehash_exception_tests.cpp framework ]
+        [ run swap_exception_tests.cpp framework : : :
             <define>BOOST_UNORDERED_SWAP_METHOD=2 ]
     ;
Deleted: branches/unordered/trunk/libs/unordered/test/exception/assign_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/exception/assign_tests.cpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
+++ (empty file)
@@ -1,81 +0,0 @@
-
-// Copyright 2006-2007 Daniel James.
-// 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)
-
-#include "./containers.hpp"
-
-#define BOOST_TEST_MAIN
-#include <boost/test/unit_test.hpp>
-#include <boost/test/exception_safety.hpp>
-#include "../helpers/random_values.hpp"
-#include "../helpers/invariants.hpp"
-
-test::seed_t seed(12847);
-
-template <class T>
-struct self_assign_base : public test::exception_base
-{
-    test::random_values<T> values;
-    self_assign_base(int count = 0) : values(count) {}
-
-    typedef T data_type;
-    T init() const { return T(values.begin(), values.end()); }
-    void run(T& x) const { x = x; }
-    void check(T const& x) const { test::check_equivalent_keys(x); }
-};
-
-template <class T>
-struct self_assign_test1 : self_assign_base<T> {};
-
-template <class T>
-struct self_assign_test2 : self_assign_base<T>
-{
-    self_assign_test2() : self_assign_base<T>(100) {}
-};
-
-template <class T>
-struct assign_base : public test::exception_base
-{
-    const test::random_values<T> x_values, y_values;
-    const T x,y;
-
-    assign_base(unsigned int count1, unsigned int count2, int tag1, int tag2)
-        : x_values(count1), y_values(count2),
-        x(x_values.begin(), x_values.end(), 0, typename T::hasher(tag1), typename T::key_equal(tag1), typename T::allocator_type(tag1)),
-        y(y_values.begin(), y_values.end(), 0, typename T::hasher(tag2), typename T::key_equal(tag2), typename T::allocator_type(tag2)) {}
-
-    typedef T data_type;
-    T init() const { return T(x); }
-    void run(T& x1) const { x1 = y; }
-    void check(T const& x1) const { test::check_equivalent_keys(x1); }
-};
-
-template <class T>
-struct assign_test1 : assign_base<T>
-{
-    assign_test1() : assign_base<T>(0, 0, 0, 0) {}
-};
-
-template <class T>
-struct assign_test2 : assign_base<T>
-{
-    assign_test2() : assign_base<T>(60, 0, 0, 0) {}    
-};
-
-template <class T>
-struct assign_test3 : assign_base<T>
-{
-    assign_test3() : assign_base<T>(0, 60, 0, 0) {}    
-};
-
-template <class T>
-struct assign_test4 : assign_base<T>
-{
-    assign_test4() : assign_base<T>(10, 10, 1, 2) {}
-};
-
-RUN_EXCEPTION_TESTS(
-    (self_assign_test1)(self_assign_test2)
-    (assign_test1)(assign_test2)(assign_test3)(assign_test4),
-    CONTAINER_SEQ)
Deleted: branches/unordered/trunk/libs/unordered/test/exception/constructor_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/exception/constructor_tests.cpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
+++ (empty file)
@@ -1,133 +0,0 @@
-
-// Copyright 2006-2007 Daniel James.
-// 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)
-
-#include "./containers.hpp"
-
-#define BOOST_TEST_MAIN
-#include <boost/test/unit_test.hpp>
-#include <boost/test/exception_safety.hpp>
-#include "../helpers/random_values.hpp"
-#include "../helpers/input_iterator.hpp"
-
-test::seed_t seed(91274);
-
-struct objects
-{
-    test::exception::object obj;
-    test::exception::hash hash;
-    test::exception::equal_to equal_to;
-    test::exception::allocator<test::exception::object> allocator;
-};
-
-template <class T>
-struct construct_test1 : public objects, test::exception_base
-{
-    void run() const {
-        T x;
-    }
-};
-
-template <class T>
-struct construct_test2 : public objects, test::exception_base
-{
-    void run() const {
-        T x(300);
-    }
-};
-
-template <class T>
-struct construct_test3 : public objects, test::exception_base
-{
-    void run() const {
-        T x(0, hash);
-    }
-};
-
-template <class T>
-struct construct_test4 : public objects, test::exception_base
-{
-    void run() const {
-        T x(0, hash, equal_to);
-    }
-};
-
-template <class T>
-struct construct_test5 : public objects, test::exception_base
-{
-    void run() const {
-        T x(50, hash, equal_to, allocator);
-    }
-};
-
-template <class T>
-struct range : public test::exception_base
-{
-    test::random_values<T> values;
-
-    range() : values(5) {}
-    range(unsigned int count) : values(count) {}
-};
-
-template <class T>
-struct range_construct_test1 : public range<T>, objects
-{
-    void run() const {
-        T x(this->values.begin(), this->values.end());
-    }
-};
-
-template <class T>
-struct range_construct_test2 : public range<T>, objects
-{
-    void run() const {
-        T x(this->values.begin(), this->values.end(), 0);
-    }
-};
-
-template <class T>
-struct range_construct_test3 : public range<T>, objects
-{
-    void run() const {
-        T x(this->values.begin(), this->values.end(), 0, hash);
-    }
-};
-
-template <class T>
-struct range_construct_test4 : public range<T>, objects
-{
-    void run() const {
-        T x(this->values.begin(), this->values.end(), 100, hash, equal_to);
-    }
-};
-
-// Need to run at least one test with a fairly large number
-// of objects in case it triggers a rehash.
-template <class T>
-struct range_construct_test5 : public range<T>, objects
-{
-    range_construct_test5() : range<T>(60) {}
-
-    void run() const {
-        T x(this->values.begin(), this->values.end(), 0, hash, equal_to, allocator);
-    }
-};
-
-template <class T>
-struct input_range_construct_test : public range<T>, objects
-{
-    input_range_construct_test() : range<T>(60) {}
-
-    void run() const {
-        T x(test::input_iterator(this->values.begin()),
-                test::input_iterator(this->values.end()),
-                0, hash, equal_to, allocator);
-    }
-};
-
-RUN_EXCEPTION_TESTS(
-    (construct_test1)(construct_test2)(construct_test3)(construct_test4)(construct_test5)
-    (range_construct_test1)(range_construct_test2)(range_construct_test3)(range_construct_test4)(range_construct_test5)
-    (input_range_construct_test),
-    CONTAINER_SEQ)
Deleted: branches/unordered/trunk/libs/unordered/test/exception/copy_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/exception/copy_tests.cpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
+++ (empty file)
@@ -1,53 +0,0 @@
-
-// Copyright 2006-2007 Daniel James.
-// 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)
-
-#include "./containers.hpp"
-
-#define BOOST_TEST_MAIN
-#include <boost/test/unit_test.hpp>
-#include <boost/test/exception_safety.hpp>
-#include "../helpers/random_values.hpp"
-
-test::seed_t seed(73041);
-
-template <class T>
-struct copy_test1 : public test::exception_base
-{
-    T x;
-
-    void run() const {
-        T y(x);
-    }
-};
-
-template <class T>
-struct copy_test2 : public test::exception_base
-{
-    test::random_values<T> values;
-    T x;
-
-    copy_test2() : values(5), x(values.begin(), values.end()) {}
-
-    void run() const {
-        T y(x);
-    }
-};
-
-template <class T>
-struct copy_test3 : public test::exception_base
-{
-    test::random_values<T> values;
-    T x;
-
-    copy_test3() : values(100), x(values.begin(), values.end()) {}
-
-    void run() const {
-        T y(x);
-    }
-};
-
-RUN_EXCEPTION_TESTS(
-    (copy_test1)(copy_test2)(copy_test3),
-    CONTAINER_SEQ)
Deleted: branches/unordered/trunk/libs/unordered/test/exception/erase_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/exception/erase_tests.cpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
+++ (empty file)
@@ -1,57 +0,0 @@
-
-// Copyright 2006-2007 Daniel James.
-// 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)
-
-#include "./containers.hpp"
-
-#define BOOST_TEST_MAIN
-#include <boost/test/unit_test.hpp>
-#include <boost/test/exception_safety.hpp>
-#include "../helpers/random_values.hpp"
-#include "../helpers/invariants.hpp"
-#include "../helpers/helpers.hpp"
-
-test::seed_t seed(835193);
-
-template <class T>
-struct erase_test_base : public test::exception_base
-{
-    test::random_values<T> values;
-    erase_test_base(unsigned int count = 5) : values(count) {}
-
-    typedef T data_type;
-
-    data_type init() const {
-        return T(values.begin(), values.end());
-    }
-
-    void check(T const& x) const {
-        std::string scope(test::scope);
-
-        HASH_CHECK(scope.find("hash::") != std::string::npos ||
-                scope.find("equal_to::") != std::string::npos ||
-                scope == "operator==(object, object)");
-
-        test::check_equivalent_keys(x);
-    }
-};
-
-template <class T>
-struct erase_by_key_test1 : public erase_test_base<T>
-{
-    void run(T& x) const
-    {
-        typedef typename test::random_values<T>::const_iterator iterator;
-
-        for(iterator it = this->values.begin(), end = this->values.end();
-                it != end; ++it)
-        {
-            x.erase(test::get_key<T>(*it));
-        }
-    }
-};
-
-RUN_EXCEPTION_TESTS(
-    (erase_by_key_test1),
-    CONTAINER_SEQ)
Deleted: branches/unordered/trunk/libs/unordered/test/exception/insert_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/exception/insert_tests.cpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
+++ (empty file)
@@ -1,212 +0,0 @@
-
-// Copyright 2006-2007 Daniel James.
-// 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)
-
-#include "./containers.hpp"
-
-#define BOOST_TEST_MAIN
-#include <boost/test/unit_test.hpp>
-#include <boost/test/exception_safety.hpp>
-#include <string>
-#include "../helpers/random_values.hpp"
-#include "../helpers/invariants.hpp"
-#include "../helpers/strong.hpp"
-#include "../helpers/input_iterator.hpp"
-
-#include <cmath>
-
-test::seed_t seed(747373);
-
-template <class T>
-struct insert_test_base : public test::exception_base
-{
-    test::random_values<T> values;
-    insert_test_base(unsigned int count = 5) : values(count) {}
-
-    typedef T data_type;
-    typedef test::strong<T> strong_type;
-
-    data_type init() const {
-        return T();
-    }
-
-    void check(T const& x, strong_type const& strong) const {
-        std::string scope(test::scope);
-
-        if(scope.find("hash::operator()") == std::string::npos)
-            strong.test(x);
-        test::check_equivalent_keys(x);
-    }
-};
-
-template <class T>
-struct insert_test1 : public insert_test_base<T>
-{
-    typedef typename insert_test_base<T>::strong_type strong_type;
-
-    void run(T& x, strong_type& strong) const {
-        for(typename test::random_values<T>::const_iterator
-                it = this->values.begin(), end = this->values.end(); it != end; ++it)
-        {
-            strong.store(x);
-            x.insert(*it);
-        }
-    }
-};
-
-template <class T>
-struct insert_test2 : public insert_test_base<T>
-{
-    typedef typename insert_test_base<T>::strong_type strong_type;
-
-    void run(T& x, strong_type& strong) const {
-        for(typename test::random_values<T>::const_iterator
-                it = this->values.begin(), end = this->values.end(); it != end; ++it)
-        {
-            strong.store(x);
-            x.insert(x.begin(), *it);
-        }
-    }
-};
-
-template <class T>
-struct insert_test3 : public insert_test_base<T>
-{
-    void run(T& x) const {
-        x.insert(this->values.begin(), this->values.end());
-    }
-
-    void check(T const& x) const {
-        test::check_equivalent_keys(x);
-    }
-};
-
-template <class T>
-struct insert_test4 : public insert_test_base<T>
-{
-    typedef typename insert_test_base<T>::strong_type strong_type;
-
-    void run(T& x, strong_type& strong) const {
-        for(typename test::random_values<T>::const_iterator
-                it = this->values.begin(), end = this->values.end(); it != end; ++it)
-        {
-            strong.store(x);
-            x.insert(it, boost::next(it));
-        }
-    }
-};
-
-template <class T>
-struct insert_test_rehash1 : public insert_test_base<T>
-{
-    typedef typename insert_test_base<T>::strong_type strong_type;
-
-    insert_test_rehash1() : insert_test_base<T>(1000) {}
-
-    T init() const {
-        typedef typename T::size_type size_type;
-
-        T x;
-        x.max_load_factor(0.25);
-        size_type bucket_count = x.bucket_count();
-        size_type initial_elements = static_cast<size_type>(
-            std::ceil(bucket_count * x.max_load_factor()) - 1);
-        BOOST_REQUIRE(initial_elements < this->values.size());
-        x.insert(this->values.begin(),
-                boost::next(this->values.begin(), initial_elements));
-        BOOST_REQUIRE(bucket_count == x.bucket_count());
-        return x;
-    }
-
-    void run(T& x, strong_type& strong) const {
-        typename T::size_type bucket_count = x.bucket_count();
-        int count = 0;
-        typename T::const_iterator pos = x.cbegin();
-
-        for(typename test::random_values<T>::const_iterator
-            it = boost::next(this->values.begin(), x.size()), end = this->values.end();
-            it != end && count < 10; ++it, ++count)
-        {
-            strong.store(x);
-            pos = x.insert(pos, *it);
-        }
-
-        // This isn't actually a failure, but it means the test isn't doing its
-        // job.
-        BOOST_REQUIRE(x.bucket_count() != bucket_count);
-    }
-};
-
-template <class T>
-struct insert_test_rehash2 : public insert_test_rehash1<T>
-{
-    typedef typename insert_test_base<T>::strong_type strong_type;
-
-    void run(T& x, strong_type& strong) const {
-        typename T::size_type bucket_count = x.bucket_count();
-        int count = 0;
-
-        for(typename test::random_values<T>::const_iterator
-            it = boost::next(this->values.begin(), x.size()), end = this->values.end();
-            it != end && count < 10; ++it, ++count)
-        {
-            strong.store(x);
-            x.insert(*it);
-        }
-
-        // This isn't actually a failure, but it means the test isn't doing its
-        // job.
-        BOOST_REQUIRE(x.bucket_count() != bucket_count);
-    }
-};
-
-template <class T>
-struct insert_test_rehash3 : public insert_test_base<T>
-{
-    typename T::size_type mutable rehash_bucket_count, original_bucket_count;
-
-    insert_test_rehash3() : insert_test_base<T>(1000) {}
-
-    T init() const {
-        typedef typename T::size_type size_type;
-
-        T x;
-        x.max_load_factor(0.25);
-
-        original_bucket_count = x.bucket_count();
-        rehash_bucket_count = static_cast<size_type>(
-            std::ceil(original_bucket_count * x.max_load_factor())) - 1;
-
-        size_type initial_elements = rehash_bucket_count - 5;
-
-        BOOST_REQUIRE(initial_elements < this->values.size());
-        x.insert(this->values.begin(),
-                boost::next(this->values.begin(), initial_elements));
-        BOOST_REQUIRE(original_bucket_count == x.bucket_count());
-        return x;
-    }
-
-    void run(T& x) const {
-        typename T::size_type bucket_count = x.bucket_count();
-
-        x.insert(boost::next(this->values.begin(), x.size()),
-                boost::next(this->values.begin(), x.size() + 20));
-
-        // This isn't actually a failure, but it means the test isn't doing its
-        // job.
-        BOOST_REQUIRE(x.bucket_count() != bucket_count);
-    }
-
-    void check(T const& x) const {
-        if(x.size() < rehash_bucket_count) {
-            //BOOST_CHECK(x.bucket_count() == original_bucket_count);
-        }
-        test::check_equivalent_keys(x);
-    }
-};
-
-RUN_EXCEPTION_TESTS(
-    (insert_test1)(insert_test2)(insert_test3)(insert_test4)
-    (insert_test_rehash1)(insert_test_rehash2)(insert_test_rehash3),
-    CONTAINER_SEQ)
Deleted: branches/unordered/trunk/libs/unordered/test/exception/rehash_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/exception/rehash_tests.cpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
+++ (empty file)
@@ -1,85 +0,0 @@
-
-// Copyright 2006-2007 Daniel James.
-// 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)
-
-#include "./containers.hpp"
-
-#define BOOST_TEST_MAIN
-#include <boost/test/unit_test.hpp>
-#include <boost/test/exception_safety.hpp>
-#include <string>
-#include "../helpers/random_values.hpp"
-#include "../helpers/invariants.hpp"
-#include "../helpers/strong.hpp"
-
-#include <iostream>
-
-test::seed_t seed(3298597);
-
-template <class T>
-struct rehash_test_base : public test::exception_base
-{
-    test::random_values<T> values;
-    unsigned int n;
-    rehash_test_base(unsigned int count = 100, unsigned int n = 0) : values(count), n(n) {}
-
-    typedef T data_type;
-    typedef test::strong<T> strong_type;
-
-    data_type init() const {
-        T x(values.begin(), values.end(), n);
-        return x;
-    }
-
-    void check(T const& x, strong_type const& strong) const {
-        std::string scope(test::scope);
-
-        if(scope.find("hash::operator()") == std::string::npos &&
-                scope.find("equal_to::operator()") == std::string::npos &&
-                scope != "operator==(object, object)")
-            strong.test(x);
-
-        test::check_equivalent_keys(x);
-    }
-};
-
-template <class T>
-struct rehash_test0 : rehash_test_base<T>
-{
-    rehash_test0() : rehash_test_base<T>(0) {}
-    void run(T& x) const { x.rehash(0); }
-};
-
-template <class T>
-struct rehash_test1 : rehash_test_base<T>
-{
-    rehash_test1() : rehash_test_base<T>(0) {}
-    void run(T& x) const { x.rehash(200); }
-};
-
-template <class T>
-struct rehash_test2 : rehash_test_base<T>
-{
-    rehash_test2() : rehash_test_base<T>(0, 200) {}
-    void run(T& x) const { x.rehash(0); }
-};
-
-template <class T>
-struct rehash_test3 : rehash_test_base<T>
-{
-    rehash_test3() : rehash_test_base<T>(10, 0) {}
-    void run(T& x) const { x.rehash(200); }
-};
-
-template <class T>
-struct rehash_test4 : rehash_test_base<T>
-{
-    rehash_test4() : rehash_test_base<T>(10, 200) {}
-    void run(T& x) const { x.rehash(0); }
-};
-
-RUN_EXCEPTION_TESTS(
-    (rehash_test0)(rehash_test1)(rehash_test2)(rehash_test3)(rehash_test4),
-    CONTAINER_SEQ)
-
Deleted: branches/unordered/trunk/libs/unordered/test/exception/swap_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/exception/swap_tests.cpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
+++ (empty file)
@@ -1,119 +0,0 @@
-
-// Copyright 2006-2007 Daniel James.
-// 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)
-
-#include "./containers.hpp"
-
-#define BOOST_TEST_MAIN
-#include <boost/test/unit_test.hpp>
-#include <boost/test/exception_safety.hpp>
-#include "../helpers/random_values.hpp"
-#include "../helpers/invariants.hpp"
-
-test::seed_t seed(9387);
-
-template <class T>
-struct self_swap_base : public test::exception_base
-{
-    test::random_values<T> values;
-    self_swap_base(int count = 0) : values(count) {}
-
-    typedef T data_type;
-    T init() const { return T(values.begin(), values.end()); }
-    void run(T& x) const { x.swap(x); }
-    void check(T const& x) const {
-        std::string scope(test::scope);
-
-#if BOOST_UNORDERED_SWAP_METHOD != 2
-        HASH_CHECK(
-                scope == "hash::operator(hash)" ||
-                scope == "hash::operator=(hash)" ||
-                scope == "equal_to::operator(equal_to)" ||
-                scope == "equal_to::operator=(equal_to)");
-#endif
-
-        test::check_equivalent_keys(x);
-    }
-};
-
-template <class T>
-struct self_swap_test1 : self_swap_base<T> {};
-
-template <class T>
-struct self_swap_test2 : self_swap_base<T>
-{
-    self_swap_test2() : self_swap_base<T>(100) {}
-};
-
-template <class T>
-struct swap_base : public test::exception_base
-{
-    const test::random_values<T> x_values, y_values;
-    const T initial_x, initial_y;
-
-    swap_base(unsigned int count1, unsigned int count2, int tag1, int tag2)
-        : x_values(count1), y_values(count2),
-        initial_x(x_values.begin(), x_values.end(), 0, typename T::hasher(tag1),
-                typename T::key_equal(tag1), typename T::allocator_type(tag1)),
-        initial_y(y_values.begin(), y_values.end(), 0, typename T::hasher(tag2),
-                typename T::key_equal(tag2), typename T::allocator_type(tag2))
-    {}
-
-    struct data_type {
-        data_type(T const& x, T const& y)
-            : x(x), y(y) {}
-
-        T x, y;
-    };
-
-    data_type init() const { return data_type(initial_x, initial_y); }
-    void run(data_type& d) const {
-        try {
-            d.x.swap(d.y);
-        } catch (std::runtime_error) {}
-    }
-    void check(data_type const& d) const {
-        std::string scope(test::scope);
-
-#if BOOST_UNORDERED_SWAP_METHOD != 2
-        HASH_CHECK(
-                scope == "hash::operator(hash)" ||
-                scope == "hash::operator=(hash)" ||
-                scope == "equal_to::operator(equal_to)" ||
-                scope == "equal_to::operator=(equal_to)");
-#endif
-        
-        test::check_equivalent_keys(d.x);
-        test::check_equivalent_keys(d.y);
-    }
-};
-
-template <class T>
-struct swap_test1 : swap_base<T>
-{
-    swap_test1() : swap_base<T>(0, 0, 0, 0) {}
-};
-
-template <class T>
-struct swap_test2 : swap_base<T>
-{
-    swap_test2() : swap_base<T>(60, 0, 0, 0) {}    
-};
-
-template <class T>
-struct swap_test3 : swap_base<T>
-{
-    swap_test3() : swap_base<T>(0, 60, 0, 0) {}    
-};
-
-template <class T>
-struct swap_test4 : swap_base<T>
-{
-    swap_test4() : swap_base<T>(10, 10, 1, 2) {}
-};
-
-RUN_EXCEPTION_TESTS(
-    (self_swap_test1)(self_swap_test2)
-    (swap_test1)(swap_test2)(swap_test3)(swap_test4),
-    CONTAINER_SEQ)
Modified: branches/unordered/trunk/libs/unordered/test/objects/test.hpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/objects/test.hpp	(original)
+++ branches/unordered/trunk/libs/unordered/test/objects/test.hpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
@@ -215,18 +215,7 @@
                 memory_area(void const* s, void const* e)
                     : start(s), end(e)
                 {
-                }
-
-                // This is a bit dodgy as it defines overlapping
-                // areas as 'equal', so this isn't a total ordering.
-                // But it is for non-overlapping memory regions - which
-                // is what'll be stored.
-                //
-                // All searches will be for areas entirely contained by
-                // a member of the set - so it should find the area that contains
-                // the region that is searched for.
-                bool operator<(memory_area const& other) const {
-                    return end < other.start;
+                    BOOST_ASSERT(start != end);
                 }
             };
 
@@ -239,7 +228,22 @@
                 int tag_;
             };
 
-            typedef std::map<memory_area, memory_track> allocated_memory_type;
+            // This is a bit dodgy as it defines overlapping
+            // areas as 'equal', so this isn't a total ordering.
+            // But it is for non-overlapping memory regions - which
+            // is what'll be stored.
+            //
+            // All searches will be for areas entirely contained by
+            // a member of the set - so it should find the area that contains
+            // the region that is searched for.
+
+            struct memory_area_compare {
+                bool operator()(memory_area const& x, memory_area const& y) const {
+                    return x.end <= y.start;
+                }
+            };
+
+            typedef std::map<memory_area, memory_track, memory_area_compare> allocated_memory_type;
             allocated_memory_type allocated_memory;
             unsigned int count_allocators = 0;
             unsigned int count_allocations = 0;
@@ -293,7 +297,7 @@
         void track_deallocate(void* ptr, std::size_t n, std::size_t size, int tag)
         {
             allocated_memory_type::iterator pos
-                = allocated_memory.find(memory_area(ptr, ptr));
+                = allocated_memory.find(memory_area(ptr, (char*) ptr + n));
             if(pos == allocated_memory.end()) {
                 BOOST_ERROR("Deallocating unknown pointer.");
             } else {
@@ -307,28 +311,33 @@
             if(count_allocations > 0) --count_allocations;
         }
 
-        void track_construct(void* ptr, std::size_t /*size*/, int tag)
+        void track_construct(void* ptr, std::size_t size, int tag)
         {
             allocated_memory_type::iterator pos
-                = allocated_memory.find(memory_area(ptr, ptr));
-            if(pos == allocated_memory.end())
+                = allocated_memory.find(memory_area(ptr, (char*) ptr + size));
+            if(pos == allocated_memory.end()) {
                 BOOST_ERROR("Constructing unknown pointer.");
-            BOOST_TEST(pos->second.tag_ == tag);
+            }
+            else {
+                BOOST_TEST(pos->second.tag_ == tag);
+                ++pos->second.constructed_;
+            }
             ++count_constructions;
-            ++pos->second.constructed_;
         }
 
-        void track_destroy(void* ptr, std::size_t /*size*/, int tag)
+        void track_destroy(void* ptr, std::size_t size, int tag)
         {
             allocated_memory_type::iterator pos
-                = allocated_memory.find(memory_area(ptr, ptr));
+                = allocated_memory.find(memory_area(ptr, (char*) ptr + size));
             if(pos == allocated_memory.end())
                 BOOST_ERROR("Destroying unknown pointer.");
+            else {
+                BOOST_TEST(pos->second.tag_ == tag);
+                BOOST_TEST(pos->second.constructed_ > 0);
+                if(pos->second.constructed_ > 0) --pos->second.constructed_;
+            }
             BOOST_TEST(count_constructions > 0);
-            BOOST_TEST(pos->second.tag_ == tag);
-            BOOST_TEST(pos->second.constructed_ > 0);
             if(count_constructions > 0) --count_constructions;
-            if(pos->second.constructed_ > 0) --pos->second.constructed_;
         }
     }
 
Modified: branches/unordered/trunk/libs/unordered/test/unordered/Jamfile.v2
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/Jamfile.v2	(original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/Jamfile.v2	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
@@ -14,8 +14,8 @@
 
 test-suite unordered
     :
-        [ run set_compile.cpp ]
-        [ run map_compile.cpp ]
+        [ run compile_set.cpp ]
+        [ run compile_map.cpp ]
         [ run link_test_1.cpp link_test_2.cpp ]
         [ run simple_tests.cpp ]
         [ run equivalent_keys_tests.cpp ]
Deleted: branches/unordered/trunk/libs/unordered/test/unordered/map_compile.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/map_compile.cpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
+++ (empty file)
@@ -1,131 +0,0 @@
-
-// Copyright 2006-2007 Daniel James.
-// 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)
-
-// This test creates the containers with members that meet their minimum
-// requirements. Makes sure everything compiles and is defined correctly.
-
-#include <boost/unordered_map.hpp>
-
-#include <iostream>
-#include <boost/detail/lightweight_test.hpp>
-#include "../objects/minimal.hpp"
-#include "./compile_tests.hpp"
-
-void test0()
-{
-    typedef std::pair<test::minimal::assignable const,
-            test::minimal::copy_constructible> value_type;
-    value_type value(
-            test::minimal::assignable::create(),
-            test::minimal::copy_constructible::create());
-
-    std::cout<<"Test unordered_map.\n";
-    boost::unordered_map<
-        test::minimal::assignable,
-        test::minimal::copy_constructible,
-        test::minimal::hash<test::minimal::assignable>,
-        test::minimal::equal_to<test::minimal::assignable>,
-        test::minimal::allocator<value_type> > map;
-
-    container_test(map, value);
-
-    std::cout<<"Test unordered_multimap.\n";
-    boost::unordered_multimap<
-        test::minimal::assignable,
-        test::minimal::copy_constructible,
-        test::minimal::hash<test::minimal::assignable>,
-        test::minimal::equal_to<test::minimal::assignable>,
-        test::minimal::allocator<value_type> > multimap;
-
-    container_test(multimap, value);
-}
-
-void test1()
-{
-    boost::hash<int> hash;
-    std::equal_to<int> equal_to;
-    int value = 0;
-    std::pair<int const, int> map_value(0, 0);
-
-    std::cout<<"Test unordered_map.\n";
-
-    boost::unordered_map<int, int> map;
-
-    unordered_unique_test(map, map_value);
-    unordered_map_test(map, value, value);
-    unordered_test(map, value, map_value, hash, equal_to);
-    unordered_map_functions(map, value, value);
-
-    std::cout<<"Test unordered_multimap.\n";
-
-    boost::unordered_multimap<int, int> multimap;
-
-    unordered_equivalent_test(multimap, map_value);
-    unordered_map_test(multimap, value, value);
-    unordered_test(multimap, value, map_value, hash, equal_to);
-}
-
-void test2()
-{
-    test::minimal::assignable assignable
-        = test::minimal::assignable::create();
-    test::minimal::copy_constructible copy_constructible
-        = test::minimal::copy_constructible::create();
-    test::minimal::hash<test::minimal::assignable> hash
-        = test::minimal::hash<test::minimal::assignable>::create();
-    test::minimal::equal_to<test::minimal::assignable> equal_to
-        = test::minimal::equal_to<test::minimal::assignable>::create();
-
-    typedef std::pair<test::minimal::assignable const,
-            test::minimal::copy_constructible> map_value_type;
-    map_value_type map_value(assignable, copy_constructible);
-
-    std::cout<<"Test unordered_map.\n";
-
-    boost::unordered_map<
-        test::minimal::assignable,
-        test::minimal::copy_constructible,
-        test::minimal::hash<test::minimal::assignable>,
-        test::minimal::equal_to<test::minimal::assignable>,
-        test::minimal::allocator<map_value_type> > map;
-
-    unordered_unique_test(map, map_value);
-    unordered_map_test(map, assignable, copy_constructible);
-    unordered_test(map, assignable, map_value, hash, equal_to);
-
-
-    boost::unordered_map<
-        test::minimal::assignable,
-        test::minimal::default_copy_constructible,
-        test::minimal::hash<test::minimal::assignable>,
-        test::minimal::equal_to<test::minimal::assignable>,
-        test::minimal::allocator<map_value_type> > map2;
-
-    test::minimal::default_copy_constructible default_copy_constructible;
-
-    unordered_map_functions(map2, assignable, default_copy_constructible);
-
-    std::cout<<"Test unordered_multimap.\n";
-
-    boost::unordered_multimap<
-        test::minimal::assignable,
-        test::minimal::copy_constructible,
-        test::minimal::hash<test::minimal::assignable>,
-        test::minimal::equal_to<test::minimal::assignable>,
-        test::minimal::allocator<map_value_type> > multimap;
-
-    unordered_equivalent_test(multimap, map_value);
-    unordered_map_test(multimap, assignable, copy_constructible);
-    unordered_test(multimap, assignable, map_value, hash, equal_to);
-}
-
-int main()
-{
-    test0();
-    test1();
-    test2();
-
-    return boost::report_errors();
-}
Deleted: branches/unordered/trunk/libs/unordered/test/unordered/set_compile.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/set_compile.cpp	2008-01-07 16:27:37 EST (Mon, 07 Jan 2008)
+++ (empty file)
@@ -1,104 +0,0 @@
-
-// Copyright 2006-2007 Daniel James.
-// 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)
-
-// This test creates the containers with members that meet their minimum
-// requirements. Makes sure everything compiles and is defined correctly.
-
-#include <boost/unordered_set.hpp>
-
-#include <iostream>
-#include <boost/detail/lightweight_test.hpp>
-#include "../objects/minimal.hpp"
-#include "./compile_tests.hpp"
-
-void test0()
-{
-    test::minimal::assignable assignable = test::minimal::assignable::create();
-
-    std::cout<<"Test unordered_set.\n";
-    boost::unordered_set<
-        test::minimal::assignable,
-        test::minimal::hash<test::minimal::assignable>,
-        test::minimal::equal_to<test::minimal::assignable>,
-        test::minimal::allocator<test::minimal::assignable> > set;
-
-    container_test(set, assignable);
-
-    std::cout<<"Test unordered_multiset.\n";
-    boost::unordered_multiset<
-        test::minimal::assignable,
-        test::minimal::hash<test::minimal::assignable>,
-        test::minimal::equal_to<test::minimal::assignable>,
-        test::minimal::allocator<test::minimal::assignable> > multiset;
-
-    container_test(multiset, assignable);
-}
-
-void test1()
-{
-    boost::hash<int> hash;
-    std::equal_to<int> equal_to;
-    int value = 0;
-
-    std::cout<<"Test unordered_set.\n";
-
-    boost::unordered_set<int> set;
-    
-    unordered_unique_test(set, value);
-    unordered_set_test(set, value);
-    unordered_test(set, value, value, hash, equal_to);
-
-    std::cout<<"Test unordered_multiset.\n";
-
-    boost::unordered_multiset<int> multiset;
-    
-    unordered_equivalent_test(multiset, value);
-    unordered_set_test(multiset, value);
-    unordered_test(multiset, value, value, hash, equal_to);
-}
-
-void test2()
-{
-    test::minimal::assignable assignable
-        = test::minimal::assignable::create();
-    test::minimal::copy_constructible copy_constructible
-        = test::minimal::copy_constructible::create();
-    test::minimal::hash<test::minimal::assignable> hash
-        = test::minimal::hash<test::minimal::assignable>::create();
-    test::minimal::equal_to<test::minimal::assignable> equal_to
-        = test::minimal::equal_to<test::minimal::assignable>::create();
-
-    std::cout<<"Test unordered_set.\n";
-
-    boost::unordered_set<
-        test::minimal::assignable,
-        test::minimal::hash<test::minimal::assignable>,
-        test::minimal::equal_to<test::minimal::assignable>,
-        test::minimal::allocator<test::minimal::assignable> > set;
-
-    unordered_unique_test(set, assignable);
-    unordered_set_test(set, assignable);
-    unordered_test(set, assignable, assignable, hash, equal_to);
-
-    std::cout<<"Test unordered_multiset.\n";
-
-    boost::unordered_multiset<
-        test::minimal::assignable,
-        test::minimal::hash<test::minimal::assignable>,
-        test::minimal::equal_to<test::minimal::assignable>,
-        test::minimal::allocator<test::minimal::assignable> > multiset;
-
-    unordered_equivalent_test(multiset, assignable);
-    unordered_set_test(multiset, assignable);
-    unordered_test(multiset, assignable, assignable, hash, equal_to);
-}
-
-int main() {
-    test0();
-    test1();
-    test2();
-
-    return boost::report_errors();
-}