Boost logo

Boost-Commit :

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


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

Log:
Merge new changes to unordered & hash.

 - Unordered tests can run lightweight test or Boost.Test (at least
   theoretically).
 - Workaround Open BSD's incorrect numeric_limits.
 - Move the hash extensions in their own file.
 - Various small improvements to the unordered docs.
 - Fix some unordered examples.

Merged revisions 43117-43837 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk

Added:
   trunk/boost/functional/hash/extensions.hpp
      - copied unchanged from r43837, /branches/unordered/trunk/boost/functional/hash/extensions.hpp
   trunk/libs/unordered/doc/src_code/dictionary.cpp
      - copied unchanged from r43837, /branches/unordered/trunk/libs/unordered/doc/src_code/dictionary.cpp
   trunk/libs/unordered/doc/src_code/intro.cpp
      - copied unchanged from r43837, /branches/unordered/trunk/libs/unordered/doc/src_code/intro.cpp
Removed:
   trunk/libs/unordered/doc/src_code/insensitive.cpp
Properties modified:
   trunk/ (props changed)
Text files modified:
   trunk/boost/functional/detail/hash_float.hpp | 48 +++++++++-
   trunk/boost/functional/hash.hpp | 1
   trunk/boost/functional/hash/hash.hpp | 174 +--------------------------------------
   trunk/libs/functional/hash/doc/Jamfile.v2 | 13 ++
   trunk/libs/functional/hash/test/hash_float_test.hpp | 84 +++++++++---------
   trunk/libs/functional/hash/test/hash_number_test.cpp | 8
   trunk/libs/unordered/doc/Jamfile.v2 | 13 ++
   trunk/libs/unordered/doc/comparison.qbk | 2
   trunk/libs/unordered/doc/hash_equality.qbk | 36 ++++---
   trunk/libs/unordered/doc/intro.qbk | 20 ---
   trunk/libs/unordered/doc/rationale.qbk | 2
   trunk/libs/unordered/doc/src_code/point1.cpp | 3
   trunk/libs/unordered/examples/hash_functions/fnv-1.hpp | 4
   trunk/libs/unordered/test/helpers/exception_test.hpp | 14 +-
   trunk/libs/unordered/test/helpers/test.hpp | 79 +++++++++++++++++
   trunk/libs/unordered/test/unordered/assign_tests.cpp | 50 +++++------
   trunk/libs/unordered/test/unordered/at_tests.cpp | 10 +
   trunk/libs/unordered/test/unordered/bucket_tests.cpp | 19 ++-
   trunk/libs/unordered/test/unordered/compile_map.cpp | 18 +--
   trunk/libs/unordered/test/unordered/compile_set.cpp | 16 +--
   trunk/libs/unordered/test/unordered/constructor_tests.cpp | 75 +++++-----------
   trunk/libs/unordered/test/unordered/copy_tests.cpp | 45 +++++-----
   trunk/libs/unordered/test/unordered/equivalent_keys_tests.cpp | 14 --
   trunk/libs/unordered/test/unordered/erase_equiv_tests.cpp | 24 +---
   trunk/libs/unordered/test/unordered/erase_tests.cpp | 44 ++++-----
   trunk/libs/unordered/test/unordered/find_tests.cpp | 36 ++++----
   trunk/libs/unordered/test/unordered/insert_stable_tests.cpp | 14 --
   trunk/libs/unordered/test/unordered/insert_tests.cpp | 2
   trunk/libs/unordered/test/unordered/load_factor_tests.cpp | 31 ++++--
   trunk/libs/unordered/test/unordered/rehash_tests.cpp | 21 +++-
   trunk/libs/unordered/test/unordered/simple_tests.cpp | 8
   trunk/libs/unordered/test/unordered/swap_tests.cpp | 35 +++----
   trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp | 32 +++---
   33 files changed, 448 insertions(+), 547 deletions(-)

Modified: trunk/boost/functional/detail/hash_float.hpp
==============================================================================
--- trunk/boost/functional/detail/hash_float.hpp (original)
+++ trunk/boost/functional/detail/hash_float.hpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -54,10 +54,43 @@
 
 #endif
 
+// On OpenBSD, numeric_limits is not reliable for long doubles, but
+// the macros defined in <float.h> are.
+
+#if defined(__OpenBSD__)
+#include <float.h>
+#endif
+
 namespace boost
 {
     namespace hash_detail
     {
+ template <class T>
+ struct limits : std::numeric_limits<T> {};
+
+#if defined(__OpenBSD__)
+ template <>
+ struct limits<long double>
+ : std::numeric_limits<long double>
+ {
+ static long double epsilon() {
+ return LDBL_EPSILON;
+ }
+
+ static long double (max)() {
+ return LDBL_MAX;
+ }
+
+ static long double (min)() {
+ return LDBL_MIN;
+ }
+
+ BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);
+ BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);
+ BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);
+ };
+#endif // __OpenBSD__
+
         inline void hash_float_combine(std::size_t& seed, std::size_t value)
         {
             seed ^= value + (seed<<6) + (seed>>2);
@@ -102,29 +135,28 @@
             // sign with the exponent.
             if(v < 0) {
                 v = -v;
- exp += std::numeric_limits<T>::max_exponent -
- std::numeric_limits<T>::min_exponent;
+ exp += limits<T>::max_exponent -
+ limits<T>::min_exponent;
             }
 
             // The result of frexp is always between 0.5 and 1, so its
             // top bit will always be 1. Subtract by 0.5 to remove that.
             v -= T(0.5);
             v = boost::hash_detail::call_ldexp(v,
- std::numeric_limits<std::size_t>::digits + 1);
+ limits<std::size_t>::digits + 1);
             std::size_t seed = static_cast<std::size_t>(v);
             v -= seed;
 
             // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
             std::size_t const length
- = (std::numeric_limits<T>::digits *
- boost::static_log2<std::numeric_limits<T>::radix>::value
- - 1)
- / std::numeric_limits<std::size_t>::digits;
+ = (limits<T>::digits *
+ boost::static_log2<limits<T>::radix>::value - 1)
+ / limits<std::size_t>::digits;
 
             for(std::size_t i = 0; i != length; ++i)
             {
                 v = boost::hash_detail::call_ldexp(v,
- std::numeric_limits<std::size_t>::digits);
+ limits<std::size_t>::digits);
                 std::size_t part = static_cast<std::size_t>(v);
                 v -= part;
                 hash_float_combine(seed, part);

Modified: trunk/boost/functional/hash.hpp
==============================================================================
--- trunk/boost/functional/hash.hpp (original)
+++ trunk/boost/functional/hash.hpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -8,3 +8,4 @@
 // issue 6.18.
 
 #include <boost/functional/hash/hash.hpp>
+

Modified: trunk/boost/functional/hash/hash.hpp
==============================================================================
--- trunk/boost/functional/hash/hash.hpp (original)
+++ trunk/boost/functional/hash/hash.hpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -518,176 +518,12 @@
 }
 
 #endif // BOOST_FUNCTIONAL_HASH_HASH_HPP
-////////////////////////////////////////////////////////////////////////////////
+
+// Include this outside of the include guards in case the file is included
+// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it
+// undefined.
 
 #if !defined(BOOST_HASH_NO_EXTENSIONS) \
     && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
