Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50800 - in sandbox/itl: boost/itl libs/itl/doc libs/itl/test libs/itl/test/test_interval_map libs/itl/test/test_interval_set
From: afojgo_at_[hidden]
Date: 2009-01-27 03:04:13


Author: jofaber
Date: 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
New Revision: 50800
URL: http://svn.boost.org/trac/boost/changeset/50800

Log:
Added tests: Added overloading tests for infix .^. and .-.
Stable {msvc-9.0, partly congcc-4.3-a7}

Text files modified:
   sandbox/itl/boost/itl/functors.hpp | 8 +-
   sandbox/itl/boost/itl/interval_base_map.hpp | 3
   sandbox/itl/boost/itl/interval_base_set.hpp | 3
   sandbox/itl/boost/itl/interval_maps.hpp | 7 +-
   sandbox/itl/boost/itl/interval_sets.hpp | 31 ++++-------
   sandbox/itl/boost/itl/operators.hpp | 20 ++++++-
   sandbox/itl/libs/itl/doc/interface.qbk | 65 ++++++++++++++++++++------
   sandbox/itl/libs/itl/test/test_interval_map/test_interval_map_shared.cpp | 8 +++
   sandbox/itl/libs/itl/test/test_interval_map_shared.hpp | 98 ++++++++++++++++++++++++++++++++++++++++
   sandbox/itl/libs/itl/test/test_interval_set/test_interval_set_shared.cpp | 8 +++
   sandbox/itl/libs/itl/test/test_interval_set_shared.hpp | 45 ++++++++++++++++++
   11 files changed, 248 insertions(+), 48 deletions(-)

Modified: sandbox/itl/boost/itl/functors.hpp
==============================================================================
--- sandbox/itl/boost/itl/functors.hpp (original)
+++ sandbox/itl/boost/itl/functors.hpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -168,7 +168,7 @@
     inline std::string unary_template_to_string<inplace_et>::apply() { return "&="; }
 
     // ------------------------------------------------------------------------
- template <typename Type> struct inplace_hat
+ template <typename Type> struct inplace_caret
         : public neutron_based_inplace_combine<Type>
     {
         typedef Type type;
@@ -179,7 +179,7 @@
     };
 
     template<>
- inline std::string unary_template_to_string<inplace_hat>::apply() { return "^="; }
+ inline std::string unary_template_to_string<inplace_caret>::apply() { return "^="; }
 
     // ------------------------------------------------------------------------
     template <typename Type> struct inserter
@@ -287,10 +287,10 @@
 
         template<class Type>
         struct inverse<itl::inplace_et<Type> >
- { typedef itl::inplace_hat<Type> type; };
+ { typedef itl::inplace_caret<Type> type; };
 
         template<class Type>
- struct inverse<itl::inplace_hat<Type> >
+ struct inverse<itl::inplace_caret<Type> >
         { typedef itl::inplace_et<Type> type; };
 
         template<class Type>

Modified: sandbox/itl/boost/itl/interval_base_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_map.hpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -694,7 +694,8 @@
 
 
 
- SubType& flip(const domain_mapping_type& x){ flip(value_type(x)); }
+ SubType& flip(const domain_mapping_type& x)
+ { return flip(value_type(interval_type(x.key), x.data)); }
 
     SubType& flip(const value_type& x);
 

Modified: sandbox/itl/boost/itl/interval_base_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_set.hpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -346,7 +346,8 @@
     )const;
 
 
- SubType& flip(const domain_type& x){ flip(interval_type(x)); }
+ SubType& flip(const domain_type& x)
+ { return flip(interval_type(x)); }
 
     SubType& flip(const value_type& x);
 

Modified: sandbox/itl/boost/itl/interval_maps.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_maps.hpp (original)
+++ sandbox/itl/boost/itl/interval_maps.hpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -110,14 +110,15 @@
 //-----------------------------------------------------------------------------
 template
 <
- class SubType, class DomainT, class CodomainT, class Traits,
+ class ObjectT,
+ class DomainT, class CodomainT, class Traits,
     ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
     template<class, ITL_COMPARE, template<class,ITL_COMPARE>class, ITL_ALLOC>class IntervalSet
