test_combinable.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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. #define BOOST_TEST_MODULE icl::casual unit test
  9. #include <libs/icl/test/disable_test_warnings.hpp>
  10. #include <string>
  11. #include <boost/mpl/list.hpp>
  12. #include "../unit_test_unwarned.hpp"
  13. // interval instance types
  14. #include "../test_type_lists.hpp"
  15. #include "../test_value_maker.hpp"
  16. #include <boost/icl/interval_set.hpp>
  17. #include <boost/icl/separate_interval_set.hpp>
  18. #include <boost/icl/split_interval_set.hpp>
  19. #include <boost/icl/interval_map.hpp>
  20. #include <boost/icl/split_interval_map.hpp>
  21. using namespace std;
  22. using namespace boost;
  23. using namespace unit_test;
  24. using namespace boost::icl;
  25. template<template<class, class>class IsCombinable,
  26. class LeftT, class RightT>
  27. void check_combinable(bool expected, const char* type_combi, const char* combi_text)
  28. {
  29. std::string type_combination = type_combi;
  30. std::string is_combi_text = combi_text;
  31. bool is_combinable = IsCombinable<LeftT,RightT>::value;
  32. std::string combination_result = is_combinable
  33. ? (is_combinable == expected ? type_combination : "expected: NOT "+is_combi_text+"<"+type_combination+">")
  34. : (is_combinable == expected ? type_combination : "expected: IS "+is_combi_text+"<"+type_combination+">");
  35. //BOOST_CHECK_EQUAL(expected, is_combinable);
  36. BOOST_CHECK_EQUAL(type_combination, combination_result);
  37. }
  38. template<template<class, class>class IsCombinable>
  39. void check_combine_pattern(const char* text,
  40. bool jS_e, bool jS_i, bool jS_b, bool jS_p, bool jS_jS, bool jS_zS, bool jS_sS, bool jS_jM, bool jS_sM,
  41. bool zS_e, bool zS_i, bool zS_b, bool zS_p, bool zS_jS, bool zS_zS, bool zS_sS, bool zS_jM, bool zS_sM,
  42. bool sS_e, bool sS_i, bool sS_b, bool sS_p, bool sS_jS, bool sS_zS, bool sS_sS, bool sS_jM, bool sS_sM,
  43. bool jM_e, bool jM_i, bool jM_b, bool jM_p, bool jM_jS, bool jM_zS, bool jM_sS, bool jM_jM, bool jM_sM,
  44. bool sM_e, bool sM_i, bool sM_b, bool sM_p, bool sM_jS, bool sM_zS, bool sM_sS, bool sM_jM, bool sM_sM,
  45. bool check_base_class = true
  46. )
  47. {
  48. typedef interval_set<int> jS;
  49. typedef separate_interval_set<int> zS;
  50. typedef split_interval_set<int> sS;
  51. typedef interval_map<int,double> jM;
  52. typedef split_interval_map<int,double> sM;
  53. typedef interval_base_set<jS,int> jT;
  54. typedef interval_base_set<zS,int> zT;
  55. typedef interval_base_set<sS,int> sT;
  56. typedef interval_base_map<jM,int,double> jN;
  57. typedef interval_base_map<sM,int,double> sN;
  58. typedef interval_set<int>::element_type S_e;
  59. typedef interval_set<int>::segment_type S_i;
  60. typedef interval_map<int,double>::element_type M_b;
  61. typedef interval_map<int,double>::segment_type M_p;
  62. //--------------------------------------------------------------------------
  63. check_combinable<IsCombinable, jS, S_e>(jS_e , "jS_e ", text);
  64. check_combinable<IsCombinable, jS, S_i>(jS_i , "jS_i ", text);
  65. check_combinable<IsCombinable, jS, M_b>(jS_b , "jS_b ", text);
  66. check_combinable<IsCombinable, jS, M_p>(jS_p , "jS_p ", text);
  67. check_combinable<IsCombinable, jS, jS >(jS_jS, "jS_jS", text);
  68. check_combinable<IsCombinable, jS, zS >(jS_zS, "jS_zS", text);
  69. check_combinable<IsCombinable, jS, sS >(jS_sS, "jS_sS", text);
  70. check_combinable<IsCombinable, jS, jM >(jS_jM, "jS_jM", text);
  71. check_combinable<IsCombinable, jS, sM >(jS_sM, "jS_sM", text);
  72. //--------------------------------------------------------------------------
  73. check_combinable<IsCombinable, zS, S_e>(zS_e , "zS_e ", text);
  74. check_combinable<IsCombinable, zS, S_i>(zS_i , "zS_i ", text);
  75. check_combinable<IsCombinable, zS, M_b>(zS_b , "zS_b ", text);
  76. check_combinable<IsCombinable, zS, M_p>(zS_p , "zS_p ", text);
  77. check_combinable<IsCombinable, zS, jS >(zS_jS, "zS_jS", text);
  78. check_combinable<IsCombinable, zS, zS >(zS_zS, "zS_zS", text);
  79. check_combinable<IsCombinable, zS, sS >(zS_sS, "zS_sS", text);
  80. check_combinable<IsCombinable, zS, jM >(zS_jM, "zS_jM", text);
  81. check_combinable<IsCombinable, zS, sM >(zS_sM, "zS_sM", text);
  82. //--------------------------------------------------------------------------
  83. check_combinable<IsCombinable, sS, S_e>(sS_e , "sS_e ", text);
  84. check_combinable<IsCombinable, sS, S_i>(sS_i , "sS_i ", text);
  85. check_combinable<IsCombinable, sS, M_b>(sS_b , "sS_b ", text);
  86. check_combinable<IsCombinable, sS, M_p>(sS_p , "sS_p ", text);
  87. check_combinable<IsCombinable, sS, jS >(sS_jS, "sS_jS", text);
  88. check_combinable<IsCombinable, sS, zS >(sS_zS, "sS_zS", text);
  89. check_combinable<IsCombinable, sS, sS >(sS_sS, "sS_sS", text);
  90. check_combinable<IsCombinable, sS, jM >(sS_jM, "sS_jM", text);
  91. check_combinable<IsCombinable, sS, sM >(sS_sM, "sS_sM", text);
  92. //--------------------------------------------------------------------------
  93. check_combinable<IsCombinable, jM, S_e>(jM_e , "jM_e ", text);
  94. check_combinable<IsCombinable, jM, S_i>(jM_i , "jM_i ", text);
  95. check_combinable<IsCombinable, jM, M_b>(jM_b , "jM_b ", text);
  96. check_combinable<IsCombinable, jM, M_p>(jM_p , "jM_p ", text);
  97. check_combinable<IsCombinable, jM, jS >(jM_jS, "jM_jS", text);
  98. check_combinable<IsCombinable, jM, zS >(jM_zS, "jM_zS", text);
  99. check_combinable<IsCombinable, jM, sS >(jM_sS, "jM_sS", text);
  100. check_combinable<IsCombinable, jM, jM >(jM_jM, "jM_jM", text);
  101. check_combinable<IsCombinable, jM, sM >(jM_sM, "jM_sM", text);
  102. //--------------------------------------------------------------------------
  103. check_combinable<IsCombinable, sM, S_e>(sM_e , "sM_e ", text);
  104. check_combinable<IsCombinable, sM, S_i>(sM_i , "sM_i ", text);
  105. check_combinable<IsCombinable, sM, M_b>(sM_b , "sM_b ", text);
  106. check_combinable<IsCombinable, sM, M_p>(sM_p , "sM_p ", text);
  107. check_combinable<IsCombinable, sM, jS >(sM_jS, "sM_jS", text);
  108. check_combinable<IsCombinable, sM, zS >(sM_zS, "sM_zS", text);
  109. check_combinable<IsCombinable, sM, sS >(sM_sS, "sM_sS", text);
  110. check_combinable<IsCombinable, sM, jM >(sM_jM, "sM_jM", text);
  111. check_combinable<IsCombinable, sM, sM >(sM_sM, "sM_sM", text);
  112. //--------------------------------------------------------------------------
  113. if(check_base_class)
  114. {
  115. //--------------------------------------------------------------------------
  116. check_combinable<IsCombinable, jT, S_e>(jS_e , "jT_e ", text);
  117. check_combinable<IsCombinable, jT, S_i>(jS_i , "jT_i ", text);
  118. check_combinable<IsCombinable, jT, M_b>(jS_b , "jT_b ", text);
  119. check_combinable<IsCombinable, jT, M_p>(jS_p , "jT_p ", text);
  120. check_combinable<IsCombinable, jT, jS >(jS_jS, "jT_jS", text);
  121. check_combinable<IsCombinable, jT, zS >(jS_zS, "jT_zS", text);
  122. check_combinable<IsCombinable, jT, sS >(jS_sS, "jT_sS", text);
  123. check_combinable<IsCombinable, jT, jM >(jS_jM, "jT_jM", text);
  124. check_combinable<IsCombinable, jT, sM >(jS_sM, "jT_sM", text);
  125. check_combinable<IsCombinable, jT, jT >(jS_jS, "jT_jT", text);
  126. check_combinable<IsCombinable, jT, zT >(jS_zS, "jT_zT", text);
  127. check_combinable<IsCombinable, jT, sT >(jS_sS, "jT_sT", text);
  128. check_combinable<IsCombinable, jT, jN >(jS_jM, "jT_jN", text);
  129. check_combinable<IsCombinable, jT, sN >(jS_sM, "jT_sN", text);
  130. //--------------------------------------------------------------------------
  131. check_combinable<IsCombinable, zT, S_e>(zS_e , "zT_e ", text);
  132. check_combinable<IsCombinable, zT, S_i>(zS_i , "zT_i ", text);
  133. check_combinable<IsCombinable, zT, M_b>(zS_b , "zT_b ", text);
  134. check_combinable<IsCombinable, zT, M_p>(zS_p , "zT_p ", text);
  135. check_combinable<IsCombinable, zT, jS >(zS_jS, "zT_jS", text);
  136. check_combinable<IsCombinable, zT, zS >(zS_zS, "zT_zS", text);
  137. check_combinable<IsCombinable, zT, sS >(zS_sS, "zT_sS", text);
  138. check_combinable<IsCombinable, zT, jM >(zS_jM, "zT_jM", text);
  139. check_combinable<IsCombinable, zT, sM >(zS_sM, "zT_sM", text);
  140. check_combinable<IsCombinable, zT, jT >(zS_jS, "zT_jT", text);
  141. check_combinable<IsCombinable, zT, zT >(zS_zS, "zT_zT", text);
  142. check_combinable<IsCombinable, zT, sT >(zS_sS, "zT_sT", text);
  143. check_combinable<IsCombinable, zT, jN >(zS_jM, "zT_jN", text);
  144. check_combinable<IsCombinable, zT, sN >(zS_sM, "zT_sN", text);
  145. //--------------------------------------------------------------------------
  146. check_combinable<IsCombinable, sT, S_e>(sS_e , "sT_e ", text);
  147. check_combinable<IsCombinable, sT, S_i>(sS_i , "sT_i ", text);
  148. check_combinable<IsCombinable, sT, M_b>(sS_b , "sT_b ", text);
  149. check_combinable<IsCombinable, sT, M_p>(sS_p , "sT_p ", text);
  150. check_combinable<IsCombinable, sT, jS >(sS_jS, "sT_jS", text);
  151. check_combinable<IsCombinable, sT, zS >(sS_zS, "sT_zS", text);
  152. check_combinable<IsCombinable, sT, sS >(sS_sS, "sT_sS", text);
  153. check_combinable<IsCombinable, sT, jM >(sS_jM, "sT_jM", text);
  154. check_combinable<IsCombinable, sT, sM >(sS_sM, "sT_sM", text);
  155. check_combinable<IsCombinable, sT, jT >(sS_jS, "sT_jT", text);
  156. check_combinable<IsCombinable, sT, zT >(sS_zS, "sT_zT", text);
  157. check_combinable<IsCombinable, sT, sT >(sS_sS, "sT_sT", text);
  158. check_combinable<IsCombinable, sT, jN >(sS_jM, "sT_jN", text);
  159. check_combinable<IsCombinable, sT, sN >(sS_sM, "sT_sN", text);
  160. //--------------------------------------------------------------------------
  161. check_combinable<IsCombinable, jN, S_e>(jM_e , "jN_e ", text);
  162. check_combinable<IsCombinable, jN, S_i>(jM_i , "jN_i ", text);
  163. check_combinable<IsCombinable, jN, M_b>(jM_b , "jN_b ", text);
  164. check_combinable<IsCombinable, jN, M_p>(jM_p , "jN_p ", text);
  165. check_combinable<IsCombinable, jN, jS >(jM_jS, "jN_jS", text);
  166. check_combinable<IsCombinable, jN, zS >(jM_zS, "jN_zS", text);
  167. check_combinable<IsCombinable, jN, sS >(jM_sS, "jN_sS", text);
  168. check_combinable<IsCombinable, jN, jM >(jM_jM, "jN_jM", text);//
  169. check_combinable<IsCombinable, jN, sM >(jM_sM, "jN_sM", text);//
  170. check_combinable<IsCombinable, jN, jT >(jM_jS, "jN_jT", text);
  171. check_combinable<IsCombinable, jN, zT >(jM_zS, "jN_zT", text);
  172. check_combinable<IsCombinable, jN, sT >(jM_sS, "jN_sT", text);
  173. check_combinable<IsCombinable, jN, jN >(jM_jM, "jN_jN", text);//
  174. check_combinable<IsCombinable, jN, sN >(jM_sM, "jN_sN", text);//
  175. //--------------------------------------------------------------------------
  176. check_combinable<IsCombinable, sN, S_e>(sM_e , "sN_e ", text);
  177. check_combinable<IsCombinable, sN, S_i>(sM_i , "sN_i ", text);
  178. check_combinable<IsCombinable, sN, M_b>(sM_b , "sN_b ", text);
  179. check_combinable<IsCombinable, sN, M_p>(sM_p , "sN_p ", text);
  180. check_combinable<IsCombinable, sN, jS >(sM_jS, "sN_jS", text);
  181. check_combinable<IsCombinable, sN, zS >(sM_zS, "sN_zS", text);
  182. check_combinable<IsCombinable, sN, sS >(sM_sS, "sN_sS", text);
  183. check_combinable<IsCombinable, sN, jM >(sM_jM, "sN_jM", text);
  184. check_combinable<IsCombinable, sN, sM >(sM_sM, "sN_sM", text);
  185. check_combinable<IsCombinable, sN, jT >(sM_jS, "sN_jT", text);
  186. check_combinable<IsCombinable, sN, zT >(sM_zS, "sN_zT", text);
  187. check_combinable<IsCombinable, sN, sT >(sM_sS, "sN_sT", text);
  188. check_combinable<IsCombinable, sN, jN >(sM_jM, "sN_jN", text);
  189. check_combinable<IsCombinable, sN, sN >(sM_sM, "sN_sN", text);
  190. }
  191. }
  192. BOOST_AUTO_TEST_CASE(test_icl_is_derivative)
  193. {
  194. //--------------------------------------------------------------------------
  195. // 1.1
  196. check_combine_pattern<is_intra_derivative>(
  197. "is_intra_derivative",
  198. // e i b p jS zS sS jM sM
  199. 1, 1, 0, 0, 0, 0, 0, 0, 0, // jS
  200. 1, 1, 0, 0, 0, 0, 0, 0, 0, // zS
  201. 1, 1, 0, 0, 0, 0, 0, 0, 0, // sS
  202. 0, 0, 1, 1, 0, 0, 0, 0, 0, // jM
  203. 0, 0, 1, 1, 0, 0, 0, 0, 0 // sM
  204. );
  205. //--------------------------------------------------------------------------
  206. // 1.2
  207. check_combine_pattern<is_cross_derivative>(
  208. "is_cross_derivative",
  209. // e i b p jS zS sS jM sM
  210. 0, 0, 0, 0, 0, 0, 0, 0, 0, // jS
  211. 0, 0, 0, 0, 0, 0, 0, 0, 0, // zS
  212. 0, 0, 0, 0, 0, 0, 0, 0, 0, // sS
  213. 1, 1, 0, 0, 0, 0, 0, 0, 0, // jM
  214. 1, 1, 0, 0, 0, 0, 0, 0, 0 // sM
  215. );
  216. //--------------------------------------------------------------------------
  217. // 1.3
  218. check_combine_pattern<is_inter_derivative>(
  219. "is_inter_derivative",
  220. // e i b p jS zS sS jM sM
  221. 1, 1, 0, 0, 0, 0, 0, 0, 0, // jS
  222. 1, 1, 0, 0, 0, 0, 0, 0, 0, // zS
  223. 1, 1, 0, 0, 0, 0, 0, 0, 0, // sS
  224. 1, 1, 1, 1, 0, 0, 0, 0, 0, // jM
  225. 1, 1, 1, 1, 0, 0, 0, 0, 0 // sM
  226. );
  227. }
  228. BOOST_AUTO_TEST_CASE(test_icl_is_combinable)
  229. {
  230. //--------------------------------------------------------------------------
  231. // 2.1
  232. check_combine_pattern<is_intra_combinable>(
  233. "is_intra_combinable",
  234. // e i b p jS zS sS jM sM
  235. 0, 0, 0, 0, 1, 1, 1, 0, 0, // jS
  236. 0, 0, 0, 0, 1, 1, 1, 0, 0, // zS
  237. 0, 0, 0, 0, 1, 1, 1, 0, 0, // sS
  238. 0, 0, 0, 0, 0, 0, 0, 1, 1, // jM
  239. 0, 0, 0, 0, 0, 0, 0, 1, 1 // sM
  240. );
  241. //--------------------------------------------------------------------------
  242. // 2.2
  243. check_combine_pattern<is_cross_combinable>(
  244. "is_cross_combinable",
  245. // e i b p jS zS sS jM sM
  246. 0, 0, 0, 0, 0, 0, 0, 1, 1, // jS
  247. 0, 0, 0, 0, 0, 0, 0, 1, 1, // zS
  248. 0, 0, 0, 0, 0, 0, 0, 1, 1, // sS
  249. 0, 0, 0, 0, 1, 1, 1, 0, 0, // jM
  250. 0, 0, 0, 0, 1, 1, 1, 0, 0 // sM
  251. );
  252. //--------------------------------------------------------------------------
  253. // 2.3
  254. check_combine_pattern<is_inter_combinable>(
  255. "is_inter_combinable",
  256. // e i b p jS zS sS jM sM
  257. 0, 0, 0, 0, 1, 1, 1, 1, 1, // jS
  258. 0, 0, 0, 0, 1, 1, 1, 1, 1, // zS
  259. 0, 0, 0, 0, 1, 1, 1, 1, 1, // sS
  260. 0, 0, 0, 0, 1, 1, 1, 1, 1, // jM
  261. 0, 0, 0, 0, 1, 1, 1, 1, 1 // sM
  262. );
  263. }
  264. BOOST_AUTO_TEST_CASE(test_icl_is_container_right_combinable)
  265. {
  266. //--------------------------------------------------------------------------
  267. // 3.1
  268. // LeftT is an interval_set:
  269. // is_interval_set_right_combinable<LeftT, RightT> determines what can
  270. // be combined as RightT argument type.
  271. check_combine_pattern<is_interval_set_right_combinable>(
  272. "is_interval_set_right_combinable",
  273. // e i b p jS zS sS jM sM
  274. 1, 1, 0, 0, 1, 1, 1, 0, 0, // jS
  275. 1, 1, 0, 0, 1, 1, 1, 0, 0, // zS
  276. 1, 1, 0, 0, 1, 1, 1, 0, 0, // sS
  277. 0, 0, 0, 0, 0, 0, 0, 0, 0, // jM
  278. 0, 0, 0, 0, 0, 0, 0, 0, 0 // sM
  279. );
  280. //--------------------------------------------------------------------------
  281. // 3.2
  282. check_combine_pattern<is_interval_map_right_intra_combinable>(
  283. "is_interval_map_right_intra_combinable",
  284. // e i b p jS zS sS jM sM
  285. 0, 0, 0, 0, 0, 0, 0, 0, 0, // jS
  286. 0, 0, 0, 0, 0, 0, 0, 0, 0, // zS
  287. 0, 0, 0, 0, 0, 0, 0, 0, 0, // sS
  288. 0, 0, 1, 1, 0, 0, 0, 1, 1, // jM
  289. 0, 0, 1, 1, 0, 0, 0, 1, 1 // sM
  290. );
  291. //--------------------------------------------------------------------------
  292. // 3.3
  293. check_combine_pattern<is_interval_map_right_cross_combinable>(
  294. "is_interval_map_right_cross_combinable",
  295. // e i b p jS zS sS jM sM
  296. 0, 0, 0, 0, 0, 0, 0, 0, 0, // jS
  297. 0, 0, 0, 0, 0, 0, 0, 0, 0, // zS
  298. 0, 0, 0, 0, 0, 0, 0, 0, 0, // sS
  299. 1, 1, 0, 0, 1, 1, 1, 0, 0, // jM
  300. 1, 1, 0, 0, 1, 1, 1, 0, 0 // sM
  301. );
  302. //--------------------------------------------------------------------------
  303. // 3.4
  304. check_combine_pattern<is_interval_map_right_inter_combinable>(
  305. "is_interval_map_right_inter_combinable",
  306. // e i b p jS zS sS jM sM
  307. 0, 0, 0, 0, 0, 0, 0, 0, 0, // jS
  308. 0, 0, 0, 0, 0, 0, 0, 0, 0, // zS
  309. 0, 0, 0, 0, 0, 0, 0, 0, 0, // sS
  310. 1, 1, 1, 1, 1, 1, 1, 1, 1, // jM
  311. 1, 1, 1, 1, 1, 1, 1, 1, 1 // sM
  312. );
  313. }
  314. BOOST_AUTO_TEST_CASE(test_icl_is_right_combinable)
  315. {
  316. //--------------------------------------------------------------------------
  317. // 4.1
  318. check_combine_pattern<is_right_intra_combinable>(
  319. "is_right_intra_combinable",
  320. // e i b p jS zS sS jM sM
  321. 1, 1, 0, 0, 1, 1, 1, 0, 0, // jS
  322. 1, 1, 0, 0, 1, 1, 1, 0, 0, // zS
  323. 1, 1, 0, 0, 1, 1, 1, 0, 0, // sS
  324. 0, 0, 1, 1, 0, 0, 0, 1, 1, // jM
  325. 0, 0, 1, 1, 0, 0, 0, 1, 1 // sM
  326. );
  327. //--------------------------------------------------------------------------
  328. // 4.2
  329. check_combine_pattern<is_right_inter_combinable>(
  330. "is_right_inter_combinable",
  331. // e i b p jS zS sS jM sM
  332. 1, 1, 0, 0, 1, 1, 1, 0, 0, // jS
  333. 1, 1, 0, 0, 1, 1, 1, 0, 0, // zS
  334. 1, 1, 0, 0, 1, 1, 1, 0, 0, // sS
  335. 1, 1, 1, 1, 1, 1, 1, 1, 1, // jM
  336. 1, 1, 1, 1, 1, 1, 1, 1, 1 // sM
  337. );
  338. }
  339. BOOST_AUTO_TEST_CASE(test_icl_combines_right_to)
  340. {
  341. //--------------------------------------------------------------------------
  342. // 5.1
  343. check_combine_pattern<combines_right_to_interval_set>(
  344. "combines_right_to_interval_set",
  345. // e i b p jS zS sS jM sM
  346. 0, 0, 0, 0, 1, 1, 1, 0, 0, // jS
  347. 0, 0, 0, 0, 1, 1, 1, 0, 0, // zS
  348. 0, 0, 0, 0, 1, 1, 1, 0, 0, // sS
  349. 0, 0, 0, 0, 1, 1, 1, 0, 0, // jM
  350. 0, 0, 0, 0, 1, 1, 1, 0, 0 // sM
  351. );
  352. //--------------------------------------------------------------------------
  353. // 5.2
  354. check_combine_pattern<combines_right_to_interval_map>(
  355. "combines_right_to_interval_map",
  356. // e i b p jS zS sS jM sM
  357. 0, 0, 0, 0, 0, 0, 0, 0, 0, // jS
  358. 0, 0, 0, 0, 0, 0, 0, 0, 0, // zS
  359. 0, 0, 0, 0, 0, 0, 0, 0, 0, // sS
  360. 0, 0, 0, 0, 0, 0, 0, 1, 1, // jM
  361. 0, 0, 0, 0, 0, 0, 0, 1, 1 // sM
  362. );
  363. //--------------------------------------------------------------------------
  364. // 5.3
  365. check_combine_pattern<combines_right_to_interval_container>(
  366. "combines_right_to_interval_container",
  367. // e i b p jS zS sS jM sM
  368. 0, 0, 0, 0, 1, 1, 1, 0, 0, // jS
  369. 0, 0, 0, 0, 1, 1, 1, 0, 0, // zS
  370. 0, 0, 0, 0, 1, 1, 1, 0, 0, // sS
  371. 0, 0, 0, 0, 1, 1, 1, 1, 1, // jM
  372. 0, 0, 0, 0, 1, 1, 1, 1, 1 // sM
  373. );
  374. }
  375. BOOST_AUTO_TEST_CASE(test_icl_is_companion)
  376. {
  377. //--------------------------------------------------------------------------
  378. // 6.1
  379. check_combine_pattern<is_interval_set_companion>(
  380. "is_interval_set_companion",
  381. // e i b p jS zS sS jM sM
  382. 1, 1, 0, 0, 1, 1, 1, 0, 0, // jS
  383. 1, 1, 0, 0, 1, 1, 1, 0, 0, // zS
  384. 1, 1, 0, 0, 1, 1, 1, 0, 0, // sS
  385. 1, 1, 0, 0, 1, 1, 1, 0, 0, // jM
  386. 1, 1, 0, 0, 1, 1, 1, 0, 0 // sM
  387. );
  388. //--------------------------------------------------------------------------
  389. // 6.2
  390. check_combine_pattern<is_interval_map_companion>(
  391. "is_interval_map_companion",
  392. // e i b p jS zS sS jM sM
  393. 0, 1, 0, 0, 0, 0, 0, 0, 0, // jS
  394. 0, 1, 0, 0, 0, 0, 0, 0, 0, // zS
  395. 0, 1, 0, 0, 0, 0, 0, 0, 0, // sS
  396. 0, 0, 1, 1, 0, 0, 0, 1, 1, // jM
  397. 0, 0, 1, 1, 0, 0, 0, 1, 1 // sM
  398. );
  399. }
  400. BOOST_AUTO_TEST_CASE(test_icl_is_coarser_combinable)
  401. {
  402. //--------------------------------------------------------------------------
  403. // 7.1
  404. check_combine_pattern<is_coarser_interval_set_companion>(
  405. "is_coarser_interval_set_companion",
  406. // e i b p jS zS sS jM sM
  407. 1, 1, 0, 0, 0, 0, 0, 0, 0, // jS
  408. 1, 1, 0, 0, 1, 0, 0, 0, 0, // zS
  409. 1, 1, 0, 0, 1, 1, 0, 0, 0, // sS
  410. 1, 1, 0, 0, 0, 0, 0, 0, 0, // jM
  411. 1, 1, 0, 0, 1, 1, 0, 0, 0, // sM
  412. false
  413. );
  414. //--------------------------------------------------------------------------
  415. // 7.2
  416. check_combine_pattern<is_coarser_interval_map_companion>(
  417. "is_coarser_interval_map_companion",
  418. // e i b p jS zS sS jM sM
  419. 0, 1, 0, 0, 0, 0, 0, 0, 0, // jS
  420. 0, 1, 0, 0, 0, 0, 0, 0, 0, // zS
  421. 0, 1, 0, 0, 0, 0, 0, 0, 0, // sS
  422. 0, 0, 1, 1, 0, 0, 0, 0, 0, // jM
  423. 0, 0, 1, 1, 0, 0, 0, 1, 0, // sM
  424. false
  425. );
  426. //--------------------------------------------------------------------------
  427. // 8.1
  428. check_combine_pattern<is_binary_interval_set_combinable>(
  429. "is_binary_interval_set_combinable",
  430. // e i b p jS zS sS jM sM
  431. 1, 1, 0, 0, 0, 0, 0, 0, 0, // jS
  432. 1, 1, 0, 0, 1, 0, 0, 0, 0, // zS
  433. 1, 1, 0, 0, 1, 1, 0, 0, 0, // sS
  434. 0, 0, 0, 0, 0, 0, 0, 0, 0, // jM
  435. 0, 0, 0, 0, 0, 0, 0, 0, 0, // sM
  436. false
  437. );
  438. //--------------------------------------------------------------------------
  439. // 8.2
  440. check_combine_pattern<is_binary_interval_map_combinable>(
  441. "is_binary_interval_map_combinable",
  442. // e i b p jS zS sS jM sM
  443. 0, 0, 0, 0, 0, 0, 0, 0, 0, // jS
  444. 0, 0, 0, 0, 0, 0, 0, 0, 0, // zS
  445. 0, 0, 0, 0, 0, 0, 0, 0, 0, // sS
  446. 0, 0, 1, 1, 0, 0, 0, 0, 0, // jM
  447. 0, 0, 1, 1, 0, 0, 0, 1, 0, // sM
  448. false
  449. );
  450. }
  451. BOOST_AUTO_TEST_CASE(test_icl_is_binary_combinable)
  452. {
  453. //--------------------------------------------------------------------------
  454. // 9.1
  455. check_combine_pattern<is_binary_intra_combinable>(
  456. "is_binary_intra_combinable",
  457. // e i b p jS zS sS jM sM
  458. 1, 1, 0, 0, 0, 0, 0, 0, 0, // jS
  459. 1, 1, 0, 0, 1, 0, 0, 0, 0, // zS
  460. 1, 1, 0, 0, 1, 1, 0, 0, 0, // sS
  461. 0, 0, 1, 1, 0, 0, 0, 0, 0, // jM
  462. 0, 0, 1, 1, 0, 0, 0, 1, 0, // sM
  463. false
  464. );
  465. //--------------------------------------------------------------------------
  466. // 9.2
  467. check_combine_pattern<is_binary_inter_combinable>(
  468. "is_binary_inter_combinable",
  469. // e i b p jS zS sS jM sM
  470. 1, 1, 0, 0, 0, 0, 0, 0, 0, // jS
  471. 1, 1, 0, 0, 1, 0, 0, 0, 0, // zS
  472. 1, 1, 0, 0, 1, 1, 0, 0, 0, // sS
  473. 1, 1, 1, 1, 1, 1, 1, 0, 0, // jM
  474. 1, 1, 1, 1, 1, 1, 1, 1, 0, // sM
  475. false
  476. );
  477. }