test_icl_quantifier_shared.hpp 11 KB

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