• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*-----------------------------------------------------------------------------+
2 Copyright (c) 2008-2009: Joachim Faulhaber
3 +------------------------------------------------------------------------------+
4    Distributed under the Boost Software License, Version 1.0.
5       (See accompanying file LICENCE.txt or copy at
6            http://www.boost.org/LICENSE_1_0.txt)
7 +-----------------------------------------------------------------------------*/
8 #ifndef __TEST_INTERVAL_QUANTIFIER_SHARED_H_JOFA_090119__
9 #define __TEST_INTERVAL_QUANTIFIER_SHARED_H_JOFA_090119__
10 
11 #include "portability.hpp"
12 
13 template
14 <
15     class T, class U, class Trt,
16 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
17     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
18 #else
19     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
20 #endif
21 >
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)22 void make_3_itv_maps_and_derivatives_1
23                    (ICL_PORT_msvc_7_1_IntervalMap(T,U,Trt)& itv_map_a,
24                     ICL_PORT_msvc_7_1_IntervalMap(T,U,Trt)& itv_map_b,
25                     ICL_PORT_msvc_7_1_IntervalMap(T,U,Trt)& itv_map_c,
26                     typename ICL_PORT_msvc_7_1_IntervalMap(T,U,Trt)::interval_mapping_type& val_pair,
27                     mapping_pair<T,U>& map_pair)
28 {
29     typedef IntervalMap<T,U,Trt> IntervalMapT;
30 
31     itv_map_a.add(IDv(3,6,1)).add(IIv(5,7,1));
32     itv_map_b.add(CDv(1,3,1)).add(IDv(8,9,1));
33     itv_map_c.add(IDv(0,9,2)).add(IIv(3,6,1)).add(IDv(5,7,1));
34 
35     val_pair = IDv(6,9,1);
36     map_pair = K_v(5,1);
37 }
38 
39 
40 //------------------------------------------------------------------------------
41 // Monoid EAN
42 //------------------------------------------------------------------------------
43 template
44 <
45     class T, class U, class Trt,
46 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
47     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
48 #else
49     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
50 #endif
51 >
itv_quantifier_check_monoid_plus_4_bicremental_types()52 void itv_quantifier_check_monoid_plus_4_bicremental_types()
53 {
54     typedef IntervalMap<T,U,Trt> IntervalMapT;
55     IntervalMapT map_a, map_b, map_c;
56     typename IntervalMapT::interval_mapping_type val_pair;
57     mapping_pair<T,U> map_pair;
58     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
59 
60     CHECK_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, val_pair, map_pair);
61     CHECK_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
62 }
63 
64 
65 template
66 <
67     class T, class U, class Trt,
68 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
69     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
70 #else
71     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
72 #endif
73 >
itv_quantifier_check_monoid_et_4_bicremental_types()74 void itv_quantifier_check_monoid_et_4_bicremental_types()
75 {
76     typedef IntervalMap<T,U,Trt> IntervalMapT;
77     IntervalMapT map_a, map_b, map_c;
78     typename IntervalMapT::interval_mapping_type val_pair;
79     mapping_pair<T,U> map_pair;
80     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
81 
82     CHECK_MONOID_INSTANCE_WRT(et)   (map_a, map_b, map_c, val_pair, map_pair);
83     CHECK_MONOID_INSTANCE_WRT(caret)(map_a, map_b, map_c, val_pair, map_pair);
84 }
85 
86 //------------------------------------------------------------------------------
87 // Abelian monoid EANC
88 //------------------------------------------------------------------------------
89 
90 template
91 <
92     class T, class U, class Trt,
93 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
94     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
95 #else
96     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
97 #endif
98 >
itv_quantifier_check_abelian_monoid_plus_4_bicremental_types()99 void itv_quantifier_check_abelian_monoid_plus_4_bicremental_types()
100 {
101     typedef IntervalMap<T,U,Trt> IntervalMapT;
102     IntervalMapT map_a, map_b, map_c;
103     typename IntervalMapT::interval_mapping_type val_pair;
104     mapping_pair<T,U> map_pair;
105     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
106 
107     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, val_pair, map_pair);
108     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
109 }
110 
111 
112 template
113 <
114     class T, class U, class Trt,
115 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
116     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
117 #else
118     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
119 #endif
120 >
itv_quantifier_check_abelian_monoid_et_4_bicremental_types()121 void itv_quantifier_check_abelian_monoid_et_4_bicremental_types()
122 {
123     typedef IntervalMap<T,U,Trt> IntervalMapT;
124     IntervalMapT map_a, map_b, map_c;
125     typename IntervalMapT::interval_mapping_type val_pair;
126     mapping_pair<T,U> map_pair;
127     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
128 
129     CHECK_ABELIAN_MONOID_INSTANCE_WRT(et)   (map_a, map_b, map_c, val_pair, map_pair);
130     CHECK_ABELIAN_MONOID_INSTANCE_WRT(caret)(map_a, map_b, map_c, val_pair, map_pair);
131 }
132 
133 
134 //------------------------------------------------------------------------------
135 // Abelian partial invertive monoid
136 //------------------------------------------------------------------------------
137 template
138 <
139     class T, class U, class Trt,
140 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
141     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
142 #else
143     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
144 #endif
145 >
itv_quantifier_check_partial_invertive_monoid_plus_4_bicremental_types()146 void itv_quantifier_check_partial_invertive_monoid_plus_4_bicremental_types()
147 {
148     typedef IntervalMap<T,U,Trt> IntervalMapT;
149     IntervalMapT map_a, map_b, map_c;
150     typename IntervalMapT::interval_mapping_type val_pair;
151     mapping_pair<T,U> map_pair;
152     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
153 
154     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, val_pair, map_pair);
155     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
156 }
157 
158 //------------------------------------------------------------------------------
159 // Abelian partial invertive monoid with distinct equality for inversion
160 //------------------------------------------------------------------------------
161 template
162 <
163     class T, class U, class Trt,
164 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
165     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
166 #else
167     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
168 #endif
169 >
itv_quantifier_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types()170 void itv_quantifier_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types()
171 {
172     typedef IntervalMap<T,U,Trt> IntervalMapT;
173     IntervalMapT map_a, map_b, map_c;
174     typename IntervalMapT::interval_mapping_type val_pair;
175     mapping_pair<T,U> map_pair;
176     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
177 
178     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus)(map_a, map_b, map_c, val_pair, map_pair);
179     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe)(map_a, map_b, map_c, val_pair, map_pair);
180 
181 #if !defined(_MSC_VER) || (_MSC_VER >= 1400) // 1310==MSVC-7.1  1400 ==MSVC-8.0
182     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(plus)(is_distinct_equal, map_a, map_b, map_c, val_pair, map_pair);
183     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(pipe)(is_distinct_equal, map_a, map_b, map_c, val_pair, map_pair);
184 #endif
185 }
186 
187 
188 //------------------------------------------------------------------------------
189 // Abelian group EANIC
190 //------------------------------------------------------------------------------
191 template
192 <
193     class T, class U, class Trt,
194 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
195     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
196 #else
197     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
198 #endif
199 >
itv_quantifier_check_abelian_group_plus_4_bicremental_types()200 void itv_quantifier_check_abelian_group_plus_4_bicremental_types()
201 {
202     typedef IntervalMap<T,U,Trt> IntervalMapT;
203     IntervalMapT map_a, map_b, map_c;
204     typename IntervalMapT::interval_mapping_type val_pair;
205     mapping_pair<T,U> map_pair;
206     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
207 
208     CHECK_ABELIAN_GROUP_INSTANCE_WRT(plus) (map_a, map_b, map_c, val_pair, map_pair);
209     CHECK_ABELIAN_GROUP_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
210 }
211 
212 //------------------------------------------------------------------------------
213 // (0 - x) + x =d= 0
214 //------------------------------------------------------------------------------
215 template
216 <
217     class T, class U, class Trt,
218 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
219     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
220 #else
221     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
222 #endif
223 >
itv_quantifier_check_abelian_group_plus_prot_inv_4_bicremental_types()224 void itv_quantifier_check_abelian_group_plus_prot_inv_4_bicremental_types()
225 {
226     // check abelian group wrt. + and inverability wrt. distinct equality =d= :
227     // (1) (IntervalMapT, +) is an abelian group and
228     // (2) The inverability law: (0 - x) + x =d= 0 holds.
229     typedef IntervalMap<T,U,Trt> IntervalMapT;
230     IntervalMapT map_a, map_b, map_c;
231     typename IntervalMapT::interval_mapping_type val_pair;
232     mapping_pair<T,U> map_pair;
233     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
234 
235     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, val_pair, map_pair);
236     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, val_pair, map_pair);
237 
238 #if !defined(_MSC_VER) || (_MSC_VER >= 1400) // 1310==MSVC-7.1  1400 ==MSVC-8.0
239     CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(plus) (is_distinct_equal, map_a, map_b, map_c, val_pair, map_pair);
240     CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(pipe) (is_distinct_equal, map_a, map_b, map_c, val_pair, map_pair);
241 #endif
242 }
243 
244 
245 //------------------------------------------------------------------------------
246 // Inner complement
247 //------------------------------------------------------------------------------
248 template
249 <
250     class T, class U, class Trt,
251 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
252     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
253 #else
254     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
255 #endif
256 >
itv_quantifier_check_inner_complementarity_4_bicremental_types()257 void itv_quantifier_check_inner_complementarity_4_bicremental_types()
258 {
259     typedef IntervalMap<T,U,Trt> IntervalMapT;
260     typedef typename IntervalMap<T,U,Trt>::set_type IntervalSetT;
261     IntervalMapT map_a, map_b, map_c;
262     typename IntervalMapT::interval_mapping_type val_pair;
263     mapping_pair<T,U> map_pair;
264     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
265 
266     has_inner_complementarity<IntervalMapT,IntervalSetT>(map_a);
267     has_inner_complementarity<IntervalMapT,IntervalSetT>(map_b);
268     has_inner_complementarity<IntervalMapT,IntervalSetT>(map_c);
269 }
270 
271 template
272 <
273     class T, class U, class Trt,
274 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
275     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
276 #else
277     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
278 #endif
279 >
itv_quantifier_check_length_complementarity_4_bicremental_types()280 void itv_quantifier_check_length_complementarity_4_bicremental_types()
281 {
282     typedef IntervalMap<T,U,Trt> IntervalMapT;
283     typedef typename IntervalMap<T,U,Trt>::set_type IntervalSetT;
284     IntervalMapT map_a, map_b, map_c;
285     typename IntervalMapT::interval_mapping_type val_pair;
286     mapping_pair<T,U> map_pair;
287     make_3_itv_maps_and_derivatives_1(map_a, map_b, map_c, val_pair, map_pair);
288 
289     has_length_complementarity(map_a);
290     has_length_complementarity(map_b);
291     has_length_complementarity(map_c);
292 
293     has_length_as_distance<IntervalMapT,IntervalSetT>(map_a);
294     has_length_as_distance<IntervalMapT,IntervalSetT>(map_b);
295     has_length_as_distance<IntervalMapT,IntervalSetT>(map_c);
296 }
297 
298 
299 
300 #endif // __TEST_INTERVAL_QUANTIFIER_SHARED_H_JOFA_090119__
301 
302