1 /*-----------------------------------------------------------------------------+
2 Copyright (c) 2008-2010: 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 LIBS_ICL_TEST_TEST_ICL_QUANTIFIER_SHARED_HPP_JOFA_100819
9 #define LIBS_ICL_TEST_TEST_ICL_QUANTIFIER_SHARED_HPP_JOFA_100819
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_icl_maps_and_derivatives_1(icl::map<T,U,Trt> & map_a,icl::map<T,U,Trt> & map_b,icl::map<T,U,Trt> & map_c,std::pair<T,U> & map_pair_a,std::pair<T,U> & map_pair_b,ICL_PORT_msvc_7_1_IntervalMap (T,U,Trt)*)22 void make_3_icl_maps_and_derivatives_1
23                    (icl::map<T,U,Trt>& map_a,
24                     icl::map<T,U,Trt>& map_b,
25                     icl::map<T,U,Trt>& map_c,
26                     std::pair<T,U>& map_pair_a,
27                     std::pair<T,U>& map_pair_b,
28                     ICL_PORT_msvc_7_1_IntervalMap(T,U,Trt)*)
29 {
30     typedef IntervalMap<T,U,Trt> IntervalMapT;
31     typedef    icl::map<T,U,Trt>         MapT;
32 
33     map_pair_a = sK_v(5,1);
34     map_pair_b = sK_v(9,1);
35 
36     add(map_a, sK_v(3,1));
37     add(map_a, sK_v(4,1));
38     add(map_a, sK_v(5,1));
39     add(map_a, sK_v(5,1));
40     add(map_a, sK_v(6,1));
41     add(map_a, sK_v(7,1));
42 
43     add(map_b, sK_v(2,1));
44     add(map_b, sK_v(8,1));
45 
46     add(map_c, sK_v(0,2));
47     add(map_c, sK_v(1,2));
48     add(map_c, sK_v(2,2));
49     add(map_c, sK_v(3,2));
50     add(map_c, sK_v(4,2));
51     add(map_c, sK_v(5,2));
52     add(map_c, sK_v(6,2));
53     add(map_c, sK_v(7,2));
54     add(map_c, sK_v(8,2));
55 
56     add(map_c, sK_v(3,1));
57     add(map_c, sK_v(4,1));
58     add(map_c, sK_v(5,1));
59     add(map_c, sK_v(6,1));
60 
61     add(map_c, sK_v(5,1));
62     add(map_c, sK_v(6,1));
63 }
64 
65 
66 //------------------------------------------------------------------------------
67 // Monoid EAN
68 //------------------------------------------------------------------------------
69 template
70 <
71     class T, class U, class Trt,
72 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
73     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
74 #else
75     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
76 #endif
77 >
icl_quantifier_check_monoid_plus_4_bicremental_types()78 void icl_quantifier_check_monoid_plus_4_bicremental_types()
79 {
80     typedef IntervalMap<T,U,Trt> IntervalMapT;
81     typedef icl::map<T,U,Trt>    MapT;
82     IntervalMapT aux;
83     MapT map_a, map_b, map_c;
84     std::pair<T,U> map_pair_a, map_pair_b;
85     make_3_icl_maps_and_derivatives_1(map_a, map_b, map_c, map_pair_a, map_pair_b, &aux);
86 
87     CHECK_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, map_pair_a, map_pair_b);
88     CHECK_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, map_pair_a, map_pair_b);
89 }
90 
91 
92 template
93 <
94     class T, class U, class Trt,
95 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
96     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
97 #else
98     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
99 #endif
100 >
icl_quantifier_check_monoid_et_4_bicremental_types()101 void icl_quantifier_check_monoid_et_4_bicremental_types()
102 {
103     typedef IntervalMap<T,U,Trt> IntervalMapT;
104     typedef icl::map<T,U,Trt>    MapT;
105     IntervalMapT aux;
106     MapT map_a, map_b, map_c;
107     std::pair<T,U> map_pair_a, map_pair_b;
108     make_3_icl_maps_and_derivatives_1(map_a, map_b, map_c, map_pair_a, map_pair_b, &aux);
109 
110     CHECK_MONOID_INSTANCE_WRT(et)   (map_a, map_b, map_c, map_pair_a, map_pair_b);
111     CHECK_MONOID_INSTANCE_WRT(caret)(map_a, map_b, map_c, map_pair_a, map_pair_b);
112 }
113 
114 //------------------------------------------------------------------------------
115 // Abelian monoid EANC
116 //------------------------------------------------------------------------------
117 
118 template
119 <
120     class T, class U, class Trt,
121 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
122     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
123 #else
124     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
125 #endif
126 >
icl_quantifier_check_abelian_monoid_plus_4_bicremental_types()127 void icl_quantifier_check_abelian_monoid_plus_4_bicremental_types()
128 {
129     typedef IntervalMap<T,U,Trt> IntervalMapT;
130     typedef icl::map<T,U,Trt>    MapT;
131     IntervalMapT aux;
132     MapT map_a, map_b, map_c;
133     std::pair<T,U> map_pair_a, map_pair_b;
134     make_3_icl_maps_and_derivatives_1(map_a, map_b, map_c, map_pair_a, map_pair_b, &aux);
135 
136     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, map_pair_a, map_pair_b);
137     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, map_pair_a, map_pair_b);
138 }
139 
140 
141 template
142 <
143     class T, class U, class Trt,
144 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
145     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
146 #else
147     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
148 #endif
149 >
icl_quantifier_check_abelian_monoid_et_4_bicremental_types()150 void icl_quantifier_check_abelian_monoid_et_4_bicremental_types()
151 {
152     typedef IntervalMap<T,U,Trt> IntervalMapT;
153     typedef icl::map<T,U,Trt>    MapT;
154     IntervalMapT aux;
155     MapT map_a, map_b, map_c;
156     std::pair<T,U> map_pair_a, map_pair_b;
157     make_3_icl_maps_and_derivatives_1(map_a, map_b, map_c, map_pair_a, map_pair_b, &aux);
158 
159     CHECK_ABELIAN_MONOID_INSTANCE_WRT(et)   (map_a, map_b, map_c, map_pair_a, map_pair_b);
160     CHECK_ABELIAN_MONOID_INSTANCE_WRT(caret)(map_a, map_b, map_c, map_pair_a, map_pair_b);
161 }
162 
163 
164 //------------------------------------------------------------------------------
165 // Abelian partial invertive monoid
166 //------------------------------------------------------------------------------
167 template
168 <
169     class T, class U, class Trt,
170 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
171     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
172 #else
173     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
174 #endif
175 >
icl_quantifier_check_partial_invertive_monoid_plus_4_bicremental_types()176 void icl_quantifier_check_partial_invertive_monoid_plus_4_bicremental_types()
177 {
178     typedef IntervalMap<T,U,Trt> IntervalMapT;
179     typedef icl::map<T,U,Trt>    MapT;
180     IntervalMapT aux;
181     MapT map_a, map_b, map_c;
182     std::pair<T,U> map_pair_a, map_pair_b;
183     make_3_icl_maps_and_derivatives_1(map_a, map_b, map_c, map_pair_a, map_pair_b, &aux);
184 
185     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, map_pair_a, map_pair_b);
186     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, map_pair_a, map_pair_b);
187 }
188 
189 //------------------------------------------------------------------------------
190 // Abelian partial invertive monoid with distinct equality for inversion
191 //------------------------------------------------------------------------------
192 template
193 <
194     class T, class U, class Trt,
195 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
196     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
197 #else
198     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
199 #endif
200 >
icl_quantifier_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types()201 void icl_quantifier_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types()
202 {
203     typedef IntervalMap<T,U,Trt> IntervalMapT;
204     typedef icl::map<T,U,Trt>    MapT;
205     IntervalMapT aux;
206     MapT map_a, map_b, map_c;
207     std::pair<T,U> map_pair_a, map_pair_b;
208     make_3_icl_maps_and_derivatives_1(map_a, map_b, map_c, map_pair_a, map_pair_b, &aux);
209 
210     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus)(map_a, map_b, map_c, map_pair_a, map_pair_b);
211     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe)(map_a, map_b, map_c, map_pair_a, map_pair_b);
212 
213 #if !defined(_MSC_VER) || (_MSC_VER >= 1400) // 1310==MSVC-7.1  1400 ==MSVC-8.0
214     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(plus)(is_distinct_equal, map_a, map_b, map_c, map_pair_a, map_pair_b);
215     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(pipe)(is_distinct_equal, map_a, map_b, map_c, map_pair_a, map_pair_b);
216 #endif
217 }
218 
219 
220 //------------------------------------------------------------------------------
221 // Abelian group EANIC
222 //------------------------------------------------------------------------------
223 template
224 <
225     class T, class U, class Trt,
226 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
227     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
228 #else
229     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
230 #endif
231 >
icl_quantifier_check_abelian_group_plus_4_bicremental_types()232 void icl_quantifier_check_abelian_group_plus_4_bicremental_types()
233 {
234     typedef IntervalMap<T,U,Trt> IntervalMapT;
235     typedef icl::map<T,U,Trt>    MapT;
236     IntervalMapT aux;
237     MapT map_a, map_b, map_c;
238     std::pair<T,U> map_pair_a, map_pair_b;
239     make_3_icl_maps_and_derivatives_1(map_a, map_b, map_c, map_pair_a, map_pair_b, &aux);
240 
241     CHECK_ABELIAN_GROUP_INSTANCE_WRT(plus) (map_a, map_b, map_c, map_pair_a, map_pair_b);
242     CHECK_ABELIAN_GROUP_INSTANCE_WRT(pipe) (map_a, map_b, map_c, map_pair_a, map_pair_b);
243 }
244 
245 //------------------------------------------------------------------------------
246 // (0 - x) + x =d= 0
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 >
icl_quantifier_check_abelian_group_plus_prot_inv_4_bicremental_types()257 void icl_quantifier_check_abelian_group_plus_prot_inv_4_bicremental_types()
258 {
259     // check abelian group wrt. + and inverability wrt. distinct equality =d= :
260     // (1) (IntervalMapT, +) is an abelian group and
261     // (2) The inverability law: (0 - x) + x =d= 0 holds.
262     typedef IntervalMap<T,U,Trt> IntervalMapT;
263     typedef icl::map<T,U,Trt>    MapT;
264     IntervalMapT aux;
265     MapT map_a, map_b, map_c;
266     std::pair<T,U> map_pair_a, map_pair_b;
267     make_3_icl_maps_and_derivatives_1(map_a, map_b, map_c, map_pair_a, map_pair_b, &aux);
268 
269     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus) (map_a, map_b, map_c, map_pair_a, map_pair_b);
270     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe) (map_a, map_b, map_c, map_pair_a, map_pair_b);
271 
272 #if !defined(_MSC_VER) || (_MSC_VER >= 1400) // 1310==MSVC-7.1  1400 ==MSVC-8.0
273     CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(plus) (is_distinct_equal, map_a, map_b, map_c, map_pair_a, map_pair_b);
274     CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(pipe) (is_distinct_equal, map_a, map_b, map_c, map_pair_a, map_pair_b);
275 #endif
276 }
277 
278 //------------------------------------------------------------------------------
279 // Containedness
280 //------------------------------------------------------------------------------
281 template
282 <
283     class T, class U, class Trt,
284 #if (defined(__GNUC__) && (__GNUC__ < 4)) //MEMO Can be simplified, if gcc-3.4 is obsolete
285     ICL_IntervalMap_TEMPLATE(T,U,Traits,Trt) IntervalMap
286 #else
287     ICL_IntervalMap_TEMPLATE(_T,_U,Traits,Trt) IntervalMap
288 #endif
289 >
icl_quantifier_check_containedness_4_bicremental_types()290 void icl_quantifier_check_containedness_4_bicremental_types()
291 {
292     typedef IntervalMap<T,U,Trt> IntervalMapT;
293     typedef icl::map<T,U,Trt>    MapT;
294     IntervalMapT aux;
295     MapT map_a, map_b, map_c;
296     std::pair<T,U> map_pair_a, map_pair_b;
297     make_3_icl_maps_and_derivatives_1(map_a, map_b, map_c, map_pair_a, map_pair_b, &aux);
298 
299     check_intersection_containedness(map_a, map_c);
300     check_intersection_containedness(map_c, map_pair_a);
301 
302     check_union_containedness(map_a, map_c);
303     check_union_containedness(map_c, map_pair_a);
304 
305     check_domain_containedness(map_a);
306 }
307 
308 
309 #endif // LIBS_ICL_TEST_TEST_ICL_QUANTIFIER_SHARED_HPP_JOFA_100819
310 
311