Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76035 - trunk/libs/heap/test
From: tim_at_[hidden]
Date: 2011-12-18 07:30:44


Author: timblechmann
Date: 2011-12-18 07:30:43 EST (Sun, 18 Dec 2011)
New Revision: 76035
URL: http://svn.boost.org/trac/boost/changeset/76035

Log:
heap: compile fixes

- don't link with system library of boost.test
- don't use boost.random, currently broken
- avoid some warnings

Text files modified:
   trunk/libs/heap/test/Jamfile.v2 | 6 ++----
   trunk/libs/heap/test/binomial_heap_test.cpp | 2 +-
   trunk/libs/heap/test/common_heap_tests.hpp | 4 ++--
   trunk/libs/heap/test/mutable_heap_tests.hpp | 21 ++++++++++++++++-----
   4 files changed, 21 insertions(+), 12 deletions(-)

Modified: trunk/libs/heap/test/Jamfile.v2
==============================================================================
--- trunk/libs/heap/test/Jamfile.v2 (original)
+++ trunk/libs/heap/test/Jamfile.v2 2011-12-18 07:30:43 EST (Sun, 18 Dec 2011)
@@ -4,18 +4,16 @@
 
 import testing ;
 
-lib boost_unit_test_framework ;
-
 rule test_all
 {
    local all_rules = ;
 
    for local fileb in [ glob *.cpp ]
    {
- all_rules += [ run $(fileb) boost_unit_test_framework
+ all_rules += [ run $(fileb) ../../test/build//boost_unit_test_framework/<link>static
       : # additional args
       : # test-files
- : # requirements
+ : <library>/boost/test//boost_unit_test_framework # requirements
       ] ;
    }
 

Modified: trunk/libs/heap/test/binomial_heap_test.cpp
==============================================================================
--- trunk/libs/heap/test/binomial_heap_test.cpp (original)
+++ trunk/libs/heap/test/binomial_heap_test.cpp 2011-12-18 07:30:43 EST (Sun, 18 Dec 2011)
@@ -47,4 +47,4 @@
     run_binomial_heap_test<false, true>();
     run_binomial_heap_test<true, false>();
     run_binomial_heap_test<true, true>();
-}
\ No newline at end of file
+}

Modified: trunk/libs/heap/test/common_heap_tests.hpp
==============================================================================
--- trunk/libs/heap/test/common_heap_tests.hpp (original)
+++ trunk/libs/heap/test/common_heap_tests.hpp 2011-12-18 07:30:43 EST (Sun, 18 Dec 2011)
@@ -237,7 +237,7 @@
         BOOST_REQUIRE(data == data_from_queue);
 
         for (unsigned long i = 0; i != data.size(); ++i) {
- BOOST_REQUIRE_EQUAL(std::distance(q.begin(), q.end()), data.size() - i);
+ BOOST_REQUIRE_EQUAL((long)std::distance(q.begin(), q.end()), (long)(data.size() - i));
             q.pop();
         }
     }
@@ -265,7 +265,7 @@
             BOOST_REQUIRE(std::find(q.ordered_begin(), q.ordered_end(), data[i] + data.size()) == q.ordered_end());
 
         for (unsigned long i = 0; i != data.size(); ++i) {
- BOOST_REQUIRE_EQUAL(std::distance(q.begin(), q.end()), data.size() - i);
+ BOOST_REQUIRE_EQUAL((long)std::distance(q.begin(), q.end()), (long)(data.size() - i));
             q.pop();
         }
     }

Modified: trunk/libs/heap/test/mutable_heap_tests.hpp
==============================================================================
--- trunk/libs/heap/test/mutable_heap_tests.hpp (original)
+++ trunk/libs/heap/test/mutable_heap_tests.hpp 2011-12-18 07:30:43 EST (Sun, 18 Dec 2011)
@@ -1,4 +1,9 @@
+// random uses boost.fusion, which clashes with boost.test
+//#define USE_BOOST_RANDOM
+
+#ifdef USE_BOOST_RANDOM
 #include <boost/random.hpp>
+#endif
 
 #include "common_heap_tests.hpp"
 
@@ -207,7 +212,9 @@
 template <typename pri_queue>
 void pri_queue_test_erase(void)
 {
- boost::mt19937 rng;
+#ifdef USE_BOOST_RANDOM
+ boost::mt19937 rng;
+#endif
 
     for (int i = 0; i != test_size; ++i)
     {
@@ -217,10 +224,14 @@
 
         for (int j = 0; j != i; ++j)
         {
- boost::uniform_int<> range(0, data.size() - 1);
- boost::variate_generator<boost::mt19937&, boost::uniform_int<> > gen(rng, range);
-
- int index = gen();
+#ifdef USE_BOOST_RANDOM
+ boost::uniform_int<> range(0, data.size() - 1);
+ boost::variate_generator<boost::mt19937&, boost::uniform_int<> > gen(rng, range);
+
+ int index = gen();
+#else
+ int index = random() % (data.size() - 1);
+#endif
             q.erase(handles[index]);
             handles.erase(handles.begin() + index);
             data.erase(data.begin() + index);


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