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