Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66428 - trunk/libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2010-11-07 09:43:51


Author: danieljames
Date: 2010-11-07 09:43:50 EST (Sun, 07 Nov 2010)
New Revision: 66428
URL: http://svn.boost.org/trac/boost/changeset/66428

Log:
Call forward declared functions from templates in unordered tests.

Borland is having some issues with the existing tests, since they call
inline functions before they're defined. It might be right to, although
all the other compilers are fine with it. But the test isn't really what
the forward headers are intended for. Try to make the tests better
represent the intent, and possibly work on Borland.
Text files modified:
   trunk/libs/unordered/test/unordered/fwd_map_test.cpp | 37 +++++++++++++++++++++++++++----------
   trunk/libs/unordered/test/unordered/fwd_set_test.cpp | 37 +++++++++++++++++++++++++++----------
   2 files changed, 54 insertions(+), 20 deletions(-)

Modified: trunk/libs/unordered/test/unordered/fwd_map_test.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/fwd_map_test.cpp (original)
+++ trunk/libs/unordered/test/unordered/fwd_map_test.cpp 2010-11-07 09:43:50 EST (Sun, 07 Nov 2010)
@@ -7,37 +7,54 @@
 
 #include <boost/unordered/unordered_map_fwd.hpp>
 
-typedef boost::unordered_map<int, int> int_map;
-
-void call_swap(int_map& x, int_map& y) {
+template <typename T>
+void call_swap(boost::unordered_map<T,T>& x,
+ boost::unordered_map<T,T>& y)
+{
     swap(x,y);
 }
 
-bool call_equals(int_map& x, int_map& y) {
+template <typename T>
+bool call_equals(boost::unordered_map<T,T>& x,
+ boost::unordered_map<T,T>& y)
+{
     return x == y;
 }
 
-bool call_not_equals(int_map& x, int_map& y) {
+template <typename T>
+bool call_not_equals(boost::unordered_map<T,T>& x,
+ boost::unordered_map<T,T>& y)
+{
     return x != y;
 }
 
-typedef boost::unordered_multimap<int, int> int_multimap;
-
-void call_swap(int_multimap& x, int_multimap& y) {
+template <typename T>
+void call_swap(boost::unordered_multimap<T,T>& x,
+ boost::unordered_multimap<T,T>& y)
+{
     swap(x,y);
 }
 
-bool call_equals(int_multimap& x, int_multimap& y) {
+template <typename T>
+bool call_equals(boost::unordered_multimap<T,T>& x,
+ boost::unordered_multimap<T,T>& y)
+{
     return x == y;
 }
 
-bool call_not_equals(int_multimap& x, int_multimap& y) {
+template <typename T>
+bool call_not_equals(boost::unordered_multimap<T,T>& x,
+ boost::unordered_multimap<T,T>& y)
+{
     return x != y;
 }
 
 #include <boost/unordered_map.hpp>
 #include "../helpers/test.hpp"
 
+typedef boost::unordered_map<int, int> int_map;
+typedef boost::unordered_multimap<int, int> int_multimap;
+
 UNORDERED_AUTO_TEST(use_map_fwd_declared_function) {
     int_map x, y;
     x[1] = 2;

Modified: trunk/libs/unordered/test/unordered/fwd_set_test.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/fwd_set_test.cpp (original)
+++ trunk/libs/unordered/test/unordered/fwd_set_test.cpp 2010-11-07 09:43:50 EST (Sun, 07 Nov 2010)
@@ -16,36 +16,53 @@
 true_type is_unordered_set_impl(
         boost::unordered_set<Value, Hash, Pred, Alloc>*);
 
-typedef boost::unordered_set<int> int_set;
-
-void call_swap(int_set& x, int_set& y) {
+template<typename T>
+void call_swap(boost::unordered_set<T>& x,
+ boost::unordered_set<T>& y)
+{
     swap(x,y);
 }
 
-bool call_equals(int_set& x, int_set& y) {
+template<typename T>
+bool call_equals(boost::unordered_set<T>& x,
+ boost::unordered_set<T>& y)
+{
     return x == y;
 }
 
-bool call_not_equals(int_set& x, int_set& y) {
+template<typename T>
+bool call_not_equals(boost::unordered_set<T>& x,
+ boost::unordered_set<T>& y)
+{
     return x != y;
 }
 
-typedef boost::unordered_multiset<int> int_multiset;
-
-void call_swap(int_multiset& x, int_multiset& y) {
+template<typename T>
+void call_swap(boost::unordered_multiset<T>& x,
+ boost::unordered_multiset<T>& y)
+{
     swap(x,y);
 }
 
-bool call_equals(int_multiset& x, int_multiset& y) {
+template<typename T>
+bool call_equals(boost::unordered_multiset<T>& x,
+ boost::unordered_multiset<T>& y)
+{
     return x == y;
 }
 
-bool call_not_equals(int_multiset& x, int_multiset& y) {
+template<typename T>
+bool call_not_equals(boost::unordered_multiset<T>& x,
+ boost::unordered_multiset<T>& y)
+{
     return x != y;
 }
 
 #include "../helpers/test.hpp"
 
+typedef boost::unordered_set<int> int_set;
+typedef boost::unordered_multiset<int> int_multiset;
+
 UNORDERED_AUTO_TEST(use_fwd_declared_trait_without_definition) {
     BOOST_TEST(sizeof(is_unordered_set_impl((int_set*) 0))
         == sizeof(true_type));


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