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

source code of boost/libs/icl/test/test_icl_quantifier_shared.hpp