mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 23:24:02 +00:00
[test][algorithms][maximum_gap] Remove the use of Boost.Assign.
Do not use Boost.Assign nor Boost.Tuple in the test. This should fix the compilation error on GCC 4.4 c++0x.
This commit is contained in:
parent
f00f4b14c4
commit
7773f04541
@ -4,6 +4,7 @@
|
||||
// Copyright (c) 2015, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
@ -20,12 +21,8 @@
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/max_interval_gap.hpp>
|
||||
|
||||
namespace ba = boost::assign;
|
||||
namespace bg = boost::geometry;
|
||||
|
||||
class uint_interval
|
||||
@ -39,11 +36,6 @@ public:
|
||||
, m_right(right)
|
||||
{}
|
||||
|
||||
uint_interval(boost::tuple<unsigned, unsigned> const& tuple)
|
||||
: m_left(boost::get<0>(tuple))
|
||||
, m_right(boost::get<1>(tuple))
|
||||
{}
|
||||
|
||||
template <std::size_t Index>
|
||||
value_type get() const
|
||||
{
|
||||
@ -59,6 +51,23 @@ private:
|
||||
unsigned m_left, m_right;
|
||||
};
|
||||
|
||||
struct uint_intervals
|
||||
: public std::vector<uint_interval>
|
||||
{
|
||||
uint_intervals()
|
||||
{}
|
||||
|
||||
uint_intervals(unsigned left, unsigned right)
|
||||
{
|
||||
this->push_back(uint_interval(left, right));
|
||||
}
|
||||
|
||||
uint_intervals & operator()(unsigned left, unsigned right)
|
||||
{
|
||||
this->push_back(uint_interval(left, right));
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, uint_interval const& interval)
|
||||
{
|
||||
@ -81,9 +90,10 @@ inline void test_one(std::string const& case_id,
|
||||
gap_type gap = bg::maximum_gap(intervals);
|
||||
|
||||
std::ostringstream stream;
|
||||
for (std::vector<uint_interval>::const_iterator it = intervals.begin();
|
||||
it != intervals.end();
|
||||
++it)
|
||||
for (typename boost::range_const_iterator<RangeOfIntervals>::type
|
||||
it = boost::const_begin(intervals);
|
||||
it != boost::const_end(intervals);
|
||||
++it)
|
||||
{
|
||||
stream << " " << *it;
|
||||
}
|
||||
@ -104,26 +114,26 @@ inline void test_one(std::string const& case_id,
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_maximum_gap )
|
||||
{
|
||||
std::vector<uint_interval> intervals;
|
||||
uint_intervals intervals;
|
||||
|
||||
intervals = ba::tuple_list_of(3,4)(1,10)(5,11)(20,35)(12,14)(36,40)(39,41)(35,36)(37,37)(50,50)(50,51);
|
||||
intervals = uint_intervals(3,4)(1,10)(5,11)(20,35)(12,14)(36,40)(39,41)(35,36)(37,37)(50,50)(50,51);
|
||||
test_one("case_01", intervals, 9);
|
||||
|
||||
intervals = ba::tuple_list_of(3,4)(1,10)(5,11)(20,35)(52,60)(12,14)(36,40)(39,41)(35,36)(37,37)(55,56);
|
||||
intervals = uint_intervals(3,4)(1,10)(5,11)(20,35)(52,60)(12,14)(36,40)(39,41)(35,36)(37,37)(55,56);
|
||||
test_one("case_02", intervals, 11);
|
||||
|
||||
intervals = ba::tuple_list_of(3,4);
|
||||
intervals = uint_intervals(3,4);
|
||||
test_one("case_03", intervals, 0);
|
||||
|
||||
intervals = ba::tuple_list_of(3,4)(15,15);
|
||||
intervals = uint_intervals(3,4)(15,15);
|
||||
test_one("case_04", intervals, 11);
|
||||
|
||||
intervals = ba::tuple_list_of(3,14)(5,5)(5,6);
|
||||
intervals = uint_intervals(3,14)(5,5)(5,6);
|
||||
test_one("case_05", intervals, 0);
|
||||
|
||||
intervals = ba::tuple_list_of(3,10)(15,15)(15,18)(15,16);
|
||||
intervals = uint_intervals(3,10)(15,15)(15,18)(15,16);
|
||||
test_one("case_06", intervals, 5);
|
||||
|
||||
intervals = ba::tuple_list_of(38,41)(3,10)(15,15)(15,18)(15,16)(20,30)(22,30)(23,30);
|
||||
intervals = uint_intervals(38,41)(3,10)(15,15)(15,18)(15,16)(20,30)(22,30)(23,30);
|
||||
test_one("case_07", intervals, 8);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user