Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76229 - trunk/libs/heap/test
From: tim_at_[hidden]
Date: 2011-12-30 05:43:14


Author: timblechmann
Date: 2011-12-30 05:43:13 EST (Fri, 30 Dec 2011)
New Revision: 76229
URL: http://svn.boost.org/trac/boost/changeset/76229

Log:
heap: msvc fix

Text files modified:
   trunk/libs/heap/test/stable_heap_tests.hpp | 33 ++++++++++++++-------------------
   1 files changed, 14 insertions(+), 19 deletions(-)

Modified: trunk/libs/heap/test/stable_heap_tests.hpp
==============================================================================
--- trunk/libs/heap/test/stable_heap_tests.hpp (original)
+++ trunk/libs/heap/test/stable_heap_tests.hpp 2011-12-30 05:43:13 EST (Fri, 30 Dec 2011)
@@ -1,3 +1,4 @@
+#include <boost/foreach.hpp>
 #include "common_heap_tests.hpp"
 
 struct q_tester
@@ -11,9 +12,9 @@
         return value < rhs.value;
     }
 
- bool operator>= (q_tester const & rhs) const
+ bool operator> (q_tester const & rhs) const
     {
- return value >= rhs.value;
+ return value > rhs.value;
     }
 
     bool operator== (q_tester const & rhs) const
@@ -27,7 +28,7 @@
 
 std::ostream& operator<< (std::ostream& out, q_tester const & t)
 {
- out << "[" << t.value << " " << t.id << "";
+ out << "[" << t.value << " " << t.id << "]";
     return out;
 }
 
@@ -44,7 +45,7 @@
     return ret;
 }
 
-struct cmp1
+struct compare_by_id
 {
     bool operator()(q_tester const & lhs, q_tester const & rhs)
     {
@@ -52,19 +53,6 @@
     }
 };
 
-struct cmp2 {
- bool operator()(q_tester const & lhs, q_tester const & rhs)
- {
- return lhs.value < rhs.value;
- }
-};
-
-void fixup_test_data(stable_test_data & data)
-{
- std::stable_sort(data.begin(), data.end(), cmp1());
- std::stable_sort(data.begin(), data.end(), cmp2());
-}
-
 template <typename pri_queue>
 void pri_queue_stable_test_sequential_push(void)
 {
@@ -72,7 +60,8 @@
 
     pri_queue q;
     fill_q(q, data);
- fixup_test_data(data);
+ std::stable_sort(data.begin(), data.end(), compare_by_id());
+ std::stable_sort(data.begin(), data.end(), std::less<q_tester>());
     check_q(q, data);
 }
 
@@ -82,8 +71,14 @@
     stable_test_data data = make_stable_test_data(test_size);
     pri_queue q;
     stable_test_data push_data(data);
- std::stable_sort(push_data.begin(), push_data.end(), std::greater_equal<q_tester>());
+
+ std::stable_sort(push_data.begin(), push_data.end(), std::greater<q_tester>());
+
     fill_q(q, push_data);
+
+ std::stable_sort(data.begin(), data.end(), compare_by_id());
+ std::stable_sort(data.begin(), data.end(), std::less<q_tester>());
+
     check_q(q, data);
 }
 


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