Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84072 - in trunk/libs/geometry/index/test: . rtree rtree/exceptions
From: adam.wulkiewicz_at_[hidden]
Date: 2013-04-28 13:07:32


Author: awulkiew
Date: 2013-04-28 13:07:31 EDT (Sun, 28 Apr 2013)
New Revision: 84072
URL: http://svn.boost.org/trac/boost/changeset/84072

Log:
geometry.index test: added test of type-erased iterators - currently may be enabled by define.
Text files modified:
   trunk/libs/geometry/index/test/geometry_index_test_common.hpp | 3 +--
   trunk/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp | 14 +++++++++++++-
   trunk/libs/geometry/index/test/rtree/test_rtree.hpp | 32 ++++++++++++++++++++++++++++++--
   3 files changed, 44 insertions(+), 5 deletions(-)

Modified: trunk/libs/geometry/index/test/geometry_index_test_common.hpp
==============================================================================
--- trunk/libs/geometry/index/test/geometry_index_test_common.hpp (original)
+++ trunk/libs/geometry/index/test/geometry_index_test_common.hpp 2013-04-28 13:07:31 EDT (Sun, 28 Apr 2013)
@@ -19,11 +19,10 @@
 #endif // _MSC_VER
 
 #include <boost/geometry.hpp>
-#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE
-#include <boost/geometry/index/rtree.hpp>
 
 #include <geometry_test_common.hpp>
 
+namespace boost { namespace geometry { namespace index {}}}
 namespace bgi = boost::geometry::index;
 
 #endif // GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP

Modified: trunk/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp
==============================================================================
--- trunk/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp (original)
+++ trunk/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp 2013-04-28 13:07:31 EDT (Sun, 28 Apr 2013)
@@ -154,8 +154,20 @@
>::type
>::other
 {
+ typedef typename Allocator::template rebind<
+ Value
+ >::other value_allocator_type;
+
 public:
- typedef typename Allocator::size_type size_type;
+ typedef Allocator allocator_type;
+
+ typedef Value value_type;
+ typedef value_type & reference;
+ typedef const value_type & const_reference;
+ typedef typename value_allocator_type::size_type size_type;
+ typedef typename value_allocator_type::difference_type difference_type;
+ typedef typename value_allocator_type::pointer pointer;
+ typedef typename value_allocator_type::const_pointer const_pointer;
 
     typedef typename Allocator::template rebind<
         typename node<Value, Parameters, Box, allocators, node_throwing_d_mem_static_tag>::type

Modified: trunk/libs/geometry/index/test/rtree/test_rtree.hpp
==============================================================================
--- trunk/libs/geometry/index/test/rtree/test_rtree.hpp (original)
+++ trunk/libs/geometry/index/test/rtree/test_rtree.hpp 2013-04-28 13:07:31 EDT (Sun, 28 Apr 2013)
@@ -10,12 +10,18 @@
 #ifndef BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP
 #define BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP
 
-#include <geometry_index_test_common.hpp>
-
 #include <boost/foreach.hpp>
 #include <vector>
 #include <algorithm>
 
+#include <geometry_index_test_common.hpp>
+
+#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE
+// TEST
+//#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+//#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
+#include <boost/geometry/index/rtree.hpp>
+
 #include <boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp>
 #include <boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp>
 
@@ -668,6 +674,17 @@
     std::copy(rtree.qbegin(pred), rtree.qend(pred), std::back_inserter(output3));
 
     compare_outputs(rtree, output3, expected_output);
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
+ {
+ typedef typename Rtree::const_query_iterator QI;
+ QI first = rtree.qbegin(pred);
+ QI last = rtree.qend(pred);
+ std::vector<Value> output4;
+ std::copy(first, last, std::back_inserter(output4));
+ compare_outputs(rtree, output4, expected_output);
+ }
+#endif
 #endif
 }
 
@@ -937,6 +954,17 @@
     std::copy(rtree.qbegin(bgi::nearest(pt, k)), rtree.qend(bgi::nearest(pt, k)), std::back_inserter(output3));
 
     compare_nearest_outputs(rtree, output3, expected_output, pt, greatest_distance);
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
+ {
+ typedef typename Rtree::const_query_iterator QI;
+ QI first = rtree.qbegin(bgi::nearest(pt, k));
+ QI last = rtree.qend(bgi::nearest(pt, k));
+ std::vector<Value> output4;
+ std::copy(first, last, std::back_inserter(output4));
+ compare_nearest_outputs(rtree, output4, expected_output, pt, greatest_distance);
+ }
+#endif
 #endif
 }
 


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