>
-interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>&
+ObjectT&
 operator -=
 (
- interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
+ ObjectT& object,
     const IntervalSet<DomainT,Compare,Interval,Alloc>& erasure
 )
 {

Modified: sandbox/itl/boost/itl/interval_sets.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_sets.hpp (original)
+++ sandbox/itl/boost/itl/interval_sets.hpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -45,20 +45,17 @@
 //-----------------------------------------------------------------------------
 template
 <
- class SubType, class DomainT,
- ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
+ class ObjectT,
+ class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
     template<class, ITL_COMPARE, template<class,ITL_COMPARE>class, ITL_ALLOC>class IntervalSet
>
-interval_base_set<SubType,DomainT,Compare,Interval,Alloc>&
-operator -=
-(
- interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& object,
- const IntervalSet <DomainT,Compare,Interval,Alloc>& operand
-)
+ObjectT& operator -=
+(ObjectT& object, const IntervalSet<DomainT,Compare,Interval,Alloc>& operand)
 {
         typedef IntervalSet<DomainT,Compare,Interval,Alloc> operand_type;
         const_FORALL(typename operand_type, elem_, operand)
- object.subtract(*elem_);
+ object.erase(*elem_);
+ //CL?? object.subtract(*elem_);
 
         return object;
 }
@@ -68,18 +65,14 @@
 //-----------------------------------------------------------------------------
 template
 <
- class SubType, class DomainT,
- ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
+ class ObjectT,
+ class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
     template<class, ITL_COMPARE, template<class,ITL_COMPARE>class, ITL_ALLOC>class IntervalSet
>
-interval_base_set<SubType,DomainT,Compare,Interval,Alloc>&
-operator ^=
-(
- interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& object,
- const IntervalSet <DomainT,Compare,Interval,Alloc>& operand
-)
-{
- return object.flip(operand);
+ObjectT& operator ^=
+ (ObjectT& object, const IntervalSet<DomainT,Compare,Interval,Alloc>& operand)
+{
+ return object.flip(operand);
 }
 
 

Modified: sandbox/itl/boost/itl/operators.hpp
==============================================================================
--- sandbox/itl/boost/itl/operators.hpp (original)
+++ sandbox/itl/boost/itl/operators.hpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -87,10 +87,6 @@
 operator - (const ObjectT& object, const OperandT& operand)
 { return ObjectT(object) -= operand; }
 
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_right_inter_combinable<ObjectT, OperandT>, ObjectT>::type
-operator - (const OperandT& operand, const ObjectT& object)
-{ return ObjectT(object) -= operand; }
 
 template<class ObjectT>
 ObjectT operator - (const typename ObjectT::overloadable_type& object, const ObjectT& operand)
@@ -134,6 +130,22 @@
 { return object.flip(operand); }
 
 
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+operator ^ (const ObjectT& object, const OperandT& operand)
+{ return ObjectT(object) ^= operand; }
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+operator ^ (const OperandT& operand, const ObjectT& object)
+{ return ObjectT(object) ^= operand; }
+
+
+template<class ObjectT>
+ObjectT operator ^ (const typename ObjectT::overloadable_type& object, const ObjectT& operand)
+{ return ObjectT(object) ^= operand; }
+
+
 }} // namespace itl boost
 
 #endif

Modified: sandbox/itl/libs/itl/doc/interface.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/interface.qbk (original)
+++ sandbox/itl/libs/itl/doc/interface.qbk 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -8,7 +8,7 @@
 
 [section Interface]
 
-Section *Interface* gives an overview over the types and functions
+Section *Interface* outlines types and functions
 of the *Itl*. Synoptical tables allow to review the overall structure of
 the libraries design and to focus on structural equalities and differences
 with the corresponding containers of the standard template library.
@@ -26,7 +26,7 @@
 [/ split_interval_set]
 [/ itl::set]
 
