Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2008-04-17 03:42:48


Author: danieljames
Date: 2008-04-17 03:42:47 EDT (Thu, 17 Apr 2008)
New Revision: 44488
URL: http://svn.boost.org/trac/boost/changeset/44488

Log:
A few tweaks for the unordered tests.

Merged revisions 44461-44462,44466 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk

........
  r44461 | danieljames | 2008-04-16 18:34:48 +0100 (Wed, 16 Apr 2008) | 2 lines
  
  Try to get some more tests working on Borland.
........
  r44462 | danieljames | 2008-04-16 18:34:59 +0100 (Wed, 16 Apr 2008) | 2 lines
  
  Write out the number of copies when the unnecessary copy test fails.
........
  r44466 | danieljames | 2008-04-16 18:35:44 +0100 (Wed, 16 Apr 2008) | 2 lines
  
  Add compile test for get_allocator.
........

Properties modified:
   trunk/ (props changed)
Text files modified:
   trunk/libs/unordered/test/helpers/metafunctions.hpp | 15 ++++++---------
   trunk/libs/unordered/test/unordered/compile_tests.hpp | 5 +++++
   trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp | 5 +++++
   3 files changed, 16 insertions(+), 9 deletions(-)

Modified: trunk/libs/unordered/test/helpers/metafunctions.hpp
==============================================================================
--- trunk/libs/unordered/test/helpers/metafunctions.hpp (original)
+++ trunk/libs/unordered/test/helpers/metafunctions.hpp 2008-04-17 03:42:47 EDT (Thu, 17 Apr 2008)
@@ -8,11 +8,7 @@
 
 #include <boost/config.hpp>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/identity.hpp>
 #include <boost/mpl/not.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/apply.hpp>
 #include <boost/unordered_set.hpp>
 #include <boost/unordered_map.hpp>
 
@@ -82,7 +78,8 @@
 
     // Non Const Value Type
 
- struct map_non_const_value_type
+ template <bool IsMap>
+ struct non_const_value_type_impl
     {
         template <class Container>
         struct apply {
@@ -92,7 +89,8 @@
         };
     };
 
- struct set_non_const_value_type
+ template<>
+ struct non_const_value_type_impl<false>
     {
         template <class Container>
         struct apply {
@@ -102,9 +100,8 @@
     
     template <class Container>
     struct non_const_value_type
- : boost::mpl::apply1<
- BOOST_DEDUCED_TYPENAME boost::mpl::if_<is_map<Container>, map_non_const_value_type, set_non_const_value_type>::type,
- Container>
+ : non_const_value_type_impl< ::test::is_map<Container>::value>::
+ BOOST_NESTED_TEMPLATE apply<Container>
     {
     };
 }

Modified: trunk/libs/unordered/test/unordered/compile_tests.hpp
==============================================================================
--- trunk/libs/unordered/test/unordered/compile_tests.hpp (original)
+++ trunk/libs/unordered/test/unordered/compile_tests.hpp 2008-04-17 03:42:47 EDT (Thu, 17 Apr 2008)
@@ -127,6 +127,11 @@
     test::check_return_type<size_type>::equals(a.size());
     test::check_return_type<size_type>::equals(a.max_size());
     test::check_return_type<bool>::convertible(a.empty());
+
+ // Allocator
+
+ typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
+ test::check_return_type<allocator_type>::equals(a_const.get_allocator());
 }
 
 template <class X, class Key>

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-04-17 03:42:47 EDT (Thu, 17 Apr 2008)
@@ -45,8 +45,13 @@
         T x;
         BOOST_DEDUCED_TYPENAME T::value_type a;
         BOOST_CHECK(count_copies::count == 1);
+ if(count_copies::count != 1)
+ std::cerr<<count_copies::count<<" copies.\n";
+
         x.insert(a);
         BOOST_CHECK(count_copies::count == 2);
+ if(count_copies::count != 1)
+ std::cerr<<count_copies::count<<" copies.\n";
     }
 
     boost::unordered_set<count_copies>* set;


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