|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50893 - in sandbox/itl: boost/itl libs/itl/doc libs/itl/test libs/itl/test/test_quantifier_map
From: afojgo_at_[hidden]
Date: 2009-01-30 03:57:18
Author: jofaber
Date: 2009-01-30 03:57:15 EST (Fri, 30 Jan 2009)
New Revision: 50893
URL: http://svn.boost.org/trac/boost/changeset/50893
Log:
Added tests and docs. Added tests for quantifiers modified map traits docu. Stable {msvc-9.0, partly congcc-4.3-a7}
Text files modified:
sandbox/itl/boost/itl/interval_maps.hpp | 23 ++++
sandbox/itl/libs/itl/doc/concepts.qbk | 215 ++++++++++++++++++++----------------
sandbox/itl/libs/itl/doc/itl.qbk | 10
sandbox/itl/libs/itl/doc/semantics.qbk | 6
sandbox/itl/libs/itl/test/test_laws.hpp | 229 ++++++++++++++++++++++++++++++++-------
sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map_shared.cpp | 96 +++++++++++++---
sandbox/itl/libs/itl/test/test_quantifier_map_shared.hpp | 95 ++++++++++++++++
7 files changed, 508 insertions(+), 166 deletions(-)
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-30 03:57:15 EST (Fri, 30 Jan 2009)
@@ -206,6 +206,29 @@
return Interval_Set::is_element_equal(left, right);
}
+//-----------------------------------------------------------------------------
+// is_protonic_equal
+//-----------------------------------------------------------------------------
+template
+<
+ 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, class, class,
+ ITL_COMPARE, ITL_COMBINE, ITL_SECTION, template<class,ITL_COMPARE>class, ITL_ALLOC
+ >
+ class IntervalMap
+>
+bool is_protonic_equal
+(
+ const IntervalMap <DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& left,
+ const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& right
+)
+{
+ return Map::lexicographical_protonic_equal(left, right);
+}
+
//-----------------------------------------------------------------------------
// is_disjoint
Modified: sandbox/itl/libs/itl/doc/concepts.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/concepts.qbk (original)
+++ sandbox/itl/libs/itl/doc/concepts.qbk 2009-01-30 03:57:15 EST (Fri, 30 Jan 2009)
@@ -240,15 +240,6 @@
The existence of a ['*neutral element*] wrt. an `operator+=` is a requirement
for template type `CodomainT`.
-[/ table
-[[Trait][]]
-[[__absorber__][Value pairs that carry neutrons `(x,0)` are never stored]]
-[[__enricher__][Value pairs that carry neutrons `(x,0)` are never deleted by subtract]]
-[[__emitter__] [All value pairs that don't carry protons are mapped to neutrons as a default.
- But those neutrons are not stored in the map.]]
-[[__polluter__][All value pairs that don't carry protons are mapped to neutrons as a default.
- In addition, associated neutrons that emerge from aggregations are stored.]]
-]
Note, that a neutron is defined in relation to a combiner operation.
[/ In most cases
@@ -290,124 +281,154 @@
maps can be *partial* or *total* on the set of values given by
domain type `DomainT`.
-* A ['*partial*] map in only defined on those key elements that have been
-inserted into the Map. This is usually expected and so ['*partial definedness]
+* A ['*partial*] map is only defined on those key elements that have been
+inserted into the Map. This is usually expected and so ['*partial definedness*]
is the default.
* Alternatively an itl Map can be ['*total*]. It is then considered to
contain a ['*neutral value*] for all key values that are not
stored in the map.
-Such a total map can be useful if we use it to count or quantify the
-key values. An item that is not counted can be represented as counted
-0-times. A totally defined itl Map can be viewed as a very large or even
-infinite vector.
-
-The second trait is related to the representation of `neutrons` in
-the map. An itl map can be a neutron absorber or a neutron enricher.
+The ['*second trait*] is related to the representation of `neutrons` in
+the map. An itl map can be a ['*neutron absorber*] or a ['*neutron enricher*].
-* A neutron absorber never stores value pairs `(k,0)` that carry neutrons.
-* A neutron enricher stores value pairs `(k,0)`.
+* A ['*neutron absorber*] never stores value pairs `(k,0)` that carry neutrons.
+* A ['*neutron enricher*] stores value pairs `(k,0)`.
For the template parameter `Traits` of itl Maps we have the following
four values.
[table
-[[] [neutron absorber][neutron enricher]]
-[[partial][partial_absorber][partial_enricher]]
-[[total] [total_absorber] [total_enricher]]
-]
+[[] [neutron absorber] [neutron enricher]]
+[[partial][partial_absorber /(default)/][partial_enricher]]
+[[total] [total_absorber] [total_enricher]]
+]
+
+[h4 Map Traits motivated]
+
+Map traits are a late extension to the *itl*. Interval maps have
+been used for a couple of years
+in a variety of applications at Cortex Software GmbH
+with an implementaion that resembled the default trait.
+Only the deeper analysis of the itl's ['*aggregating Map's
+concept*] in the course of preparation of the library for boost
+led to the introduction of map Trais.
+
+[h5 Add-Subtract Antinomy in Aggregating Maps]
+
+Constitutional for the absorber/enricher propery is a little
+antinomie.
+
+We can insert value pairs to the map by ['*adding*] them to the map
+via operations `add, +=` or `+`:
+``{} + {(k,1)} == {(k,1)} // addition``
+
+Further addition on common keys triggers aggregation:
+``{(k,1)} + {(k,1)} == {(k,2)} // aggregation for common key k``
+
+A subtraction of existing pairs
+``{(k,2)} - {(k,2)} == {(k,0)} // aggregation for common key k``
+yields value pairs that are associated with 0-values or `neutrons`.
+
+So once a value pair is created for a key `k` it can not be
+removed from the map via subtraction (`subtract, -=` or `-`).
+
+The very basic fact on sets, that we can remove what we have
+previously added
+``x - x = {}``
+does not apply.
+
+This is the motivation for the ['*neutron absorber*] Trait.
+A neutron absorber map handles value pairs that carry
+neutrons as ['*non-existent*], which saves the law:
+``x - x = {}``
+
+Yet this introduces a new problem: With such a /neutron absorber/
+we are /by definition/ unable to store a value `(k,0)` in
+the map. This may be unfavorable because it is not inline with the
+behavior of stl::maps and this is not necessarily expected by clients
+of the library.
+
+[/ CL On the other hand, the notion of a neutron absorbing map
+is more than just an akademic rescue effort for a formal law.
+It turns out that absorber maps have desirable properties
+for aggregation computations (see section semantics)
+that proved to be useful in practice and are in many cases
+just what is needed.]
+
+The solution to the problem is the introduction of the
+neutron enricher Trait, so the user can choose a map variant
+according to her needs.
+
+[h5 Partial and Total Maps]
+
+The idea of a neutron absorbing map is
+that an ['*associated neutron*] value of a pair `(k,0)`
+['*codes non-existence*] for it's key `k`.
+So the pair `(k,0)` immediately tunnels from
+a map where it may emerge into the realm
+of non existence.
+``{(k,0)} == {}``
+
+If neutrons do not code ['*non-existence*] but
+['*existence with null quantification*],
+we can also think of a map
+that has an associated neutron value
+['*for every*] key `k` that has no associated value
+different from 0.
+So in contrast to modelling *all* neutronic
+value pairs `(k,0)` as being ['*non-existent*]
+we can model *all* neutronic value pairs `(k,0)` as being
+['*implicitly existent*].
+
+
+A map that is modelled in this way, is one large vector with
+a value `v` for every key `k` of it's domain type `DomainT`.
+But only protonic value are actually stored.
+This is the motivation for the definedness-Trait on `itl Maps`.
+
+A ['*partial*] map models the intuitive view that only value
+pairs are existent, that are stored in the map.
+A ['*total*] map exploits the possibility that all
+value pairs that are not stored can be considered
+as being existent and ['*quantified*] with the neutron value.
+
+[/ Alle vier traits sind varianten eines denkmodells das
+um die handhabung von neutronen kreist.]
+
+[/
+partial existential view
+total quantifying view
+]
-[h4 Partial Neutron Absorber]
+[h4 Pragmatical Aspects of Map Traits]
From a pragmatic perspective value pairs that carry `neutrons` as
-mapped values can often be deleted. If we count, for instance,
+mapped values can often be ignored.
+If we count, for instance,
the number of overlaps of inserted intervals in an __itv_map__
(see example [link boost_itl.examples.overlap_counter overlap counter]),
most of the time, we are not
interested in whether an overlap has been counted `0` times or
-has not been counted at all.
-
-A Map that does never insert
-associated neutrons or deletes them when they emerge, is called
-neutron absorber. A partial neutron absorber (short __absorber__)
-is the default setting
-for the Trait parameter. A __absorber__ is able
-to erase a pair `(k,v)` from a map `{(k,v)}` by calling
-`subtract((k,v))` or `operator - ` .
-
-``{(k,v)} - (k,v) == {}``
-
-
-[h4 Partial Neutron Enricher]
-
-With a neutron enricher,
-on the contrary, subtraction of a
-pair `(k,v)` that is in the map results in a pair `(k,0)`.
-
-``{(k,v)} - (k,v) == {(k,0)}``
+has not been counted at all. A neutron enricher map
+is only needed, if we want to distinct between non-existence
+and 0-quantification.
-Mapping pairs that carry
-`neutrons` may emerge as a result of additions or aggregations
-and they can not be erased by subtractions, so they are
-/enriched/ in the map.
-
-A neutron enricher carries the information, if values have
-been added or aggregated for certain keys and resulted in a `neutron`
-value or if they have not been aggregated at all: No values
-exists for a key.
-
-The following distinction can *not* be made for a __absorber__ map
-but it can be made for an __enricher__ map:
+The following distinction can *not* be made for a __pabsorber__ map
+but it can be made for an __penricher__ map:
[pre
(k,v) does not exist in the map: Pair (k,v) has NOT been dealt with
-(k,0) key k carries 0 : Pair (k,v) has been dealt with resulting in y=0
+(k,0) key k carries 0 : Pair (k,v) has been dealt with resulting in v=0
]
-Sometimes this subtle distiction is needed. Then a __enricher__
+Sometimes this subtle distiction is needed. Then a __penricher__
is the right choice. Also, If we want to give two `itl::Maps`
a common set of keys in order to, say, iterate synchronously
over both maps, we need __enrichers__.
-[h4 Total Neutron Absorber]
-
-The third neutronic Trait is a total map that does not
-store value pairs with associated neutrons `(k,0)`.
-It is called total neutron absorber (short __emitter__).
-A map that is a __emitter__ is defined on every value
-of it's domain. It provides a
-neutron value for every key value, that has not been set or
-aggregated to a value unequal to the `neutron` value.
-
-That way a __emitter__ map is a ['*large*] or
-theoretically ['*infinite vector*], that
-is always initialized with neutron values.
-
-Of course those initial neutronic values for all keys of the
-maps domain are *not* stored on the __emitter__ map. So it's
-implementation is as minimal as the implementation of an
-__absorber__.
-
-[h4 Neutron Polluter]
-
-A __polluter__ combines the characteristics of a __emitter__
-and a __enticher__. Value pairs, that emerged due to aggregations
-and carry `neutron` values are actually stored. All value pairs,
-that are not represented carry `neutrons` via default but are not stored.
-
-The traits for itl Maps can be summarized as follows
-
-[table
-[[] [] [absorbs neutrons] []]
-[[] [] [true] [false]]
-[[[*emits neutrons]][false] [__absorber__] [__enricher__]]
-[[] [true] [__emitter__] [__polluter__]]
-]
-
-
-[endsect] [/ kind of nuclear]
+[endsect] [/ Map Traits]
[endsect][/ Concepts]
Modified: sandbox/itl/libs/itl/doc/itl.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/itl.qbk (original)
+++ sandbox/itl/libs/itl/doc/itl.qbk 2009-01-30 03:57:15 EST (Fri, 30 Jan 2009)
@@ -82,11 +82,11 @@
[def __itl_map__ [classref boost::itl::map itl::map]]
[def __itl_maps__ [classref boost::itl::map itl::maps]]
-[def __absorber__ [classref boost::itl::partial_absorber partial_absorber]]
-[def __enricher__ [classref boost::itl::partial_enricher partial_enricher]]
-[def __enrichers__ [classref boost::itl::partial_enricher partial_enrichers]]
-[def __emitter__ [classref boost::itl::total_absorber total_absorber]]
-[def __polluter__ [classref boost::itl::total_absorber total_enricher]]
+[def __pabsorber__ [classref boost::itl::partial_absorber partial_absorber]]
+[def __penricher__ [classref boost::itl::partial_enricher partial_enricher]]
+[def __penrichers__ [classref boost::itl::partial_enricher partial_enrichers]]
+[def __tabsorber__ [classref boost::itl::total_absorber total_absorber]]
+[def __tenricher__ [classref boost::itl::total_absorber total_enricher]]
[def __itv_bse_set__ [classref boost::itl::interval_base_set interval_base_set]]
[def __e [link element_type *e*]]
Modified: sandbox/itl/libs/itl/doc/semantics.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/semantics.qbk (original)
+++ sandbox/itl/libs/itl/doc/semantics.qbk 2009-01-30 03:57:15 EST (Fri, 30 Jan 2009)
@@ -422,7 +422,7 @@
laws that are validated for all `Collector` types `C`. Which are
__itl_map__`<D,S,T>`, __itv_map__`<D,S,T>` and __spl_itv_map__`<D,S,T>`
where `CodomainT` type `S` is a model of `Set` and `Trait` type `T` is either
-__absorber__ or __enricher__.
+__pabsorber__ or __penricher__.
[h5 Laws on set union, set intersection and set difference]
@@ -549,8 +549,8 @@
To create an infinite vector
that is totally defined on it's domain we can set
-the map's `Trait` parameter to the value __emitter__.
-The __emitter__ trait fits specifically well with
+the map's `Trait` parameter to the value __tabsorber__.
+The __tabsorber__ trait fits specifically well with
a `Quantifier` if it's `CodomainT` has an inverse
element, like all signed numerical type have.
Modified: sandbox/itl/libs/itl/test/test_laws.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_laws.hpp (original)
+++ sandbox/itl/libs/itl/test/test_laws.hpp 2009-01-30 03:57:15 EST (Fri, 30 Jan 2009)
@@ -133,6 +133,7 @@
BOOST_CHECK_EQUAL(left,right); \
}
+#define CHECK_COMMUTATIVITY_WRT_EQUAL(op_tag) check_commutativity_wrt_equal_##op_tag
#define CHECK_COMMUTATIVITY_WRT(op_tag) check_commutativity_wrt_##op_tag
DEFINE_COMMUTATIVITY_CHECK_WRT (plus, + );
@@ -145,12 +146,42 @@
DEFINE_COMMUTATIVITY_CHECK_WRT_EQUAL(caret, ^ );
//------------------------------------------------------------------------------
-// InplaceNaturalInversion
+// Natural inversion
//------------------------------------------------------------------------------
-#define DEFINE_INVERSION_CHECK_WRT_EQUAL(plus_tag, plus_sign) \
+#define DEFINE_PARTIAL_INVERSION_CHECK_WRT_EQUAL(plus_tag, plus_sign) \
template<class Type> \
- void check_inversion_wrt_equal_##plus_tag \
+ void check_partial_inversion_wrt_equal_##plus_tag \
+(typename equality<Type>::type* equal, const Type& neutron, const Type& var_a) \
+{ \
+ Type positive_difference = var_a - var_a; \
+ BOOST_CHECK_EQUAL((*equal)(positive_difference, neutron), true); \
+}
+
+#define DEFINE_PARTIAL_INVERSION_CHECK_WRT(plus_tag, plus_sign) \
+template<class Type> \
+ void check_partial_inversion_wrt_##plus_tag \
+(const Type& neutron, const Type& var_a) \
+{ \
+ Type positive_difference = var_a - var_a; \
+ BOOST_CHECK_EQUAL(positive_difference, neutron); \
+}
+
+#define CHECK_PARTIAL_INVERSION_WRT_EQUAL(plus_tag) check_partial_inversion_wrt_equal_##plus_tag
+#define CHECK_PARTIAL_INVERSION_WRT(plus_tag) check_partial_inversion_wrt_##plus_tag
+
+DEFINE_PARTIAL_INVERSION_CHECK_WRT (plus, + );
+DEFINE_PARTIAL_INVERSION_CHECK_WRT_EQUAL(plus, + );
+DEFINE_PARTIAL_INVERSION_CHECK_WRT (pipe, | );
+DEFINE_PARTIAL_INVERSION_CHECK_WRT_EQUAL(pipe, | );
+
+//------------------------------------------------------------------------------
+// Inverse
+//------------------------------------------------------------------------------
+
+#define DEFINE_INVERSE_CHECK_WRT_EQUAL(plus_tag, plus_sign) \
+template<class Type> \
+ void check_inverse_wrt_equal_##plus_tag \
(typename equality<Type>::type* equal, const Type& neutron, const Type& var_a) \
{ \
Type positive_difference = var_a - var_a; \
@@ -159,9 +190,9 @@
BOOST_CHECK_EQUAL((*equal)(negative_difference, neutron), true); \
}
-#define DEFINE_INVERSION_CHECK_WRT(plus_tag, plus_sign) \
+#define DEFINE_INVERSE_CHECK_WRT(plus_tag, plus_sign) \
template<class Type> \
- void check_inversion_wrt_##plus_tag \
+ void check_inverse_wrt_##plus_tag \
(const Type& neutron, const Type& var_a) \
{ \
Type positive_difference = var_a - var_a; \
@@ -170,12 +201,13 @@
BOOST_CHECK_EQUAL(negative_difference, neutron); \
}
-#define CHECK_INVERSION_WRT(plus_tag) check_inversion_wrt_##plus_tag
+#define CHECK_INVERSE_WRT_EQUAL(plus_tag) check_inverse_wrt_equal_##plus_tag
+#define CHECK_INVERSE_WRT(plus_tag) check_inverse_wrt_##plus_tag
-DEFINE_INVERSION_CHECK_WRT (plus, + );
-DEFINE_INVERSION_CHECK_WRT_EQUAL(plus, + );
-DEFINE_INVERSION_CHECK_WRT (pipe, | );
-DEFINE_INVERSION_CHECK_WRT_EQUAL(pipe, | );
+DEFINE_INVERSE_CHECK_WRT (plus, + );
+DEFINE_INVERSE_CHECK_WRT_EQUAL(plus, + );
+DEFINE_INVERSE_CHECK_WRT (pipe, | );
+DEFINE_INVERSE_CHECK_WRT_EQUAL(pipe, | );
//------------------------------------------------------------------------------
// Monodid EAN
@@ -216,7 +248,6 @@
//------------------------------------------------------------------------------
// Commutative or Abelian monodid EANC
//------------------------------------------------------------------------------
-
#define DEFINE_ABELIAN_MONOID_CHECK_WRT_EQUAL(op_tag) \
template<class Type, class TypeB, class TypeC> \
void check_abelian_monoid_wrt_equal_##op_tag \
@@ -225,8 +256,8 @@
{ \
CHECK_ASSOCIATIVITY_WRT_EQUAL(op_tag)(equal,a,b,c); \
CHECK_NEUTRALITY_WRT_EQUAL(op_tag)(equal,a,neutron); \
- CHECK_COMMUTATIVITY_WRT_EQUAL(op_tag)(a,b); \
- CHECK_COMMUTATIVITY_WRT_EQUAL(op_tag)(a,c); \
+ CHECK_COMMUTATIVITY_WRT_EQUAL(op_tag)(equal,a,b); \
+ CHECK_COMMUTATIVITY_WRT_EQUAL(op_tag)(equal,a,c); \
}
#define DEFINE_ABELIAN_MONOID_CHECK_WRT(op_tag) \
@@ -254,6 +285,41 @@
#define CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag) check_abelian_monoid_wrt_equal_##op_tag
//------------------------------------------------------------------------------
+// Abelian monodid EANC with partial inversion
+//------------------------------------------------------------------------------
+#define DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT_EQUAL(op_tag) \
+template<class Type, class TypeB, class TypeC> \
+void check_partial_invertive_monoid_wrt_equal_##op_tag \
+(typename equality<Type>::type* equal, const Type& neutron, \
+const Type& a, const TypeB& b, const TypeC& c) \
+{ \
+ CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(equal,neutron,a,b,c); \
+ CHECK_PARTIAL_INVERSION_WRT_EQUAL(op_tag)(equal,neutron,a); \
+}
+
+#define DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT(op_tag) \
+template<class Type, class TypeB, class TypeC> \
+void check_partial_invertive_monoid_wrt_##op_tag \
+(typename const Type& neutron, \
+const Type& a, const TypeB& b, const TypeC& c) \
+{ \
+ CHECK_ABELIAN_MONOID_WRT(op_tag)(neutron,a,b,c); \
+ CHECK_PARTIAL_INVERSION_WRT(op_tag)(neutron,a); \
+}
+
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT(plus);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT_EQUAL(plus);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT(pipe);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT_EQUAL(pipe);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT(et);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT_EQUAL(et);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT(caret);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_WRT_EQUAL(caret);
+
+#define CHECK_PARTIAL_INVERTIVE_MONOID_WRT(op_tag) check_partial_invertive_monoid_wrt_##op_tag
+#define CHECK_PARTIAL_INVERTIVE_MONOID_WRT_EQUAL(op_tag) check_partial_invertive_monoid_wrt_equal_##op_tag
+
+//------------------------------------------------------------------------------
// Abelian group EANIC
//------------------------------------------------------------------------------
@@ -264,7 +330,7 @@
const Type& a, const TypeB& b, const TypeC& c) \
{ \
CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(equal,neutron,a,b,c); \
- CHECK_INVERSION_WRT_EQUAL(op_tag)(equal,neutron,a); \
+ CHECK_INVERSE_WRT_EQUAL(op_tag)(equal,neutron,a); \
}
#define DEFINE_ABELIAN_GROUP_CHECK_WRT(op_tag) \
@@ -274,7 +340,7 @@
const Type& a, const TypeB& b, const TypeC& c) \
{ \
CHECK_ABELIAN_MONOID_WRT(op_tag)(neutron,a,b,c); \
- CHECK_INVERSION_WRT(op_tag)(neutron,a); \
+ CHECK_INVERSE_WRT(op_tag)(neutron,a); \
}
@@ -293,12 +359,12 @@
#define DEFINE_MONOID_CHECK_PERMUTED_WRT_EQUAL(op_tag) \
template<class TypeA, class TypeB, class Assoc> \
void check_monoid_permuted_wrt_equal_##op_tag \
-(const TypeA& var_a, const TypeB& var_b, const Assoc& assoc) \
+(typename equality<TypeA>::type* equal, const TypeA& var_a, const TypeB& var_b, const Assoc& assoc) \
{ \
- CHECK_MONOID_WRT_EQUAL(op_tag)(neutron<TypeA>::value(), var_a, var_b, assoc);\
- CHECK_MONOID_WRT_EQUAL(op_tag)(neutron<TypeA>::value(), var_a, assoc, var_b);\
- CHECK_MONOID_WRT_EQUAL(op_tag)(neutron<TypeB>::value(), var_b, var_a, assoc);\
- CHECK_MONOID_WRT_EQUAL(op_tag)(neutron<TypeB>::value(), var_b, assoc, var_a);\
+ CHECK_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeA>::value(), var_a, var_b, assoc);\
+ CHECK_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeA>::value(), var_a, assoc, var_b);\
+ CHECK_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeB>::value(), var_b, var_a, assoc);\
+ CHECK_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeB>::value(), var_b, assoc, var_a);\
}
#define DEFINE_MONOID_CHECK_PERMUTED_WRT(op_tag) \
@@ -333,12 +399,12 @@
#define DEFINE_ABELIAN_MONOID_CHECK_PERMUTED_WRT_EQUAL(op_tag) \
template<class TypeA, class TypeB, class Assoc> \
void check_abelian_monoid_permuted_wrt_equal_##op_tag \
-(const TypeA& var_a, const TypeB& var_b, const Assoc& assoc) \
+(typename equality<TypeA>::type* equal, const TypeA& var_a, const TypeB& var_b, const Assoc& assoc) \
{ \
- CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(neutron<TypeA>::value(), var_a, var_b, assoc);\
- CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(neutron<TypeA>::value(), var_a, assoc, var_b);\
- CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(neutron<TypeB>::value(), var_b, var_a, assoc);\
- CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(neutron<TypeB>::value(), var_b, assoc, var_a);\
+ CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeA>::value(), var_a, var_b, assoc);\
+ CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeA>::value(), var_a, assoc, var_b);\
+ CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeB>::value(), var_b, var_a, assoc);\
+ CHECK_ABELIAN_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeB>::value(), var_b, assoc, var_a);\
}
#define DEFINE_ABELIAN_MONOID_CHECK_PERMUTED_WRT(op_tag) \
@@ -367,18 +433,58 @@
//------------------------------------------------------------------------------
+// Abelian modoid with partial inversion permuted
+//------------------------------------------------------------------------------
+
+#define DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT_EQUAL(op_tag) \
+template<class TypeA, class TypeB, class Assoc> \
+void check_partial_invertive_monoid_permuted_wrt_equal_##op_tag \
+(typename equality<TypeA>::type* equal, const TypeA& var_a, const TypeB& var_b, const Assoc& assoc) \
+{ \
+ CHECK_PARTIAL_INVERTIVE_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeA>::value(), var_a, var_b, assoc);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeA>::value(), var_a, assoc, var_b);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeB>::value(), var_b, var_a, assoc);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_WRT_EQUAL(op_tag)(equal, neutron<TypeB>::value(), var_b, assoc, var_a);\
+}
+
+#define DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT(op_tag) \
+template<class TypeA, class TypeB, class Assoc> \
+void check_partial_invertive_monoid_permuted_wrt_##op_tag \
+(const TypeA& var_a, const TypeB& var_b, const Assoc& assoc) \
+{ \
+ CHECK_PARTIAL_INVERTIVE_MONOID_WRT(op_tag)(neutron<TypeA>::value(), var_a, var_b, assoc);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_WRT(op_tag)(neutron<TypeA>::value(), var_a, assoc, var_b);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_WRT(op_tag)(neutron<TypeB>::value(), var_b, var_a, assoc);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_WRT(op_tag)(neutron<TypeB>::value(), var_b, assoc, var_a);\
+}
+
+
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT(plus);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT_EQUAL(plus);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT(pipe);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT_EQUAL(pipe);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT(et);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT_EQUAL(et);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT(caret);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_PERMUTED_WRT_EQUAL(caret);
+
+#define CHECK_PARTIAL_INVERTIVE_MONOID_PERMUTED_WRT(op_tag) check_partial_invertive_monoid_permuted_wrt_##op_tag
+#define CHECK_PARTIAL_INVERTIVE_MONOID_PERMUTED_WRT_EQUAL(op_tag) check_partial_invertive_monoid_permuted_wrt_equal_##op_tag
+
+
+//------------------------------------------------------------------------------
// Abelian group permuted
//------------------------------------------------------------------------------
#define DEFINE_ABELIAN_GROUP_CHECK_PERMUTED_WRT_EQUAL(op_tag) \
template<class TypeA, class TypeB, class Assoc> \
void check_abelian_group_permuted_wrt_equal_##op_tag \
-(const TypeA& var_a, const TypeB& var_b, const Assoc& assoc) \
+(typename equality<TypeA>::type* equal, const TypeA& var_a, const TypeB& var_b, const Assoc& assoc) \
{ \
- CHECK_ABELIAN_GROUP_WRT_EQUAL(op_tag)(neutron<TypeA>::value(), var_a, var_b, assoc);\
- CHECK_ABELIAN_GROUP_WRT_EQUAL(op_tag)(neutron<TypeA>::value(), var_a, assoc, var_b);\
- CHECK_ABELIAN_GROUP_WRT_EQUAL(op_tag)(neutron<TypeB>::value(), var_b, var_a, assoc);\
- CHECK_ABELIAN_GROUP_WRT_EQUAL(op_tag)(neutron<TypeB>::value(), var_b, assoc, var_a);\
+ CHECK_ABELIAN_GROUP_WRT_EQUAL(op_tag)(equal, neutron<TypeA>::value(), var_a, var_b, assoc);\
+ CHECK_ABELIAN_GROUP_WRT_EQUAL(op_tag)(equal, neutron<TypeA>::value(), var_a, assoc, var_b);\
+ CHECK_ABELIAN_GROUP_WRT_EQUAL(op_tag)(equal, neutron<TypeB>::value(), var_b, var_a, assoc);\
+ CHECK_ABELIAN_GROUP_WRT_EQUAL(op_tag)(equal, neutron<TypeB>::value(), var_b, assoc, var_a);\
}
#define DEFINE_ABELIAN_GROUP_CHECK_PERMUTED_WRT(op_tag) \
@@ -409,12 +515,12 @@
#define DEFINE_MONOID_CHECK_INSTANCE_WRT_EQUAL(op_tag) \
template<class TypeA, class TypeB, class TypeC, class AssocA, class AssocB> \
void check_monoid_instance_wrt_equal_##op_tag \
-(const TypeA& var_a, const TypeB& var_b, const TypeC& var_c, \
+(typename equality<TypeA>::type* equal, const TypeA& var_a, const TypeB& var_b, const TypeC& var_c, \
const AssocA& ass_a, const AssocB& ass_b) \
{ \
- CHECK_MONOID_PERMUTED_WRT_EQUAL(op_tag)(var_a, var_b, var_c);\
- CHECK_MONOID_PERMUTED_WRT_EQUAL(op_tag)(var_a, var_b, ass_a);\
- CHECK_MONOID_PERMUTED_WRT_EQUAL(op_tag)(var_a, var_b, ass_b);\
+ CHECK_MONOID_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, var_c);\
+ CHECK_MONOID_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, ass_a);\
+ CHECK_MONOID_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, ass_b);\
}
#define DEFINE_MONOID_CHECK_INSTANCE_WRT(op_tag) \
@@ -449,12 +555,12 @@
#define DEFINE_ABELIAN_MONOID_CHECK_INSTANCE_WRT_EQUAL(op_tag) \
template<class TypeA, class TypeB, class TypeC, class AssocA, class AssocB> \
void check_abelian_monoid_instance_wrt_equal_##op_tag \
-(const TypeA& var_a, const TypeB& var_b, const TypeC& var_c, \
+(typename equality<TypeA>::type* equal, const TypeA& var_a, const TypeB& var_b, const TypeC& var_c, \
const AssocA& ass_a, const AssocB& ass_b) \
{ \
- CHECK_ABELIAN_MONOID_PERMUTED_WRT_EQUAL(op_tag)(var_a, var_b, var_c);\
- CHECK_ABELIAN_MONOID_PERMUTED_WRT_EQUAL(op_tag)(var_a, var_b, ass_a);\
- CHECK_ABELIAN_MONOID_PERMUTED_WRT_EQUAL(op_tag)(var_a, var_b, ass_b);\
+ CHECK_ABELIAN_MONOID_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, var_c);\
+ CHECK_ABELIAN_MONOID_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, ass_a);\
+ CHECK_ABELIAN_MONOID_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, ass_b);\
}
#define DEFINE_ABELIAN_MONOID_CHECK_INSTANCE_WRT(op_tag) \
@@ -482,18 +588,57 @@
//------------------------------------------------------------------------------
+// Abelian partial invertive modoid instance
+//------------------------------------------------------------------------------
+
+#define DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT_EQUAL(op_tag) \
+template<class TypeA, class TypeB, class TypeC, class AssocA, class AssocB> \
+void check_partial_invertive_monoid_instance_wrt_equal_##op_tag \
+(typename equality<TypeA>::type* equal, const TypeA& var_a, const TypeB& var_b, const TypeC& var_c, \
+ const AssocA& ass_a, const AssocB& ass_b) \
+{ \
+ CHECK_PARTIAL_INVERTIVE_MONOID_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, var_c);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, ass_a);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, ass_b);\
+}
+
+#define DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT(op_tag) \
+template<class TypeA, class TypeB, class TypeC, class AssocA, class AssocB> \
+void check_partial_invertive_monoid_instance_wrt_##op_tag \
+(const TypeA& var_a, const TypeB& var_b, const TypeC& var_c, \
+ const AssocA& ass_a, const AssocB& ass_b) \
+{ \
+ CHECK_PARTIAL_INVERTIVE_MONOID_PERMUTED_WRT(op_tag)(var_a, var_b, var_c);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_PERMUTED_WRT(op_tag)(var_a, var_b, ass_a);\
+ CHECK_PARTIAL_INVERTIVE_MONOID_PERMUTED_WRT(op_tag)(var_a, var_b, ass_b);\
+}
+
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT(plus);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT_EQUAL(plus);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT(pipe);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT_EQUAL(pipe);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT(et);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT_EQUAL(et);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT(caret);
+DEFINE_PARTIAL_INVERTIVE_MONOID_CHECK_INSTANCE_WRT_EQUAL(caret);
+
+#define CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(op_tag) check_partial_invertive_monoid_instance_wrt_##op_tag
+#define CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(op_tag) check_partial_invertive_monoid_instance_wrt_equal_##op_tag
+
+
+//------------------------------------------------------------------------------
// Abelian group instance
//------------------------------------------------------------------------------
#define DEFINE_ABELIAN_GROUP_CHECK_INSTANCE_WRT_EQUAL(op_tag) \
template<class TypeA, class TypeB, class TypeC, class AssocA, class AssocB> \
void check_abelian_group_instance_wrt_equal_##op_tag \
-(const TypeA& var_a, const TypeB& var_b, const TypeC& var_c, \
+(typename equality<TypeA>::type* equal, const TypeA& var_a, const TypeB& var_b, const TypeC& var_c, \
const AssocA& ass_a, const AssocB& ass_b) \
{ \
- CHECK_ABELIAN_GROUP_PERMUTED_WRT_EQUAL(op_tag)(var_a, var_b, var_c);\
- CHECK_ABELIAN_GROUP_PERMUTED_WRT_EQUAL(op_tag)(var_a, var_b, ass_a);\
- CHECK_ABELIAN_GROUP_PERMUTED_WRT_EQUAL(op_tag)(var_a, var_b, ass_b);\
+ CHECK_ABELIAN_GROUP_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, var_c);\
+ CHECK_ABELIAN_GROUP_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, ass_a);\
+ CHECK_ABELIAN_GROUP_PERMUTED_WRT_EQUAL(op_tag)(equal, var_a, var_b, ass_b);\
}
#define DEFINE_ABELIAN_GROUP_CHECK_INSTANCE_WRT(op_tag) \
Modified: sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map_shared.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map_shared.cpp (original)
+++ sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map_shared.cpp 2009-01-30 03:57:15 EST (Fri, 30 Jan 2009)
@@ -10,42 +10,102 @@
// partial_absorber
//------------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_quantifier_map_check_monoid_plus_4_bicremental_types, T, bicremental_types)
-{ quantifier_map_check_monoid_plus_4_bicremental_types<T, std::string, partial_absorber, interval_map>();}
+(test_itl_partial_quantifier_map_check_monoid_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_monoid_plus_4_bicremental_types<T, std::string, partial_absorber, interval_map>();}
BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_quantifier_map_check_monoid_et_4_bicremental_types, T, bicremental_types)
-{ quantifier_map_check_monoid_et_4_bicremental_types<T, int, partial_absorber, interval_map>();}
+(test_itl_partial_quantifier_map_check_monoid_et_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_monoid_et_4_bicremental_types<T, int, partial_absorber, interval_map>();}
BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_quantifier_map_check_abelian_monoid_plus_4_bicremental_types, T, bicremental_types)
-{ quantifier_map_check_abelian_monoid_plus_4_bicremental_types<T, std::string, partial_absorber, interval_map>();}
+(test_itl_partial_quantifier_map_check_abelian_monoid_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_monoid_plus_4_bicremental_types<T, std::string, partial_absorber, interval_map>();}
BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_quantifier_map_check_abelian_monoid_et_4_bicremental_types, T, bicremental_types)
-{ quantifier_map_check_abelian_monoid_et_4_bicremental_types<T, int, partial_absorber, interval_map>();}
+(test_itl_partial_quantifier_map_check_abelian_monoid_et_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_monoid_et_4_bicremental_types<T, int, partial_absorber, interval_map>();}
+
+// x - x = 0 | partial absorber
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_partial_quantifier_map_check_partial_invertive_monoid_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_partial_invertive_monoid_plus_4_bicremental_types<T, int, partial_absorber, interval_map>();}
//------------------------------------------------------------------------------
// total_absorber
//------------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_quantifier_map_check_monoid_plus_4_bicremental_types_ta, T, bicremental_types)
-{ quantifier_map_check_monoid_plus_4_bicremental_types<T, std::string, total_absorber, interval_map>();}
+(test_itl_total_quantifier_map_check_monoid_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_monoid_plus_4_bicremental_types<T, std::string, total_absorber, interval_map>();}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_total_quantifier_map_check_monoid_et_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_monoid_et_4_bicremental_types<T, int, total_absorber, interval_map>();}
BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_quantifier_map_check_monoid_et_4_bicremental_types_ta, T, bicremental_types)
-{ quantifier_map_check_monoid_et_4_bicremental_types<T, int, total_absorber, interval_map>();}
+(test_itl_total_quantifier_map_check_abelian_monoid_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_monoid_plus_4_bicremental_types<T, std::string, total_absorber, interval_map>();}
BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_quantifier_map_check_abelian_monoid_plus_4_bicremental_types_ta, T, bicremental_types)
-{ quantifier_map_check_abelian_monoid_plus_4_bicremental_types<T, std::string, total_absorber, interval_map>();}
+(test_itl_total_quantifier_map_check_abelian_monoid_et_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_monoid_et_4_bicremental_types<T, int, total_absorber, interval_map>();}
+// (0-x) + x = 0 | total absorber
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_total_quantifier_map_check_abelian_group_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_group_plus_4_bicremental_types<T, int, total_absorber, interval_map>();}
+
+//------------------------------------------------------------------------------
+// partial_enricher
+//------------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_quantifier_map_check_abelian_monoid_et_4_bicremental_types_ta, T, bicremental_types)
-{ quantifier_map_check_abelian_monoid_et_4_bicremental_types<T, int, total_absorber, interval_map>();}
+(test_itl_partial_enricher_quantifier_map_check_monoid_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_monoid_plus_4_bicremental_types<T, std::string, partial_enricher, interval_map>();}
BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_quantifier_map_check_abelian_group_plus_4_bicremental_types_ta, T, bicremental_types)
-{ quantifier_map_check_abelian_group_plus_4_bicremental_types<T, int, total_absorber, interval_map>();}
+(test_itl_partial_enricher_quantifier_map_check_monoid_et_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_monoid_et_4_bicremental_types<T, int, partial_enricher, interval_map>();}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_partial_enricher_quantifier_map_check_abelian_monoid_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_monoid_plus_4_bicremental_types<T, std::string, partial_enricher, interval_map>();}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_partial_enricher_quantifier_map_check_abelian_monoid_et_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_monoid_et_4_bicremental_types<T, int, partial_enricher, interval_map>();}
+
+// x - x =p= 0 | partial enricher
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_partial_enricher_quantifier_map_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types<T, int, partial_enricher, interval_map>();}
+
+
+//------------------------------------------------------------------------------
+// total_enricher
+//------------------------------------------------------------------------------
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_total_enricher_quantifier_map_check_monoid_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_monoid_plus_4_bicremental_types<T, std::string, total_enricher, interval_map>();}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_total_enricher_quantifier_map_check_monoid_et_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_monoid_et_4_bicremental_types<T, int, total_enricher, interval_map>();}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_total_enricher_quantifier_map_check_abelian_monoid_plus_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_monoid_plus_4_bicremental_types<T, std::string, total_enricher, interval_map>();}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_total_enricher_quantifier_map_check_abelian_monoid_et_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_monoid_et_4_bicremental_types<T, int, total_enricher, interval_map>();}
+
+// (0-x) + x =p= 0 | total absorber
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_total_enricher_quantifier_map_check_abelian_group_plus_prot_inv_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_abelian_group_plus_prot_inv_4_bicremental_types<T, int, total_enricher, interval_map>();}
+
+
+// absorber enricher
+// partial x - x == 0 x - x =p= 0 partiality of subtraction
+// total (-x)+ x == 0 (-x)+ x =p= 0 totality of subtraction
Modified: sandbox/itl/libs/itl/test/test_quantifier_map_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_quantifier_map_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_quantifier_map_shared.hpp 2009-01-30 03:57:15 EST (Fri, 30 Jan 2009)
@@ -124,9 +124,70 @@
//------------------------------------------------------------------------------
-// Abelian group EANIC
+// Abelian partial invertive monoid
//------------------------------------------------------------------------------
+template <class T, class U, class Trt,
+ template<class T, class U,
+ class Traits = Trt,
+ 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
+ >
+void quantifier_map_check_partial_invertive_monoid_plus_4_bicremental_types()
+{
+ typedef IntervalMap<T,U,Trt> IntervalMapT;
+
+ IntervalMapT map_a, map_b, map_c;
+ map_a.add(IDv(3,6,1)).add(IIv(5,7,1));
+ map_b.add(CDv(1,3,1)).add(IDv(8,9,1));
+ map_c.add(IDv(0,9,2)).add(IIv(3,6,1)).add(IDv(5,7,1));
+
+ typename IntervalMapT::interval_mapping_type val_pair = IDv(6,9,1);
+ mapping_pair<T,U> map_pair = K_v(5,1);
+
+ CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, val_pair, map_pair);
+ CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
+}
+//------------------------------------------------------------------------------
+// Abelian partial invertive monoid with protonic equality for inversion
+//------------------------------------------------------------------------------
+template <class T, class U, class Trt,
+ template<class T, class U,
+ class Traits = Trt,
+ 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
+ >
+void quantifier_map_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types()
+{
+ typedef IntervalMap<T,U,Trt> IntervalMapT;
+
+ IntervalMapT map_a, map_b, map_c;
+ map_a.add(IDv(3,6,1)).add(IIv(5,7,1));
+ map_b.add(CDv(1,3,1)).add(IDv(8,9,1));
+ map_c.add(IDv(0,9,2)).add(IIv(3,6,1)).add(IDv(5,7,1));
+
+ typename IntervalMapT::interval_mapping_type val_pair = IDv(6,9,1);
+ mapping_pair<T,U> map_pair = K_v(5,1);
+
+ CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus)(map_a, map_b, map_c, val_pair, map_pair);
+ CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe)(map_a, map_b, map_c, val_pair, map_pair);
+
+ CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(plus)(is_protonic_equal, map_a, map_b, map_c, val_pair, map_pair);
+ CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(pipe)(is_protonic_equal, map_a, map_b, map_c, val_pair, map_pair);
+}
+
+
+//------------------------------------------------------------------------------
+// Abelian group EANIC
+//------------------------------------------------------------------------------
template <class T, class U, class Trt,
template<class T, class U,
class Traits = Trt,
@@ -153,6 +214,38 @@
CHECK_ABELIAN_GROUP_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
}
+//------------------------------------------------------------------------------
+// (0 - x) + x =p= 0 |
+//------------------------------------------------------------------------------
+template <class T, class U, class Trt,
+ template<class T, class U,
+ class Traits = Trt,
+ 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
+ >
+void quantifier_map_check_abelian_group_plus_prot_inv_4_bicremental_types()
+{
+ typedef IntervalMap<T,U,Trt> IntervalMapT;
+
+ IntervalMapT map_a, map_b, map_c;
+ map_a.add(IDv(3,6,1)).add(IIv(5,7,1));
+ map_b.add(CDv(1,3,1)).add(IDv(8,9,1));
+ map_c.add(IDv(0,9,2)).add(IIv(3,6,1)).add(IDv(5,7,1));
+
+ typename IntervalMapT::interval_mapping_type val_pair = IDv(6,9,1);
+ mapping_pair<T,U> map_pair = K_v(5,1);
+
+ CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, val_pair, map_pair);
+ CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
+
+ CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(plus) (is_protonic_equal, map_a, map_b, map_c, val_pair, map_pair);
+ CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(pipe) (is_protonic_equal, map_a, map_b, map_c, val_pair, map_pair);
+}
+
#endif // __test_itl_quantifier_map_shared_h_JOFA_090119__
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