Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69129 - in trunk: boost/icl/concept libs/icl/test libs/icl/test/test_casual_
From: afojgo_at_[hidden]
Date: 2011-02-21 17:40:28


Author: jofaber
Date: 2011-02-21 17:40:27 EST (Mon, 21 Feb 2011)
New Revision: 69129
URL: http://svn.boost.org/trac/boost/changeset/69129

Log:
Bug fix for ticket 5207: intersects for interval_maps and segment_type/element_type. Added tests.
Text files modified:
   trunk/boost/icl/concept/interval_map.hpp | 2 +-
   trunk/libs/icl/test/test_casual_/test_casual.cpp | 24 ++++++++++++++++++++++++
   trunk/libs/icl/test/test_interval_map_shared.hpp | 14 +++++++++++---
   3 files changed, 36 insertions(+), 4 deletions(-)

Modified: trunk/boost/icl/concept/interval_map.hpp
==============================================================================
--- trunk/boost/icl/concept/interval_map.hpp (original)
+++ trunk/boost/icl/concept/interval_map.hpp 2011-02-21 17:40:27 EST (Mon, 21 Feb 2011)
@@ -448,7 +448,7 @@
 intersects(const Type& object, const OperandT& operand)
 {
     Type intersection;
- icl::add_intersection(intersection, left, operand);
+ icl::add_intersection(intersection, object, operand);
     return !icl::is_empty(intersection);
 }
 

Modified: trunk/libs/icl/test/test_casual_/test_casual.cpp
==============================================================================
--- trunk/libs/icl/test/test_casual_/test_casual.cpp (original)
+++ trunk/libs/icl/test/test_casual_/test_casual.cpp 2011-02-21 17:40:27 EST (Mon, 21 Feb 2011)
@@ -54,6 +54,30 @@
     BOOST_CHECK_EQUAL(true, true);
 }
 
+BOOST_AUTO_TEST_CASE(ticket_5207)
+{
+ icl::interval< int >::type int_interval;
+ icl::interval_set< int > int_set;
+ icl::interval_map< int, int > int_map;
+ icl::interval_map< int, int >::element_type int_element;
+ icl::interval_map< int, int >::segment_type int_segment;
+
+ /// AFAICT none of the following lines compiles and they all should:
+ icl::lower( int_interval );
+ icl::upper( int_interval );
+ icl::first( int_interval );
+ icl::last( int_interval );
+ //icl::add( int_set, int_set );
+ //icl::add( int_map, int_map );
+ //icl::subtract( int_set, int_set );
+ //icl::subtract( int_map, int_map );
+ int_set += int_interval;
+ icl::disjoint( int_map, int_element );
+ icl::disjoint( int_map, int_segment );
+ icl::intersects( int_map, int_segment );
+ icl::intersects( int_map, int_element );
+}
+
 BOOST_AUTO_TEST_CASE(casual)
 {
     //typedef int T;

Modified: trunk/libs/icl/test/test_interval_map_shared.hpp
==============================================================================
--- trunk/libs/icl/test/test_interval_map_shared.hpp (original)
+++ trunk/libs/icl/test/test_interval_map_shared.hpp 2011-02-21 17:40:27 EST (Mon, 21 Feb 2011)
@@ -1349,9 +1349,17 @@
     //-------------------------------------+
     // (1 3) [6 8)[8 9)[9 11]
     // 1 3 4 3
- //mapping_pair<T,U> map_pair_2_1 = K_v(2,1);
- //BOOST_CHECK( icl::intersects(map_a, map_pair_2_1 ) ); //JODO
-
+ mapping_pair<T,U> map_pair_2_1 = K_v(2,1);
+ BOOST_CHECK( icl::intersects(map_a, map_pair_2_1 ) );
+ BOOST_CHECK( icl::intersects(map_a, K_v(6,3) ) );
+ BOOST_CHECK( icl::intersects(map_a, IDv(6,8,3) ) );
+ BOOST_CHECK( icl::intersects(map_a, CIv(8,11,3) ) );
+ BOOST_CHECK( icl::intersects(map_a, IIv(6,11,3) ) );
+ BOOST_CHECK( icl::intersects(map_a, IIv(6,11,5) ) );
+ BOOST_CHECK(!icl::intersects(map_a, IDv(4,6,5) ) );
+
+ BOOST_CHECK( icl::disjoint(map_a, IDv(4,6,5) ) );
+ BOOST_CHECK(!icl::disjoint(map_a, IDv(0,12,1) ) );
 }
 
 


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