-#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP
-
-namespace boost
-{
-
-#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
- namespace hash_detail
- {
- template <bool IsArray>
- struct call_hash_impl
- {
- template <class T>
- struct inner
- {
- static std::size_t call(T const& v)
- {
- using namespace boost;
- return hash_value(v);
- }
- };
- };
-
- template <>
- struct call_hash_impl<true>
- {
- template <class Array>
- struct inner
- {
-#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
- static std::size_t call(Array const& v)
-#else
- static std::size_t call(Array& v)
-#endif
- {
- const int size = sizeof(v) / sizeof(*v);
- return boost::hash_range(v, v + size);
- }
- };
- };
-
- template <class T>
- struct call_hash
- : public call_hash_impl<boost::is_array<T>::value>
- ::BOOST_NESTED_TEMPLATE inner<T>
- {
- };
- }
-#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
-
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
-
- template <class T> struct hash
- : std::unary_function<T, std::size_t>
- {
-#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
- std::size_t operator()(T const& val) const
- {
- return hash_value(val);
- }
-#else
- std::size_t operator()(T const& val) const
- {
- return hash_detail::call_hash<T>::call(val);
- }
-#endif
- };
-
-#if BOOST_WORKAROUND(__DMC__, <= 0x848)
- template <class T, unsigned int n> struct hash<T[n]>
- : std::unary_function<T[n], std::size_t>
- {
- std::size_t operator()(const T* val) const
- {
- return boost::hash_range(val, val+n);
- }
- };
-#endif
-
-#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
- // On compilers without partial specialization, boost::hash<T>
- // has already been declared to deal with pointers, so just
- // need to supply the non-pointer version.
-
- namespace hash_detail
- {
- template <bool IsPointer>
- struct hash_impl;
-
-#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-
- template <>
- struct hash_impl<false>
- {
- template <class T>
- struct inner
- : std::unary_function<T, std::size_t>
- {
-#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
- std::size_t operator()(T const& val) const
- {
- return hash_value(val);
- }
-#else
- std::size_t operator()(T const& val) const
- {
- return hash_detail::call_hash<T>::call(val);
- }
+#include <boost/functional/hash/extensions.hpp>
 #endif
- };
- };
-
-#else // Visual C++ 6.5
-
- // There's probably a more elegant way to Visual C++ 6.5 to work
- // but I don't know what it is.
-
- template <bool IsConst>
- struct hash_impl_msvc
- {
- template <class T>
- struct inner
- : public std::unary_function<T, std::size_t>
- {
- std::size_t operator()(T const& val) const
- {
- return hash_detail::call_hash<T const>::call(val);
- }
-
- std::size_t operator()(T& val) const
- {
- return hash_detail::call_hash<T>::call(val);
- }
- };
- };
-
- template <>
- struct hash_impl_msvc<true>
- {
- template <class T>
- struct inner
- : public std::unary_function<T, std::size_t>
- {
- std::size_t operator()(T& val) const
- {
- return hash_detail::call_hash<T>::call(val);
- }
- };
- };
-
- template <class T>
- struct hash_impl_msvc2
- : public hash_impl_msvc<boost::is_const<T>::value>
- ::BOOST_NESTED_TEMPLATE inner<T> {};
-
- template <>
- struct hash_impl<false>
- {
- template <class T>
- struct inner : public hash_impl_msvc2<T> {};
- };
-
-#endif // Visual C++ 6.5
- }
-#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-}
-
-#endif
-

Modified: trunk/libs/functional/hash/doc/Jamfile.v2
==============================================================================
--- trunk/libs/functional/hash/doc/Jamfile.v2 (original)
+++ trunk/libs/functional/hash/doc/Jamfile.v2 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -12,4 +12,15 @@
     <xsl:param>chunk.section.depth=2
     <xsl:param>generate.section.toc.level=2
     <xsl:param>toc.section.depth=1
- <xsl:param>toc.max.depth=1 ;
+ <xsl:param>toc.max.depth=1
+
+ <dependency>css
+ <dependency>images
+ ;
+
+install css : [ glob $(BOOST_ROOT)/doc/src/*.css ]
+ : <location>html ;
+install images : [ glob $(BOOST_ROOT)/doc/src/images/*.png ]
+ : <location>html/images ;
+explicit css ;
+explicit images ;

Modified: trunk/libs/functional/hash/test/hash_float_test.hpp
==============================================================================
--- trunk/libs/functional/hash/test/hash_float_test.hpp (original)
+++ trunk/libs/functional/hash/test/hash_float_test.hpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -29,12 +29,12 @@
     std::cerr<<"\n"
         <<"Testing " BOOST_STRINGIZE(HASH_NAMESPACE) "::hash<"<<name<<">\n"
         <<"\n"
- <<"std::numeric_limits<T>::digits = "
- <<std::numeric_limits<T>::digits<<"\n"
- <<"std::numeric_limits<int>::digits = "
- <<std::numeric_limits<int>::digits<<"\n"
- <<"std::numeric_limits<std::size_t>::digits = "
- <<std::numeric_limits<std::size_t>::digits<<"\n"
+ <<"boost::hash_detail::limits<T>::digits = "
+ <<boost::hash_detail::limits<T>::digits<<"\n"
+ <<"boost::hash_detail::limits<int>::digits = "
+ <<boost::hash_detail::limits<int>::digits<<"\n"
+ <<"boost::hash_detail::limits<std::size_t>::digits = "
+ <<boost::hash_detail::limits<std::size_t>::digits<<"\n"
         <<"\n"
         ;
 
@@ -55,11 +55,11 @@
 #if defined(__BORLANDC__)
     std::cerr<<"Not running infinity checks on Borland, as it causes it to crash.\n";
 #else
- if(std::numeric_limits<T>::has_infinity) {
+ if(boost::hash_detail::limits<T>::has_infinity) {
         T infinity = -log(zero);
         T infinity2 = (T) 1. / zero;
         T infinity3 = (T) -1. / minus_zero;
- T infinity4 = std::numeric_limits<T>::infinity();
+ T infinity4 = boost::hash_detail::limits<T>::infinity();
 
         T minus_infinity = log(zero);
         T minus_infinity2 = (T) -1. / zero;
@@ -89,26 +89,26 @@
 
         // This should really be 'has_denorm == denorm_present' but some
         // compilers don't have 'denorm_present'. See also a later use.
- if(std::numeric_limits<T>::has_denorm) {
- if(x1(std::numeric_limits<T>::denorm_min()) == x1(infinity)) {
+ if(boost::hash_detail::limits<T>::has_denorm) {
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(infinity)) {
                 std::cerr<<"x1(denorm_min) == x1(infinity) == "<<x1(infinity)<<"\n";
             }
- if(x1(std::numeric_limits<T>::denorm_min()) == x1(minus_infinity)) {
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(minus_infinity)) {
                 std::cerr<<"x1(denorm_min) == x1(-infinity) == "<<x1(minus_infinity)<<"\n";
             }
         }
- if(std::numeric_limits<T>::has_quiet_NaN) {
- if(x1(std::numeric_limits<T>::quiet_NaN()) == x1(infinity)) {
+ if(boost::hash_detail::limits<T>::has_quiet_NaN) {
+ if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(infinity)) {
                 std::cerr<<"x1(quiet_NaN) == x1(infinity) == "<<x1(infinity)<<"\n";
             }
- if(x1(std::numeric_limits<T>::quiet_NaN()) == x1(minus_infinity)) {
+ if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(minus_infinity)) {
                 std::cerr<<"x1(quiet_NaN) == x1(-infinity) == "<<x1(minus_infinity)<<"\n";
             }
         }
     }
 #endif
 
- T max = (std::numeric_limits<T>::max)();
+ T max = (boost::hash_detail::limits<T>::max)();
     T half_max = max / 2;
     T quarter_max = max / 4;
     T three_quarter_max = max - quarter_max;
@@ -142,50 +142,50 @@
     BOOST_TEST(x1(v2) == HASH_NAMESPACE::hash_value(v2));
 #endif
 
- BOOST_TEST(x1(std::numeric_limits<T>::epsilon()) ==
- HASH_NAMESPACE::hash_value(std::numeric_limits<T>::epsilon()));
+ BOOST_TEST(x1(boost::hash_detail::limits<T>::epsilon()) ==
+ HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::epsilon()));
 
- BOOST_TEST(std::numeric_limits<T>::epsilon() != (T) 0);
- if(x1(std::numeric_limits<T>::epsilon()) == x1((T) 0))
+ BOOST_TEST(boost::hash_detail::limits<T>::epsilon() != (T) 0);
+ if(x1(boost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
         std::cerr<<"x1(epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
 
- BOOST_TEST(-std::numeric_limits<T>::epsilon() != (T) 0);
- if(x1(-std::numeric_limits<T>::epsilon()) == x1((T) 0))
+ BOOST_TEST(-boost::hash_detail::limits<T>::epsilon() != (T) 0);
+ if(x1(-boost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
         std::cerr<<"x1(-epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
 
- BOOST_TEST((T) 1 + std::numeric_limits<T>::epsilon() != (T) 1);
- if(x1((T) 1 + std::numeric_limits<T>::epsilon()) == x1((T) 1))
+ BOOST_TEST((T) 1 + boost::hash_detail::limits<T>::epsilon() != (T) 1);
+ if(x1((T) 1 + boost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
         std::cerr<<"x1(1 + epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
 
- BOOST_TEST((T) 1 - std::numeric_limits<T>::epsilon() != (T) 1);
- if(x1((T) 1 - std::numeric_limits<T>::epsilon()) == x1((T) 1))
+ BOOST_TEST((T) 1 - boost::hash_detail::limits<T>::epsilon() != (T) 1);
+ if(x1((T) 1 - boost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
         std::cerr<<"x1(1 - epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
 
- BOOST_TEST((T) -1 + std::numeric_limits<T>::epsilon() != (T) -1);
- if(x1((T) -1 + std::numeric_limits<T>::epsilon()) == x1((T) -1))
+ BOOST_TEST((T) -1 + boost::hash_detail::limits<T>::epsilon() != (T) -1);
+ if(x1((T) -1 + boost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
         std::cerr<<"x1(-1 + epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
 
- BOOST_TEST((T) -1 - std::numeric_limits<T>::epsilon() != (T) -1);
- if(x1((T) -1 - std::numeric_limits<T>::epsilon()) == x1((T) -1))
+ BOOST_TEST((T) -1 - boost::hash_detail::limits<T>::epsilon() != (T) -1);
+ if(x1((T) -1 - boost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
         std::cerr<<"x1(-1 - epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
 
     // As before.
- if(std::numeric_limits<T>::has_denorm) {
- if(x1(std::numeric_limits<T>::denorm_min()) == x1(zero)) {
+ if(boost::hash_detail::limits<T>::has_denorm) {
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(zero)) {
             std::cerr<<"x1(denorm_min) == x1(zero) == "<<x1(zero)<<"\n";
         }
 #if !BOOST_WORKAROUND(__DECCXX_VER,<70190006)
         // The Tru64/CXX standard library prior to 7.1 contains a bug in the
- // specialization of std::numeric_limits::denorm_min() for long
+ // specialization of boost::hash_detail::limits::denorm_min() for long
         // doubles which causes this test to fail.
- if(x1(std::numeric_limits<T>::denorm_min()) !=
- HASH_NAMESPACE::hash_value(std::numeric_limits<T>::denorm_min()))
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) !=
+ HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::denorm_min()))
         {
- std::cerr<<"x1(std::numeric_limits<T>::denorm_min()) = "
- << x1(std::numeric_limits<T>::denorm_min())
- << "\nhash_value(std::numeric_limits<T>::denorm_min()) = "
+ std::cerr<<"x1(boost::hash_detail::limits<T>::denorm_min()) = "
+ << x1(boost::hash_detail::limits<T>::denorm_min())
+ << "\nhash_value(boost::hash_detail::limits<T>::denorm_min()) = "
                 << HASH_NAMESPACE::hash_value(
- std::numeric_limits<T>::denorm_min())
+ boost::hash_detail::limits<T>::denorm_min())
                 << "\nx1(0) = "<<x1(0)<<"\n";
         }
 #endif
@@ -193,12 +193,12 @@
 
 // NaN also causes borland to crash.
 #if !defined(__BORLANDC__)
- if(std::numeric_limits<T>::has_quiet_NaN) {
- if(x1(std::numeric_limits<T>::quiet_NaN()) == x1(1.0)) {
+ if(boost::hash_detail::limits<T>::has_quiet_NaN) {
+ if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(1.0)) {
             std::cerr<<"x1(quiet_NaN) == x1(1.0) == "<<x1(1.0)<<"\n";
         }
- BOOST_TEST(x1(std::numeric_limits<T>::quiet_NaN()) ==
- HASH_NAMESPACE::hash_value(std::numeric_limits<T>::quiet_NaN()));
+ BOOST_TEST(x1(boost::hash_detail::limits<T>::quiet_NaN()) ==
+ HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::quiet_NaN()));
     }
 #endif
 }

Modified: trunk/libs/functional/hash/test/hash_number_test.cpp
==============================================================================
--- trunk/libs/functional/hash/test/hash_number_test.cpp (original)
+++ trunk/libs/functional/hash/test/hash_number_test.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -31,7 +31,7 @@
 template <class T>
 void numeric_test(T*)
 {
- typedef std::numeric_limits<T> limits;
+ typedef boost::hash_detail::limits<T> limits;
 
     compile_time_tests((T*) 0);
 
@@ -55,7 +55,7 @@
 
     if (limits::is_integer)
     {
- if(limits::is_signed || limits::digits <= std::numeric_limits<std::size_t>::digits)
+ if(limits::is_signed || limits::digits <= boost::hash_detail::limits<std::size_t>::digits)
             BOOST_TEST(HASH_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5));
         BOOST_TEST(HASH_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u));
         BOOST_TEST(HASH_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u));
@@ -67,7 +67,7 @@
 template <class T>
 void limits_test(T*)
 {
- typedef std::numeric_limits<T> limits;
+ typedef boost::hash_detail::limits<T> limits;
 
     if(limits::is_specialized)
     {
@@ -98,7 +98,7 @@
 template <class T>
 void poor_quality_tests(T*)
 {
- typedef std::numeric_limits<T> limits;
+ typedef boost::hash_detail::limits<T> limits;
 
     HASH_NAMESPACE::hash<T> x1;
     HASH_NAMESPACE::hash<T> x2;

Modified: trunk/libs/unordered/doc/Jamfile.v2
==============================================================================
--- trunk/libs/unordered/doc/Jamfile.v2 (original)
+++ trunk/libs/unordered/doc/Jamfile.v2 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -12,4 +12,15 @@
     <xsl:param>chunk.section.depth=2
     <xsl:param>generate.section.toc.level=2
     <xsl:param>toc.section.depth=1
- <xsl:param>toc.max.depth=1 ;
+ <xsl:param>toc.max.depth=1
+
+ <dependency>css
+ <dependency>images
+ ;
+
+install css : [ glob $(BOOST_ROOT)/doc/src/*.css ]
+ : <location>html ;
+install images : [ glob $(BOOST_ROOT)/doc/src/images/*.png ]
+ : <location>html/images ;
+explicit css ;
+explicit images ;

Modified: trunk/libs/unordered/doc/comparison.qbk
==============================================================================
--- trunk/libs/unordered/doc/comparison.qbk (original)
+++ trunk/libs/unordered/doc/comparison.qbk 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -83,7 +83,7 @@
     ]
     [
         [`erase` never throws an exception]
- [The containers hash or predicate function can throw exceptions
+ [The containers' hash or predicate function can throw exceptions
             from `erase`]
     ]
 ]

Modified: trunk/libs/unordered/doc/hash_equality.qbk
==============================================================================
--- trunk/libs/unordered/doc/hash_equality.qbk (original)
+++ trunk/libs/unordered/doc/hash_equality.qbk 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -6,32 +6,35 @@
 
 While the associative containers use an ordering relation to specify how the
 elements are stored, the unordered associative containers use an equality
-predicate and a hash function. For example, [classref boost::unordered_set]
+predicate and a hash function. For example, [classref boost::unordered_map]
 is declared as:
 
- template<typename Value,
- typename Hash = ``[classref boost::hash]``<Value>,
- typename Pred = std::equal_to<Value>,
- typename Alloc = std::allocator<Value> >
- class ``[classref boost::unordered_set unordered_set]``;
+ template <
+ class Key, class Mapped,
+ class Hash = ``[classref boost::hash]``<Key>,
+ class Pred = std::equal_to<Key>,
+ class Alloc = std::allocator<Key> >
+ class ``[classref boost::unordered_map unordered_map]``;
 
 The hash function comes first as you might want to change the hash function
-but not the equality predicate, while if you were to change the behavior
-of the equality predicate you would have to change the hash function to match
-it. So, if you wanted to use the
+but not the equality predicate. For example, if you wanted to use the
 [@http://www.isthe.com/chongo/tech/comp/fnv/ FNV-1 hash] you could write:
 
- ``[classref boost::unordered_set]``<std::string, hash::fnv_1> words;
+[import src_code/dictionary.cpp]
+[case_sensitive_dictionary_fnv]
 
 An example implementation of FNV-1, and some other hash functions are supplied
 in the examples directory.
 
-Alternatively, you might wish to use a different equality function. If you do
-this you will need to use a hash function that matches it. So to implement a
-case-insensitive dictionary:
+If you wish to use a different equality function,
+you will also need to use a matching hash function. For
+example, to implement a case insensitive dictionary you need to define a
+case insensitive equality predicate and hash function:
 
-[import src_code/insensitive.cpp]
 [case_insensitive_functions]
+
+Which you can then use in a case insensitive dictionary:
+
 [case_insensitive_dictionary]
 
 This is a simplified version of the example at
@@ -45,8 +48,9 @@
 [import src_code/point1.cpp]
 [point_example1]
 
-Although, [link hash.custom extending boost::hash to support the type] is
-probably a better solution:
+Since the default hash function is [link hash Boost.Hash],
+we can [link hash.custom extend it to support the type]
+so that the hash function doesn't need to be explicitly given:
 
 [import src_code/point2.cpp]
 [point_example2]

Modified: trunk/libs/unordered/doc/intro.qbk
==============================================================================
--- trunk/libs/unordered/doc/intro.qbk (original)
+++ trunk/libs/unordered/doc/intro.qbk 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -84,32 +84,18 @@
 The containers are used in a similar manner to the normal associative
 containers:
 
- #include <``[headerref boost/unordered_map.hpp]``>
- #include <cassert>
-
- int main()
- {
- boost::unordered_map<std::string, int> x;
- x["one"] = 1;
- x["two"] = 2;
- x["three"] = 3;
-
- assert(x["one"] == 1);
- assert(x["missing"] == 0);
- }
+[import src_code/intro.cpp]
+[intro_example1_2]
 
 But since the elements aren't ordered, the output of:
 
- BOOST_FOREACH(map::value_type i, x) {
- std::cout<<i.first<<","<<i.second<<"\n";
- }
+[intro_example1_3]
 
 can be in any order. For example, it might be:
 
     two,2
     one,1
     three,3
- missing,0
 
 To store an object in an unordered associative container requires both an
 key equality function and a hash function. The default function objects in

Modified: trunk/libs/unordered/doc/rationale.qbk
==============================================================================
--- trunk/libs/unordered/doc/rationale.qbk (original)
+++ trunk/libs/unordered/doc/rationale.qbk 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -10,7 +10,7 @@
     N2345, 'Placement Insert for Containers']]
 [def __n2369__
     [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2369.pdf
- the August 2008 version of the working draft standard]]
+ the August 2007 version of the working draft standard]]
 
 [section:rationale Implementation Rationale]
 

Deleted: trunk/libs/unordered/doc/src_code/insensitive.cpp
==============================================================================
--- trunk/libs/unordered/doc/src_code/insensitive.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
+++ (empty file)
@@ -1,79 +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 <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
-#include <boost/algorithm/string/predicate.hpp>
-
-//[case_insensitive_functions
- struct iequal_to
- : std::binary_function<std::string, std::string, bool>
- {
- bool operator()(std::string const& x,
- std::string const& y) const
- {
- return boost::algorithm::iequals(x, y, std::locale());
- }
- };
-
- struct ihash
- : std::unary_function<std::string, std::size_t>
- {
- std::size_t operator()(std::string const& x) const
- {
- std::size_t seed = 0;
- std::locale locale;
-
- for(std::string::const_iterator it = x.begin();
- it != x.end(); ++it)
- {
- boost::hash_combine(seed, std::toupper(*it, locale));
- }
-
- return seed;
- }
- };
-
- struct word_info;
-//]
-
- struct word_info {
- int tag;
- explicit word_info(int t = 0) : tag(t) {}
- };
-
-int main() {
-//[case_insensitive_dictionary
- boost::unordered_map<std::string, word_info, ihash, iequal_to>
- idictionary;
-//]
-
- BOOST_TEST(idictionary.empty());
-
- idictionary["one"] = word_info(1);
- BOOST_TEST(idictionary.size() == 1);
- BOOST_TEST(idictionary.find("ONE") != idictionary.end() &&
- idictionary.find("ONE") == idictionary.find("one"));
-
- idictionary.insert(std::make_pair("ONE", word_info(2)));
- BOOST_TEST(idictionary.size() == 1);
- BOOST_TEST(idictionary.find("ONE") != idictionary.end() &&
- idictionary.find("ONE")->first == "one" &&
- idictionary.find("ONE")->second.tag == 1);
-
- idictionary["One"] = word_info(3);
- BOOST_TEST(idictionary.size() == 1);
- BOOST_TEST(idictionary.find("ONE") != idictionary.end() &&
- idictionary.find("ONE")->first == "one" &&
- idictionary.find("ONE")->second.tag == 3);
-
- idictionary["two"] = word_info(4);
- BOOST_TEST(idictionary.size() == 2);
- BOOST_TEST(idictionary.find("two") != idictionary.end() &&
- idictionary.find("TWO")->first == "two" &&
- idictionary.find("Two")->second.tag == 4);
-
- return boost::report_errors();
-}

Modified: trunk/libs/unordered/doc/src_code/point1.cpp
==============================================================================
--- trunk/libs/unordered/doc/src_code/point1.cpp (original)
+++ trunk/libs/unordered/doc/src_code/point1.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -29,8 +29,7 @@
         }
     };
 
- boost::unordered_multiset<point, point_hash, std::equal_to<point> >
- points;
+ boost::unordered_multiset<point, point_hash> points;
 //]
 
 int main() {

Modified: trunk/libs/unordered/examples/hash_functions/fnv-1.hpp
==============================================================================
--- trunk/libs/unordered/examples/hash_functions/fnv-1.hpp (original)
+++ trunk/libs/unordered/examples/hash_functions/fnv-1.hpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -7,7 +7,7 @@
     template <std::size_t FnvPrime, std::size_t OffsetBias>
     struct basic_fnv_1
     {
- std::size_t operator()(std::string const& text)
+ std::size_t operator()(std::string const& text) const
         {
             std::size_t hash = OffsetBias;
             for(std::string::const_iterator it = text.begin(), end = text.end();
@@ -24,7 +24,7 @@
     template <std::size_t FnvPrime, std::size_t OffsetBias>
     struct basic_fnv_1a
     {
- std::size_t operator()(std::string const& text)
+ std::size_t operator()(std::string const& text) const
         {
             std::size_t hash = OffsetBias;
             for(std::string::const_iterator it = text.begin(), end = text.end();

Modified: trunk/libs/unordered/test/helpers/exception_test.hpp
==============================================================================
--- trunk/libs/unordered/test/helpers/exception_test.hpp (original)
+++ trunk/libs/unordered/test/helpers/exception_test.hpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -19,30 +19,28 @@
 #include <boost/preprocessor/cat.hpp>
 
 #if defined(BOOST_UNORDERED_USE_TEST)
-# define UNORDERED_EXCEPTION_TEST_PREFIX
 # define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \
- BOOST_AUTO_TEST_CASE(name) \
+ UNORDERED_AUTO_TEST(name) \
         { \
             test_func< type > fixture; \
             ::test::exception_safety(fixture, BOOST_STRINGIZE(test_func<type>)); \
         }
-# define UNORDERED_EXCEPTION_TEST_POSTFIX
 # define UNORDERED_EPOINT_IMPL BOOST_ITEST_EPOINT
 #else
-# define UNORDERED_EXCEPTION_TEST_PREFIX int main() {
-# define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \
+# define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \
+ UNORDERED_AUTO_TEST(name) \
         { \
             test_func< type > fixture; \
             ::test::lightweight::exception_safety(fixture, BOOST_STRINGIZE(test_func<type>)); \
         }
-# define UNORDERED_EXCEPTION_TEST_POSTFIX return boost::report_errors(); }
 # define UNORDERED_EPOINT_IMPL ::test::lightweight::epoint
 #endif
 
+#define UNORDERED_EXCEPTION_TEST_POSTFIX RUN_TESTS()
+
 #define RUN_EXCEPTION_TESTS(test_seq, param_seq) \
- UNORDERED_EXCEPTION_TEST_PREFIX \
     BOOST_PP_SEQ_FOR_EACH_PRODUCT(RUN_EXCEPTION_TESTS_OP, (test_seq)(param_seq)) \
- UNORDERED_EXCEPTION_TEST_POSTFIX
+ RUN_TESTS()
 
 #define RUN_EXCEPTION_TESTS_OP(r, product) \
     UNORDERED_EXCEPTION_TEST_CASE( \

Modified: trunk/libs/unordered/test/helpers/test.hpp
==============================================================================
--- trunk/libs/unordered/test/helpers/test.hpp (original)
+++ trunk/libs/unordered/test/helpers/test.hpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -7,13 +7,90 @@
 #define BOOST_UNORDERED_TEST_TEST_HEADER
 
 #if defined(BOOST_UNORDERED_USE_TEST)
+
 #include <boost/test/test_tools.hpp>
 #define UNORDERED_CHECK(x) BOOST_CHECK(x)
 #define UNORDERED_REQUIRE(x) BOOST_REQUIRE(x)
+#define UNORDERED_AUTO_TEST(x) BOOST_AUTO_TEST_CASE(x)
+#define RUN_TESTS()
+
 #else
+
 #include <boost/detail/lightweight_test.hpp>
+#include <boost/preprocessor/cat.hpp>
+
 #define UNORDERED_CHECK(x) BOOST_TEST(x)
-#define UNORDERED_REQUIRE(x) if(!(x)) { BOOST_ERROR(BOOST_STRINGIZE(x)); throw test::lightweight::test_failure(); }
+#define UNORDERED_REQUIRE(x) if(!(x)) { BOOST_ERROR(BOOST_STRINGIZE(x)); throw ::test::lightweight::test_failure(); }
+#define UNORDERED_AUTO_TEST(x) \
+ struct BOOST_PP_CAT(x, _type) : public ::test::registered_test_base { \
+ BOOST_PP_CAT(x, _type)() { \
+ ::test::test_list::add_test(this); \
+ } \
+ void run(); \
+ }; \
+ BOOST_PP_CAT(x, _type) x; \
+ void BOOST_PP_CAT(x, _type)::run()
+#define RUN_TESTS() int main() { ::test::test_list::run_tests(); return boost::report_errors(); }
+
+namespace test {
+ struct registered_test_base {
+ registered_test_base* next;
+ virtual void run() = 0;
+ virtual ~registered_test_base() {}
+ };
+
+ namespace test_list {
+ static inline registered_test_base*& first() {
+ static registered_test_base* ptr = 0;
+ return ptr;
+ }
+
+ static inline registered_test_base*& last() {
+ static registered_test_base* ptr = 0;
+ return ptr;
+ }
+
+ static inline void add_test(registered_test_base* test) {
+ if(last()) {
+ last()->next = test;
+ }
+ else {
+ first() = test;
+ }
+
+ last() = test;
+ }
+
+ static inline void run_tests() {
+ for(registered_test_base* i = first(); i; i = i->next)
+ i->run();
+ }
+ };
+}
+
 #endif
 
+#include <boost/preprocessor/seq/for_each_product.hpp>
+#include <boost/preprocessor/seq/fold_left.hpp>
+#include <boost/preprocessor/seq/to_tuple.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+// Run test with every combination of the parameters (a sequence of sequences)
+#define UNORDERED_TEST(name, parameters) \
+ BOOST_PP_SEQ_FOR_EACH_PRODUCT(UNORDERED_TEST_OP, ((name)) parameters)
+
+#define UNORDERED_TEST_OP(r, product) \
+ UNORDERED_TEST_OP2( \
+ BOOST_PP_SEQ_HEAD(product), \
+ BOOST_PP_SEQ_TAIL(product))
+
+#define UNORDERED_TEST_OP2(name, params) \
+ UNORDERED_AUTO_TEST(BOOST_PP_SEQ_FOLD_LEFT(UNORDERED_TEST_OP_JOIN, name, params)) { \
+ name BOOST_PP_SEQ_TO_TUPLE(params); \
+ }
+
+#define UNORDERED_TEST_OP_JOIN(s, state, elem) \
+ BOOST_PP_CAT(state, BOOST_PP_CAT(_, elem))
+
 #endif

Modified: trunk/libs/unordered/test/unordered/assign_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/assign_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/assign_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,7 +5,7 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include "../objects/test.hpp"
 #include "../helpers/random_values.hpp"
 #include "../helpers/tracker.hpp"
@@ -13,6 +13,8 @@
 
 #include <iostream>
 
+namespace assign_tests {
+
 test::seed_t seed(96785);
 
 template <class T>
@@ -83,32 +85,24 @@
     }
 }
 
-int main()
-{
- boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
- boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
- boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
- boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
-
- assign_tests1(test_set);
- assign_tests1(test_multiset);
- assign_tests1(test_map);
- assign_tests1(test_multimap);
-
- assign_tests1(test_set, test::generate_collisions);
- assign_tests1(test_multiset, test::generate_collisions);
- assign_tests1(test_map, test::generate_collisions);
- assign_tests1(test_multimap, test::generate_collisions);
-
- assign_tests2(test_set);
- assign_tests2(test_multiset);
- assign_tests2(test_map);
- assign_tests2(test_multimap);
-
- assign_tests2(test_set, test::generate_collisions);
- assign_tests2(test_multiset, test::generate_collisions);
- assign_tests2(test_map, test::generate_collisions);
- assign_tests2(test_multimap, test::generate_collisions);
+boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
+boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
+boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
+boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
+
+using test::default_generator;
+using test::generate_collisions;
+
+UNORDERED_TEST(assign_tests1,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+ ((default_generator)(generate_collisions))
+)
+
+UNORDERED_TEST(assign_tests2,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+ ((default_generator)(generate_collisions))
+)
 
- return boost::report_errors();
 }
+
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/at_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/at_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/at_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -4,10 +4,12 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include <string>
 
-int main() {
+namespace at_tests {
+
+UNORDERED_AUTO_TEST(at_tests) {
     boost::unordered_map<std::string, int> x;
     typedef boost::unordered_map<std::string, int>::iterator iterator;
 
@@ -23,6 +25,8 @@
     }
     catch(std::out_of_range) {
     }
+}
 
- return boost::report_errors();
 }
+
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/bucket_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/bucket_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/bucket_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,12 +5,14 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include <algorithm>
 #include "../objects/test.hpp"
 #include "../helpers/random_values.hpp"
 #include "../helpers/helpers.hpp"
 
+namespace bucket_tests {
+
 test::seed_t seed(54635);
 
 template <class X>
@@ -48,12 +50,13 @@
     }
 }
 
-int main()
-{
- bucket_tests((boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >*) 0);
- bucket_tests((boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >*) 0);
- bucket_tests((boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >*) 0);
- bucket_tests((boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >*) 0);
+boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
+boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
+boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
+boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
+
+UNORDERED_TEST(bucket_tests, ((test_set)(test_multiset)(test_map)(test_multimap)))
 
- return boost::report_errors();
 }
+
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/compile_map.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/compile_map.cpp (original)
+++ trunk/libs/unordered/test/unordered/compile_map.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -9,11 +9,11 @@
 #include <boost/unordered_map.hpp>
 
 #include <iostream>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include "../objects/minimal.hpp"
 #include "./compile_tests.hpp"
 
-void test0()
+UNORDERED_AUTO_TEST(test0)
 {
     typedef std::pair<test::minimal::assignable const,
             test::minimal::copy_constructible> value_type;
@@ -42,8 +42,7 @@
     container_test(multimap, value);
 }
 
-void test1()
-{
+UNORDERED_AUTO_TEST(test1) {
     boost::hash<int> hash;
     std::equal_to<int> equal_to;
     int value = 0;
@@ -67,7 +66,7 @@
     unordered_test(multimap, value, map_value, hash, equal_to);
 }
 
-void test2()
+UNORDERED_AUTO_TEST(test2)
 {
     test::minimal::assignable assignable
         = test::minimal::assignable::create();
@@ -121,11 +120,4 @@
     unordered_test(multimap, assignable, map_value, hash, equal_to);
 }
 
-int main()
-{
- test0();
- test1();
- test2();
-
- return boost::report_errors();
-}
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/compile_set.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/compile_set.cpp (original)
+++ trunk/libs/unordered/test/unordered/compile_set.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -9,11 +9,11 @@
 #include <boost/unordered_set.hpp>
 
 #include <iostream>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include "../objects/minimal.hpp"
 #include "./compile_tests.hpp"
 
-void test0()
+UNORDERED_AUTO_TEST(test0)
 {
     test::minimal::assignable assignable = test::minimal::assignable::create();
 
@@ -36,7 +36,7 @@
     container_test(multiset, assignable);
 }
 
-void test1()
+UNORDERED_AUTO_TEST(test1)
 {
     boost::hash<int> hash;
     std::equal_to<int> equal_to;
@@ -59,7 +59,7 @@
     unordered_test(multiset, value, value, hash, equal_to);
 }
 
-void test2()
+UNORDERED_AUTO_TEST(test2)
 {
     test::minimal::assignable assignable
         = test::minimal::assignable::create();
@@ -95,10 +95,4 @@
     unordered_test(multiset, assignable, assignable, hash, equal_to);
 }
 
-int main() {
- test0();
- test1();
- test2();
-
- return boost::report_errors();
-}
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/constructor_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/constructor_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/constructor_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,7 +5,7 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include "../objects/test.hpp"
 #include "../helpers/random_values.hpp"
 #include "../helpers/tracker.hpp"
@@ -15,6 +15,8 @@
 
 #include <iostream>
 
+namespace constructor_tests {
+
 test::seed_t seed(356730);
 
 template <class T>
@@ -255,53 +257,28 @@
     test::check_equivalent_keys(x);
 }
 
-int main()
-{
- boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
- boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
- boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
- boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
-
- std::cerr<<"Test1 test_set\n";
- constructor_tests1(test_set);
- std::cerr<<"Test1 test_multiset\n";
- constructor_tests1(test_multiset);
- std::cerr<<"Test1 test_map\n";
- constructor_tests1(test_map);
- std::cerr<<"Test1 test_multimap\n";
- constructor_tests1(test_multimap);
-
- std::cerr<<"Test1 test_set, collisions\n";
- constructor_tests1(test_set, test::generate_collisions);
- std::cerr<<"Test1 test_multiset, collisions\n";
- constructor_tests1(test_multiset, test::generate_collisions);
- std::cerr<<"Test1 test_map, collisions\n";
- constructor_tests1(test_map, test::generate_collisions);
- std::cerr<<"Test1 test_multimap, collisions\n";
- constructor_tests1(test_multimap, test::generate_collisions);
-
- std::cerr<<"Test2 test_set\n";
- constructor_tests2(test_set);
- std::cerr<<"Test2 test_multiset\n";
- constructor_tests2(test_multiset);
- std::cerr<<"Test2 test_map\n";
- constructor_tests2(test_map);
- std::cerr<<"Test2 test_multimap\n";
- constructor_tests2(test_multimap);
-
- std::cerr<<"Test2 test_set, collisions\n";
- constructor_tests2(test_set, test::generate_collisions);
- std::cerr<<"Test2 test_multiset, collisions\n";
- constructor_tests2(test_multiset, test::generate_collisions);
- std::cerr<<"Test2 test_map, collisions\n";
- constructor_tests2(test_map, test::generate_collisions);
- std::cerr<<"Test2 test_multimap, collisions\n";
- constructor_tests2(test_multimap, test::generate_collisions);
-
- std::cerr<<"Map Test unordered_map<test::object, test::object>\n";
- map_constructor_test(test_map);
- std::cerr<<"Map Test unordered_multimap<test::object, test::object>\n";
- map_constructor_test(test_multimap);
+boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
+boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
+boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
+boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
+
+using test::default_generator;
+using test::generate_collisions;
+
+UNORDERED_TEST(constructor_tests1,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+ ((default_generator)(generate_collisions))
+)
+
+UNORDERED_TEST(constructor_tests2,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+ ((default_generator)(generate_collisions))
+)
+
+UNORDERED_TEST(map_constructor_test,
+ ((test_map)(test_multimap))
+)
 
- return boost::report_errors();
 }
+
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/copy_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/copy_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/copy_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,7 +5,7 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include "../objects/test.hpp"
 #include "../helpers/random_values.hpp"
 #include "../helpers/tracker.hpp"
@@ -14,6 +14,9 @@
 
 test::seed_t seed(9063);
 
+namespace copy_tests
+{
+
 template <class T>
 void copy_construct_tests1(T*, test::random_generator const& generator = test::default_generator)
 {
@@ -90,27 +93,23 @@
     }
 }
 
-int main()
-{
- boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
- boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
- boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
- boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
-
- copy_construct_tests1(test_set);
- copy_construct_tests1(test_multiset);
- copy_construct_tests1(test_map);
- copy_construct_tests1(test_multimap);
-
- copy_construct_tests2(test_set);
- copy_construct_tests2(test_multiset);
- copy_construct_tests2(test_map);
- copy_construct_tests2(test_multimap);
-
- copy_construct_tests2(test_set, test::generate_collisions);
- copy_construct_tests2(test_multiset, test::generate_collisions);
- copy_construct_tests2(test_map, test::generate_collisions);
- copy_construct_tests2(test_multimap, test::generate_collisions);
+boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
+boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
+boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
+boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
+
+using test::default_generator;
+using test::generate_collisions;
+
+UNORDERED_TEST(copy_construct_tests1,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+)
+
+UNORDERED_TEST(copy_construct_tests2,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+ ((default_generator)(generate_collisions))
+)
 
- return boost::report_errors();
 }
+
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/equivalent_keys_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/equivalent_keys_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/equivalent_keys_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,7 +5,7 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include <algorithm>
 #include <map>
 #include <list>
@@ -32,7 +32,7 @@
     test::check_equivalent_keys(x1);
 }
 
-void set_tests()
+UNORDERED_AUTO_TEST(set_tests)
 {
     int values[][5] = {
         {1},
@@ -55,7 +55,7 @@
     test_equal_insertion<boost::unordered_multiset<int> >(values[4], values[4] + 3);
 }
 
-void map_tests()
+UNORDERED_AUTO_TEST(map_tests)
 {
     typedef std::list<std::pair<int const, int> > values_type;
     values_type v[5];
@@ -76,10 +76,4 @@
             v[i2].begin(), v[i2].end());
 }
 
-int main()
-{
- set_tests();
- map_tests();
-
- return boost::report_errors();
-}
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/erase_equiv_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/erase_equiv_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/erase_equiv_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -7,7 +7,7 @@
 // hairy with several tricky edge cases - so explicitly test each one.
 
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include <list>
 #include <set>
 #include <iostream>
@@ -52,8 +52,7 @@
 typedef collide_map::value_type collide_value;
 typedef std::list<collide_value> collide_list;
 
-
-void empty_range_tests()
+UNORDERED_AUTO_TEST(empty_range_tests)
 {
     collide_map x;
     x.erase(x.begin(), x.end());
@@ -61,7 +60,7 @@
     x.erase(x.end(), x.end());
 }
 
-void single_item_tests()
+UNORDERED_AUTO_TEST(single_item_tests)
 {
     collide_list init;
     init.push_back(collide_value(1,1));
@@ -75,7 +74,7 @@
     BOOST_TEST(x.count(1) == 0 && x.size() == 0);
 }
 
-void two_equivalent_item_tests()
+UNORDERED_AUTO_TEST(two_equivalent_item_tests)
 {
     collide_list init;
     init.push_back(collide_value(1,1));
@@ -172,7 +171,7 @@
     }
 }
 
-void exhaustive_collide_tests()
+UNORDERED_AUTO_TEST(exhaustive_collide_tests)
 {
     std::cout<<"exhaustive_collide_tests:\n";
     collide_map m;
@@ -180,20 +179,11 @@
     std::cout<<"\n";
 }
 
-void exhaustive_collide2_tests()
+UNORDERED_AUTO_TEST(exhaustive_collide2_tests)
 {
     std::cout<<"exhaustive_collide2_tests:\n";
     exhaustive_erase_tests((collide_map2*) 0, 8, 4);
     std::cout<<"\n";
 }
 
-int main()
-{
- empty_range_tests();
- single_item_tests();
- two_equivalent_item_tests();
- exhaustive_collide_tests();
- exhaustive_collide2_tests();
-
- return boost::report_errors();
-}
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/erase_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/erase_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/erase_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,7 +5,7 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include <boost/next_prior.hpp>
 #include "../objects/test.hpp"
 #include "../helpers/random_values.hpp"
@@ -15,6 +15,9 @@
 
 #include <iostream>
 
+namespace erase_tests
+{
+
 test::seed_t seed(85638);
 
 template <class Container>
@@ -119,30 +122,19 @@
     std::cerr<<"\n";
 }
 
-int main()
-{
- boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
- boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
- boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
- boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
-
- std::cerr<<"Erase test_set.\n";
- erase_tests1(test_set);
- std::cerr<<"Erase test_multiset.\n";
- erase_tests1(test_multiset);
- std::cerr<<"Erase test_map.\n";
- erase_tests1(test_map);
- std::cerr<<"Erase test_multimap.\n";
- erase_tests1(test_multimap);
-
- std::cerr<<"Erase test_set, collisions.\n";
- erase_tests1(test_set, test::generate_collisions);
- std::cerr<<"Erase test_multiset, collisions.\n";
- erase_tests1(test_multiset, test::generate_collisions);
- std::cerr<<"Erase test_map, collisions.\n";
- erase_tests1(test_map, test::generate_collisions);
- std::cerr<<"Erase test_multimap, collisions.\n";
- erase_tests1(test_multimap, test::generate_collisions);
+boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
+boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
+boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
+boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
+
+using test::default_generator;
+using test::generate_collisions;
+
+UNORDERED_TEST(erase_tests1,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+ ((default_generator)(generate_collisions))
+)
 
- return boost::report_errors();
 }
+
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/find_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/find_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/find_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,12 +5,15 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include "../objects/test.hpp"
 #include "../helpers/random_values.hpp"
 #include "../helpers/tracker.hpp"
 #include "../helpers/helpers.hpp"
 
+namespace find_tests
+{
+
 test::seed_t seed(78937);
 
 template <class X>
@@ -78,22 +81,19 @@
     }
 }
 
-int main()
-{
- boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
- boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
- boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
- boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
-
- find_tests1(test_set);
- find_tests1(test_multiset);
- find_tests1(test_map);
- find_tests1(test_multimap);
-
- find_tests1(test_set, test::generate_collisions);
- find_tests1(test_multiset, test::generate_collisions);
- find_tests1(test_map, test::generate_collisions);
- find_tests1(test_multimap, test::generate_collisions);
+boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
+boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
+boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
+boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
+
+using test::default_generator;
+using test::generate_collisions;
+
+UNORDERED_TEST(find_tests1,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+ ((default_generator)(generate_collisions))
+)
 
- return 0;
 }
+
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/insert_stable_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/insert_stable_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/insert_stable_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,7 +5,7 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 
 #include <iostream>
 
@@ -39,7 +39,7 @@
     }
 }
 
-void stable_insert_test1() {
+UNORDERED_AUTO_TEST(stable_insert_test1) {
     boost::unordered_multiset<insert_stable::member> x;
 
     x.insert(insert_stable::member(1,1));
@@ -56,7 +56,7 @@
     BOOST_TEST(it == end);
 }
 
-void stable_insert_test2() {
+UNORDERED_AUTO_TEST(stable_insert_test2) {
     boost::unordered_multimap<insert_stable::member, int> x;
     typedef boost::unordered_multimap<insert_stable::member, int>::const_iterator iterator;
 
@@ -75,10 +75,4 @@
     BOOST_TEST(it == end);
 }
 
-int main()
-{
- stable_insert_test1();
- stable_insert_test2();
-
- return boost::report_errors();
-}
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/insert_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/insert_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/insert_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,7 +5,7 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include <boost/next_prior.hpp>
 #include "../objects/test.hpp"
 #include "../helpers/random_values.hpp"

Modified: trunk/libs/unordered/test/unordered/load_factor_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/load_factor_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/load_factor_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,7 +5,7 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include <boost/limits.hpp>
 #include "../helpers/random_values.hpp"
 
@@ -14,6 +14,9 @@
 #pragma warning(disable:4127) // conditional expression is constant
 #endif
 
+namespace load_factor_tests
+{
+
 test::seed_t seed(783656);
 
 template <class X>
@@ -63,21 +66,23 @@
         insert_test(ptr, std::numeric_limits<float>::infinity());
 }
 
-int main()
-{
- load_factor_tests((boost::unordered_set<int>*) 0);
- load_factor_tests((boost::unordered_multiset<int>*) 0);
- load_factor_tests((boost::unordered_map<int, int>*) 0);
- load_factor_tests((boost::unordered_multimap<int, int>*) 0);
-
- load_factor_insert_tests((boost::unordered_set<int>*) 0);
- load_factor_insert_tests((boost::unordered_multiset<int>*) 0);
- load_factor_insert_tests((boost::unordered_map<int, int>*) 0);
- load_factor_insert_tests((boost::unordered_multimap<int, int>*) 0);
+boost::unordered_set<int>* int_set_ptr;
+boost::unordered_multiset<int>* int_multiset_ptr;
+boost::unordered_map<int, int>* int_map_ptr;
+boost::unordered_multimap<int, int>* int_multimap_ptr;
+
+UNORDERED_TEST(load_factor_tests,
+ ((int_set_ptr)(int_multiset_ptr)(int_map_ptr)(int_multimap_ptr))
+)
+
+UNORDERED_TEST(load_factor_insert_tests,
+ ((int_set_ptr)(int_multiset_ptr)(int_map_ptr)(int_multimap_ptr))
+)
 
- return boost::report_errors();
 }
 
+RUN_TESTS()
+
 #if defined(BOOST_MSVC)
 #pragma warning(pop)
 #pragma warning(disable:4127) // conditional expression is constant

Modified: trunk/libs/unordered/test/unordered/rehash_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/rehash_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/rehash_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,10 +5,13 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include "../helpers/random_values.hpp"
 #include "../helpers/tracker.hpp"
 
+namespace rehash_tests
+{
+
 test::seed_t seed(2974);
 
 template <class X>
@@ -59,11 +62,15 @@
     rehash_test1(ptr);
 }
 
-int main() {
- rehash_tests((boost::unordered_set<int>*) 0);
- rehash_tests((boost::unordered_multiset<int>*) 0);
- rehash_tests((boost::unordered_map<int, int>*) 0);
- rehash_tests((boost::unordered_multimap<int, int>*) 0);
+boost::unordered_set<int>* int_set_ptr;
+boost::unordered_multiset<int>* int_multiset_ptr;
+boost::unordered_map<int, int>* int_map_ptr;
+boost::unordered_multimap<int, int>* int_multimap_ptr;
+
+UNORDERED_TEST(rehash_tests,
+ ((int_set_ptr)(int_multiset_ptr)(int_map_ptr)(int_multimap_ptr))
+)
 
- return boost::report_errors();
 }
+
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/simple_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/simple_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/simple_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -7,7 +7,7 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include <cstdlib>
 #include <algorithm>
 #include "../helpers/equivalent.hpp"
@@ -83,7 +83,7 @@
     }
 }
 
-int main()
+UNORDERED_AUTO_TEST(simple_tests)
 {
     using namespace std;
     srand(14878);
@@ -123,6 +123,6 @@
             multimap.insert(std::pair<const int, int>(index, rand()));
     }
     simple_test(multimap);
-
- return boost::report_errors();
 }
+
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/swap_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/swap_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/swap_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -8,12 +8,15 @@
 #include <iterator>
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 #include "../objects/test.hpp"
 #include "../helpers/random_values.hpp"
 #include "../helpers/tracker.hpp"
 #include "../helpers/invariants.hpp"
 
+namespace swap_tests
+{
+
 test::seed_t seed(783472);
 
 template <class X>
@@ -114,22 +117,18 @@
 #endif
 }
 
-int main()
-{
- boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
- boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
- boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
- boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
-
- swap_tests1(test_set);
- swap_tests1(test_multiset);
- swap_tests1(test_map);
- swap_tests1(test_multimap);
-
- swap_tests2(test_set);
- swap_tests2(test_multiset);
- swap_tests2(test_map);
- swap_tests2(test_multimap);
+boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
+boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
+boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
+boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multimap;
+
+UNORDERED_TEST(swap_tests1,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+)
+
+UNORDERED_TEST(swap_tests2,
+ ((test_set)(test_multiset)(test_map)(test_multimap))
+)
 
- return boost::report_errors();
 }
+RUN_TESTS()

Modified: trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp 2008-03-24 13:03:15 EDT (Mon, 24 Mar 2008)
@@ -5,9 +5,10 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
-#include <boost/detail/lightweight_test.hpp>
+#include "../helpers/test.hpp"
 
-namespace test {
+namespace unnecessary_copy_tests
+{
     struct count_copies
     {
         static int count;
@@ -17,22 +18,24 @@
        count_copies& operator=(count_copies const&);
     };
 
- bool operator==(test::count_copies const&, test::count_copies const&) {
+ bool operator==(count_copies const&, count_copies const&) {
         return true;
     }
 }
 
 #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
-namespace boost {
+namespace boost
 #else
-namespace test {
+namespace unnecessary_copy_tests
 #endif
- std::size_t hash_value(test::count_copies const&) {
+{
+ std::size_t hash_value(unnecessary_copy_tests::count_copies const&) {
         return 0;
     }
 }
 
-namespace test {
+namespace unnecessary_copy_tests
+{
     int count_copies::count;
 
     template <class T>
@@ -45,14 +48,13 @@
         x.insert(a);
         BOOST_TEST(count_copies::count == 2);
     }
-}
 
-int main()
-{
- test::unnecessary_copy_test((boost::unordered_set<test::count_copies>*) 0);
- test::unnecessary_copy_test((boost::unordered_multiset<test::count_copies>*) 0);
- test::unnecessary_copy_test((boost::unordered_map<int, test::count_copies>*) 0);
- test::unnecessary_copy_test((boost::unordered_multimap<int, test::count_copies>*) 0);
+ boost::unordered_set<count_copies>* set;
+ boost::unordered_multiset<count_copies>* multiset;
+ boost::unordered_map<int, count_copies>* map;
+ boost::unordered_multimap<int, count_copies>* multimap;
 
- return boost::report_errors();
+ UNORDERED_TEST(unnecessary_copy_test, ((set)(multiset)(map)(multimap)))
 }
+
+RUN_TESTS()


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