-[table set class templates
+[table Set class templates
 [[group] [template] [instance parameters]]
 [[__itv__] [__itv__] [`<DomainT,Compare>`]]
 [[__itv_bsets__][__itv_set__] [`<DomainT,Compare,Interval,Alloc>`]]
@@ -40,7 +40,7 @@
 described in detail below.
 __Itv_bsets__ represent three
 class templates __itv_set__, __sep_itv_set__ and __spl_itv_set__
-that all have equal template parameters.
+that all have equal template parameters.
 
 [table Parameters of set class templates
 [[] [type of elements][order of elements] [type of intervals] [memory allocation]]
@@ -77,8 +77,8 @@
 [table Parameters of map class templates
 [[] [elements][mapped values][traits] [order of elements] [aggregation propagation] [intersection propagation] [type of intervals] [memory allocation]]
 [[template parameter] [`class`] [`class`] [`class`] [`template <class>class`] [`template <class>class`] [`template <class, template<class>class> class`][`template <class, template<class>class> class`][`template <class>class`]]
-[[__itv_bmaps__] [`DomainT`][`CodomainT`] [`Traits = neutron_absorber`] [`Compare = std::less`] [`Combine = inplace_plus`] [`Section = itl::inplace_star`] [`Interval = itl::interval`] [`Alloc = std::alloc`]]
-[[__itl_map__] [`DomainT`][`CodomainT`] [`Traits = neutron_absorber`] [`Compare = std::less`] [`Combine = inplace_plus`] [`Section = itl::inplace_star`] [`Alloc = std::alloc`]]
+[[__itv_bmaps__] [`DomainT`][`CodomainT`] [`Traits = neutron_absorber`] [`Compare = std::less`] [`Combine = inplace_plus`] [`Section = itl::inplace_et`] [`Interval = itl::interval`] [`Alloc = std::alloc`]]
+[[__itl_map__] [`DomainT`][`CodomainT`] [`Traits = neutron_absorber`] [`Compare = std::less`] [`Combine = inplace_plus`] [`Section = itl::inplace_et`] [`Alloc = std::alloc`]]
 [[template parameter] [`class`] [`class`] [] [`class`] [] [] [] [`class`]]
 [[=std::map=] [`_Key`] [`_Data`] [] [`_Compare = std::less<_Key>`][] [] [] [`Alloc = std::alloc<_Key>`]]
 ]
@@ -92,7 +92,7 @@
 Cp := class Compare = std::less<DomainT>,
 cp := template<class D>class Compare = std::less,
 cb := template<class C>class Combine = itl::inplace_plus,
-s := template<class C>class Section = itl::inplace_star,
+s := template<class C>class Section = itl::inplace_et,
 i := template<class D,template<class>class cp>class Interval = itl::interval
 Ad := class Alloc = std::allocator<DomainT>
 Av := class Alloc = std::allocator<std::pair<DomainT,CodomainT> >
@@ -175,7 +175,7 @@
 [[] [`IsIntegral<DomainT>`][`++, --`] [`IsIncrementable<DomainT> && IsDecrementable<DomainT>`] ]
 ]
 
-A domain type `DomainT` for intervals and interval conainers
+A domain type `DomainT` for intervals and interval containers
 has to satisfy the requirements of concept
 [@http://www.generic-programming.org/languages/conceptcpp/issues/concepts-closed.html `Regular`]
 which
@@ -302,16 +302,11 @@
 will infer [classref boost::itl::inplace_minus inplace_minus]
 as inverse functor, that requries `operator -=` on type `CodomainT`.
 
-The `CodomainT` parameter of Itl's `Maps` is designed under the
-assumption that for a `Combiner` functor particularly for the
-default functor
-[classref boost::itl::inplace_minus inplace_plus] are
-
 In the itl's design we make the assumption,
 in particular for the default setting of parameters
 `Combine = `[classref boost::itl::inplace_minus inplace_plus],
 type `CodomainT` has a neutral element or `neutron`
-with respect to the `Combine` functor. This `neutron`
+with respect to the `Combine` functor.
 
 
 [endsect][/ Required Concepts]
@@ -320,7 +315,7 @@
 [section Associated Types]
 
 [table Associated types of sets
-[[Aspects] [] [type] [__itv__] [__itv_sets__] [__itl_set__] [`std::set`]]
+[[Aspects] [purpose] [type] [__itv__] [__itv_sets__] [__itl_set__] [`std::set`]]
 [[__conceptual__] [data] [`domain_type`] [`DomainT`] [`DomainT`] [`DomainT`] []]
 [[] [ordering][`domain_compare`] [`Compare<DomainT>`] [`Compare<DomainT>`] [`Compare<DomainT>`][]]
 [[__iterative__] [data] [`interval_type`] [] [`Interval<DomainT,Compare>`] [] []]
@@ -330,13 +325,51 @@
 [[] [] [`key_compare`] [] [`exclusive_less <interval_type>`] [] [`_Compare`]]
 [[__conceptual__] [size] [`size_type`] [`size<DomainT>::type`] [`interval_type:: size_type`] [`std::size_t`] []]
 [[] [] [`difference_type`] [`difference <DomainT>::type`][`interval_type:: difference_type`][`std::size_t`] []]
+]
+
+[table Associated types of maps JODO
+[[Aspects] [purpose] [type] [__itv_maps__] [__itl_map__] [`std::map`]]
+[[__conceptual__] [data] [`domain_type`] [`DomainT`] [`DomainT`] []]
+[[] [] [`codomain_type`] [`CodomainT`] [`CodomainT`] []]
+[[] [ordering] [`domain_compare`] [`Compare<DomainT>`] [`Compare<DomainT>`] []]
+[[] [aggregation][`codomain_combine`][`Combine<CodomainT>`] [`Combine<CodomainT>`][]]
+[[] [] [`codomain_intersect`][`Section<CodomainT>`] [`Section<CodomainT>`][]]
+[[__iterative__] [data] [`interval_type`] [`Interval<DomainT,Compare>`] [] []]
+[[] [] [`key_type`] [`Interval<DomainT,Compare>`] [] [`_Key`]]
+[[] [] [`value_type`] [`pair<Interval<DomainT,Compare>, CodomainT`] [] [`_Key`]]
+[[] [ordering] [`interval_compare`][`exclusive_less <interval_type>`] [] []]
+[[] [] [`key_compare`] [`exclusive_less <interval_type>`] [] [`_Compare`]]
+[[__conceptual__] [size] [`size_type`] [`interval_type:: size_type`] [`std::size_t`] []]
+[[] [] [`difference_type`] [`interval_type:: difference_type`] [`std::size_t`] []]
 ]
 
 [endsect][/ Associated Types]
 
 [section Function Matrix]
 
-[table
+In this section a single ['*matrix*] is given, that shows all ['*functions*]
+with shared names and identical or analogous semantics and their
+polymorphical overloads across the class templates of the *itl*.
+Associated are the corresponding functions of the *stl* for easy
+comparison. In order to achieve a concise representation, a series
+of ['*placeholders*] are used throughout the function matrix.
+
+The ['*placeholder's*] purpose is to express the polymorhic
+usage of the functions. The ['*first column*] of the function matrix
+contains the signatures of the functions. Within these
+signatures `T` denotes a container type and `I,J` and `P`
+polymorphic argument and result types.
+
+Within the body of the matrix, sets of *boldface* placeholders denote
+the sets of possible instantiations for a polymorhic
+placeholder `P`. For instance __eiS denotes that for the
+argument type `P`, an element __e, an interval __i or an interval_set __S
+can be instantiated.
+
+If the polymorhism can not be described in this way, only the ['*number*] of
+overloaded implementations for the function of that row is shown.
+
+[table
 [[Placeholder] [Argument types] [Description]]
 [[`T` ] [] [a container type]]
 [[`P` ] [] [polymorhical container argument type]]
@@ -353,7 +386,7 @@
 [[[#interval_map_types] [*M]] [interval_maps] [one of the interval map types]]
 ]
 
-[memberref boost::itl::set::iterative_size `iterative_size`]
+[/ memberref boost::itl::set::iterative_size `iterative_size`]
 
 [table Itl Interfaces
 [[T] [interval][interval\nsets][interval\nmaps][itl::set][itl::map][std::set][std::map]]

Modified: sandbox/itl/libs/itl/test/test_interval_map/test_interval_map_shared.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map/test_interval_map_shared.cpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map/test_interval_map_shared.cpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -63,6 +63,14 @@
 { interval_map_infix_pipe_overload_4_bicremental_types<interval_map, T, int>();}
 
 BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_interval_map_infix_minus_overload_4_bicremental_types, T, bicremental_types)
+{ interval_map_infix_minus_overload_4_bicremental_types<interval_map, T, int>();}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
 (test_itl_interval_map_infix_et_overload_4_bicremental_types, T, bicremental_types)
 { interval_map_infix_et_overload_4_bicremental_types<interval_map, T, int>();}
 
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_interval_map_infix_caret_overload_4_bicremental_types, T, bicremental_types)
+{ interval_map_infix_caret_overload_4_bicremental_types<interval_map, T, int>();}
+

Modified: sandbox/itl/libs/itl/test/test_interval_map_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_shared.hpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -871,6 +871,59 @@
         BOOST_CHECK_EQUAL(map_b | map_pair, map_pair | map_b);
 }
 
+
+
+template <template<class T, class U,
+ class Traits = neutron_absorber,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
+ ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inplace_et, U),
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_ALLOC Alloc = std::allocator
+ >class IntervalMap,
+ class T, class U>
+void interval_map_infix_minus_overload_4_bicremental_types()
+{
+ typedef IntervalMap<T,U> IntervalMapT;
+
+ typename IntervalMapT::interval_mapping_type val_pair1 = IDv(6,9,1);
+ std::pair<const interval<T>, U> val_pair2 = IDv(3,5,3);
+ mapping_pair<T,U> map_pair = K_v(4,3);
+
+ itl::interval<T> itv = C_D(4,11);
+ typename IntervalMapT::interval_mapping_type itv_v = CDv(4,11,3);
+
+ IntervalMapT map_a, map_b;
+ //map_a.add(CDv(1,3,1)).add(IDv(8,9,1)).add(IIv(6,11,3));
+ map_a.add(IIv(6,11,3));
+ map_b.add(IDv(0,9,2)).add(IIv(3,6,1)).add(IDv(5,7,1));
+
+ interval_set<T> join_set_a;
+ separate_interval_set<T> sep_set_a;
+ split_interval_set<T> split_set_a;
+ join_set_a .add(I_D(0,4)).add(I_I(4,6)).add(I_D(5,9));
+ sep_set_a .add(I_D(0,4)).add(I_I(4,6)).add(I_D(5,11));
+ split_set_a.add(I_I(0,0)).add(I_D(8,7)).add(I_I(6,11));
+
+ //Happy day overloading
+ BOOST_CHECK_EQUAL(map_a - map_b, (map_a) - map_b);
+
+ //This checks all cases of is_interval_map_derivative<T>
+ BOOST_CHECK_EQUAL((map_a - val_pair1) + val_pair1, (map_a + val_pair1) - val_pair1);
+ BOOST_CHECK_EQUAL((map_b - val_pair2) + val_pair2, (map_b + val_pair2) - val_pair2);
+ BOOST_CHECK_EQUAL((map_b - map_pair) + map_pair, (map_b + map_pair) - map_pair);
+
+ //This checks all cases of is_interval_set_derivative<T>
+ //BOOST_CHECK_EQUAL(map_a - itv, (itv_v + map_a) - itv);
+ //BOOST_CHECK_EQUAL(map_b - MK_v(8), (IIv(8,8,3) + map_b) - MK_v(8));
+
+ //This checks all cases of is_interval_set_companion<T>
+ //BOOST_CHECK_EQUAL(map_a - split_set_a, (split_set_a + map_a) - split_set_a);
+ //BOOST_CHECK_EQUAL(map_a - sep_set_a, (sep_set_a + map_a) - sep_set_a);
+ //BOOST_CHECK_EQUAL(map_a - join_set_a, (join_set_a + map_a) - join_set_a);
+}
+
+
 template <template<class T, class U,
                    class Traits = neutron_absorber,
                    ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
@@ -919,5 +972,50 @@
         BOOST_CHECK_EQUAL(map_a & join_set_a, join_set_a & map_a);
 }
 
+
+template <template<class T, class U,
+ class Traits = neutron_absorber,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
+ ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inplace_et, U),
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_ALLOC Alloc = std::allocator
+ >class IntervalMap,
+ class T, class U>
+void interval_map_infix_caret_overload_4_bicremental_types()
+{
+ typedef IntervalMap<T,U> IntervalMapT;
+
+ typename IntervalMapT::interval_mapping_type val_pair1 = IDv(6,9,1);
+ std::pair<const interval<T>, U> val_pair2 = IDv(3,5,3);
+ mapping_pair<T,U> map_pair = K_v(4,3);
+
+ itl::interval<T> itv = C_D(4,11);
+
+ IntervalMapT map_a, map_b;
+ map_a.add(CDv(1,3,1)).add(IDv(8,9,1)).add(IIv(6,11,3));
+ map_b.add(IDv(0,9,2)).add(IIv(3,6,1)).add(IDv(5,7,1));
+
+ interval_set<T> join_set_a;
+ separate_interval_set<T> sep_set_a;
+ split_interval_set<T> split_set_a;
+ join_set_a .add(I_D(0,4)).add(I_I(4,6)).add(I_D(5,9));
+ sep_set_a .add(I_D(0,4)).add(I_I(4,6)).add(I_D(5,11));
+ split_set_a.add(I_I(0,0)).add(I_D(8,7)).add(I_I(6,11));
+
+ //Happy day overloading
+ BOOST_CHECK_EQUAL(map_a ^ map_b, map_b ^ map_a);
+
+ //This checks all cases of is_interval_map_derivative<T>
+ BOOST_CHECK_EQUAL(map_a ^ val_pair1, val_pair1 ^ map_a);
+ BOOST_CHECK_EQUAL(map_b ^ val_pair2, val_pair2 ^ map_b);
+ BOOST_CHECK_EQUAL(map_b ^ map_pair, map_pair ^ map_b);
+
+ //This checks all cases of is_interval_set_companion<T>
+ BOOST_CHECK_EQUAL(map_a & split_set_a, split_set_a & map_a);
+ BOOST_CHECK_EQUAL(map_a & sep_set_a, sep_set_a & map_a);
+ BOOST_CHECK_EQUAL(map_a & join_set_a, join_set_a & map_a);
+}
+
 #endif // __test_itl_interval_map_shared_h_JOFA_080920__
 

Modified: sandbox/itl/libs/itl/test/test_interval_set/test_interval_set_shared.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_set/test_interval_set_shared.cpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_set/test_interval_set_shared.cpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -55,6 +55,14 @@
 { interval_set_infix_pipe_overload_4_bicremental_types<interval_set, T>();}
 
 BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_interval_set_infix_minus_overload_4_bicremental_types, T, bicremental_types)
+{ interval_set_infix_minus_overload_4_bicremental_types<interval_set, T>();}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
 (test_itl_interval_set_infix_et_overload_4_bicremental_types, T, bicremental_types)
 { interval_set_infix_et_overload_4_bicremental_types<interval_set, T>();}
 
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_interval_set_infix_caret_overload_4_bicremental_types, T, bicremental_types)
+{ interval_set_infix_caret_overload_4_bicremental_types<interval_set, T>();}
+

Modified: sandbox/itl/libs/itl/test/test_interval_set_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_set_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_set_shared.hpp 2009-01-27 03:04:11 EST (Tue, 27 Jan 2009)
@@ -582,6 +582,29 @@
         BOOST_CHECK_EQUAL(set_b | MK_v(4), MK_v(4) | set_b);
 }
 
+
+template <template< class T,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_ALLOC Alloc = std::allocator
+ >class IntervalSet,
+ class T>
+void interval_set_infix_minus_overload_4_bicremental_types()
+{
+ typedef IntervalSet<T> IntervalSetT;
+ itl::interval<T> itv = I_D(3,5);
+
+ IntervalSetT set_a, set_b;
+ set_a.add(C_D(1,3)).add(I_D(8,9)).add(I_I(6,11));
+ set_b.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
+
+ BOOST_CHECK_EQUAL(set_a - set_b, (set_b + set_a) - set_b);
+ //This checks all cases of is_interval_set_derivative<T>
+ BOOST_CHECK_EQUAL(set_a - itv, (itv + set_a) - itv);
+ BOOST_CHECK_EQUAL(set_b - MK_v(4), (MK_v(4) + set_b) - MK_v(4));
+}
+
+
 template <template< class T,
                     ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
                                         template<class,ITL_COMPARE>class Interval = interval,
@@ -603,5 +626,27 @@
         BOOST_CHECK_EQUAL(set_b & MK_v(4), MK_v(4) & set_b);
 }
 
+
+template <template< class T,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_ALLOC Alloc = std::allocator
+ >class IntervalSet,
+ class T>
+void interval_set_infix_caret_overload_4_bicremental_types()
+{
+ typedef IntervalSet<T> IntervalSetT;
+ itl::interval<T> itv = I_D(3,5);
+
+ IntervalSetT set_a, set_b;
+ set_a.add(C_D(1,3)).add(I_D(8,9)).add(I_I(6,11));
+ set_b.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
+
+ BOOST_CHECK_EQUAL(set_a ^ set_b, set_b ^ set_a);
+ //This checks all cases of is_interval_set_derivative<T>
+ BOOST_CHECK_EQUAL(set_a ^ itv, itv ^ set_a);
+ BOOST_CHECK_EQUAL(set_b ^ MK_v(4), MK_v(4) ^ set_b);
+}
+
 #endif // __test_itl_interval_set_shared_h_JOFA_080920__
 


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