123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- /*-----------------------------------------------------------------------------+
- Copyright (c) 2008-2009: Joachim Faulhaber
- +------------------------------------------------------------------------------+
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENCE.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
- +-----------------------------------------------------------------------------*/
- #ifndef __TEST_INTERVAL_QUANTIFIER_SHARED_H_JOFA_090119__
- #define __TEST_INTERVAL_QUANTIFIER_SHARED_H_JOFA_090119__
- #include "portability.hpp"
-
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void make_3_itv_maps_and_derivatives_1
- (ICL_PORT_msvc_7_1_IntervalMap(T,U,Trt)& itv_map_a,
- ICL_PORT_msvc_7_1_IntervalMap(T,U,Trt)& itv_map_b,
- ICL_PORT_msvc_7_1_IntervalMap(T,U,Trt)& itv_map_c,
- typename ICL_PORT_msvc_7_1_IntervalMap(T,U,Trt)::interval_mapping_type& val_pair,
- mapping_pair<T,U>& map_pair)
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- itv_map_a.add(IDv(3,6,1)).add(IIv(5,7,1));
- itv_map_b.add(CDv(1,3,1)).add(IDv(8,9,1));
- itv_map_c.add(IDv(0,9,2)).add(IIv(3,6,1)).add(IDv(5,7,1));
- val_pair = IDv(6,9,1);
- map_pair = K_v(5,1);
- }
- //------------------------------------------------------------------------------
- // Monoid EAN
- //------------------------------------------------------------------------------
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_monoid_plus_4_bicremental_types()
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- CHECK_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, val_pair, map_pair);
- CHECK_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
- }
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_monoid_et_4_bicremental_types()
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- CHECK_MONOID_INSTANCE_WRT(et) (map_a, map_b, map_c, val_pair, map_pair);
- CHECK_MONOID_INSTANCE_WRT(caret)(map_a, map_b, map_c, val_pair, map_pair);
- }
- //------------------------------------------------------------------------------
- // Abelian monoid EANC
- //------------------------------------------------------------------------------
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_abelian_monoid_plus_4_bicremental_types()
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- 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);
- }
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_abelian_monoid_et_4_bicremental_types()
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- CHECK_ABELIAN_MONOID_INSTANCE_WRT(et) (map_a, map_b, map_c, val_pair, map_pair);
- CHECK_ABELIAN_MONOID_INSTANCE_WRT(caret)(map_a, map_b, map_c, val_pair, map_pair);
- }
- //------------------------------------------------------------------------------
- // Abelian partial invertive monoid
- //------------------------------------------------------------------------------
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_partial_invertive_monoid_plus_4_bicremental_types()
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- 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 distinct equality for inversion
- //------------------------------------------------------------------------------
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types()
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- 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);
- #if !defined(_MSC_VER) || (_MSC_VER >= 1400) // 1310==MSVC-7.1 1400 ==MSVC-8.0
- CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(plus)(is_distinct_equal, map_a, map_b, map_c, val_pair, map_pair);
- CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(pipe)(is_distinct_equal, map_a, map_b, map_c, val_pair, map_pair);
- #endif
- }
- //------------------------------------------------------------------------------
- // Abelian group EANIC
- //------------------------------------------------------------------------------
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_abelian_group_plus_4_bicremental_types()
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- CHECK_ABELIAN_GROUP_INSTANCE_WRT(plus) (map_a, map_b, map_c, val_pair, map_pair);
- CHECK_ABELIAN_GROUP_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
- }
- //------------------------------------------------------------------------------
- // (0 - x) + x =d= 0
- //------------------------------------------------------------------------------
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_abelian_group_plus_prot_inv_4_bicremental_types()
- {
- // check abelian group wrt. + and inverability wrt. distinct equality =d= :
- // (1) (IntervalMapT, +) is an abelian group and
- // (2) The inverability law: (0 - x) + x =d= 0 holds.
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- 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);
- #if !defined(_MSC_VER) || (_MSC_VER >= 1400) // 1310==MSVC-7.1 1400 ==MSVC-8.0
- CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(plus) (is_distinct_equal, map_a, map_b, map_c, val_pair, map_pair);
- CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(pipe) (is_distinct_equal, map_a, map_b, map_c, val_pair, map_pair);
- #endif
- }
- //------------------------------------------------------------------------------
- // Inner complement
- //------------------------------------------------------------------------------
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_inner_complementarity_4_bicremental_types()
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- typedef typename IntervalMap<T,U,Trt>::set_type IntervalSetT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- has_inner_complementarity<IntervalMapT,IntervalSetT>(map_a);
- has_inner_complementarity<IntervalMapT,IntervalSetT>(map_b);
- has_inner_complementarity<IntervalMapT,IntervalSetT>(map_c);
- }
- template
- <
- class T, class U, class Trt,
- #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
- ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
- #else
- ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
- #endif
- >
- void itv_quantifier_check_length_complementarity_4_bicremental_types()
- {
- typedef IntervalMap<T,U,Trt> IntervalMapT;
- typedef typename IntervalMap<T,U,Trt>::set_type IntervalSetT;
- IntervalMapT map_a, map_b, map_c;
- typename IntervalMapT::interval_mapping_type val_pair;
- mapping_pair<T,U> map_pair;
- make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
- has_length_complementarity(map_a);
- has_length_complementarity(map_b);
- has_length_complementarity(map_c);
- has_length_as_distance<IntervalMapT,IntervalSetT>(map_a);
- has_length_as_distance<IntervalMapT,IntervalSetT>(map_b);
- has_length_as_distance<IntervalMapT,IntervalSetT>(map_c);
- }
- #endif // __TEST_INTERVAL_QUANTIFIER_SHARED_H_JOFA_090119__
|