Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84734 - trunk/libs/geometry/index/test/rtree/exceptions
From: adam.wulkiewicz_at_[hidden]
Date: 2013-06-10 17:51:20


Author: awulkiew
Date: 2013-06-10 17:51:20 EDT (Mon, 10 Jun 2013)
New Revision: 84734
URL: http://svn.boost.org/trac/boost/changeset/84734

Log:
geometry.index test: nodes counters added to throwing nodes used in exceptions test

Text files modified:
   trunk/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp | 5 +++++
   trunk/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp | 24 ++++++++++++++++++++++--
   2 files changed, 27 insertions(+), 2 deletions(-)

Modified: trunk/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp
==============================================================================
--- trunk/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp Mon Jun 10 17:48:58 2013 (r84733)
+++ trunk/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp 2013-06-10 17:51:20 EDT (Mon, 10 Jun 2013) (r84734)
@@ -135,7 +135,12 @@
         throwing_varray_settings::reset_calls_counter();
         throwing_varray_settings::set_max_calls(i);
 
+ throwing_nodes_stats::reset_counters();
+
         BOOST_CHECK_THROW( Tree tree(input.begin(), input.end(), parameters), throwing_varray_exception );
+
+ BOOST_CHECK_EQUAL(throwing_nodes_stats::internal_nodes_count(), 0);
+ BOOST_CHECK_EQUAL(throwing_nodes_stats::leafs_count(), 0);
     }
     
     for ( size_t i = 0 ; i < 50 ; i += 2 )

Modified: trunk/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp
==============================================================================
--- trunk/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp Mon Jun 10 17:48:58 2013 (r84733)
+++ trunk/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp 2013-06-10 17:51:20 EDT (Mon, 10 Jun 2013) (r84734)
@@ -16,6 +16,16 @@
 
 #include <rtree/exceptions/test_throwing.hpp>
 
+struct throwing_nodes_stats
+{
+ static void reset_counters() { get_internal_nodes_counter_ref() = 0; get_leafs_counter_ref() = 0; }
+ static size_t internal_nodes_count() { return get_internal_nodes_counter_ref(); }
+ static size_t leafs_count() { return get_leafs_counter_ref(); }
+
+ static size_t & get_internal_nodes_counter_ref() { static size_t cc = 0; return cc; }
+ static size_t & get_leafs_counter_ref() { static size_t cc = 0; return cc; }
+};
+
 namespace boost { namespace geometry { namespace index {
 
 template <size_t MaxElements, size_t MinElements>
@@ -79,12 +89,17 @@
> elements_type;
 
     template <typename Dummy>
- inline dynamic_internal_node(Dummy const&) {}
+ inline dynamic_internal_node(Dummy const&) { throwing_nodes_stats::get_internal_nodes_counter_ref()++; }
+ inline ~dynamic_internal_node() { throwing_nodes_stats::get_internal_nodes_counter_ref()--; }
 
     void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, false> & v) { v(*this); }
     void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, true> & v) const { v(*this); }
 
     elements_type elements;
+
+private:
+ dynamic_internal_node(dynamic_internal_node const&);
+ dynamic_internal_node & operator=(dynamic_internal_node const&);
 };
 
 template <typename Value, typename Parameters, typename Box, typename Allocators>
@@ -94,12 +109,17 @@
     typedef throwing_varray<Value, Parameters::max_elements + 1> elements_type;
 
     template <typename Dummy>
- inline dynamic_leaf(Dummy const&) {}
+ inline dynamic_leaf(Dummy const&) { throwing_nodes_stats::get_leafs_counter_ref()++; }
+ inline ~dynamic_leaf() { throwing_nodes_stats::get_leafs_counter_ref()--; }
 
     void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, false> & v) { v(*this); }
     void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_throwing_d_mem_static_tag, true> & v) const { v(*this); }
 
     elements_type elements;
+
+private:
+ dynamic_leaf(dynamic_leaf const&);
+ dynamic_leaf & operator=(dynamic_leaf const&);
 };
 
 // elements derived 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