• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SET_INTERVAL_SET_SHARED_HPP_JOFA_090119
9 #define LIBS_ICL_TEST_TEST_SET_INTERVAL_SET_SHARED_HPP_JOFA_090119
10 
11 #include "portability.hpp"
12 
13 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
make_3_interval_sets_and_derivatives_1(ICL_PORT_msvc_7_1_IntervalSet (T)& set_a,ICL_PORT_msvc_7_1_IntervalSet (T)& set_b,ICL_PORT_msvc_7_1_IntervalSet (T)& set_c,typename ICL_PORT_msvc_7_1_IntervalSet (T)::segment_type & segm_d,typename ICL_PORT_msvc_7_1_IntervalSet (T)::element_type & elem_e)14 void make_3_interval_sets_and_derivatives_1
15                    (ICL_PORT_msvc_7_1_IntervalSet(T)& set_a,
16                     ICL_PORT_msvc_7_1_IntervalSet(T)& set_b,
17                     ICL_PORT_msvc_7_1_IntervalSet(T)& set_c,
18                     typename ICL_PORT_msvc_7_1_IntervalSet(T)::segment_type& segm_d,
19                     typename ICL_PORT_msvc_7_1_IntervalSet(T)::element_type& elem_e)
20 {
21     segm_d = I_D(6,9);
22     elem_e = MK_v(5);
23 
24     set_a.add(I_D(3,6)).add(I_I(5,7));
25     set_b.add(C_D(1,3)).add(I_D(8,9));
26     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
27 }
28 
29 
30 
31 //------------------------------------------------------------------------------
32 // Monoid EAN
33 //------------------------------------------------------------------------------
34 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_monoid_plus_4_bicremental_types()35 void interval_set_check_monoid_plus_4_bicremental_types()
36 {
37     typedef IntervalSet<T> IntervalSetT;
38 
39     IntervalSetT set_a, set_b, set_c;
40     set_a.add(I_D(3,6)).add(I_I(5,7));
41     set_b.add(C_D(1,3)).add(I_D(8,9));
42     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
43 
44     typename IntervalSetT::segment_type inter_val1 = I_D(6,9);
45     typename IntervalSetT::segment_type inter_val2 = I_I(5,5);
46 
47     CHECK_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, inter_val1, inter_val2);
48     CHECK_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, inter_val1, inter_val2);
49 }
50 
51 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_monoid_et_4_bicremental_types()52 void interval_set_check_monoid_et_4_bicremental_types()
53 {
54     typedef IntervalSet<T> IntervalSetT;
55     //CJ typedef typename IntervalSetT::interval_type IntervalT;
56 
57     IntervalSetT set_a, set_b, set_c;
58     set_a.add(I_D(3,6)).add(I_I(5,7));
59     set_b.add(C_D(1,3)).add(I_D(8,9));
60     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
61 
62     typename IntervalSetT::segment_type inter_val1 = I_D(6,9);
63     typename IntervalSetT::segment_type inter_val2 = I_I(5,5);
64 
65     CHECK_MONOID_INSTANCE_WRT(et)   (set_a, set_b, set_c, inter_val1, inter_val2);
66     CHECK_MONOID_INSTANCE_WRT(caret)(set_a, set_b, set_c, inter_val1, inter_val2);
67 }
68 
69 //------------------------------------------------------------------------------
70 // Abelian monoid EANC
71 //------------------------------------------------------------------------------
72 
73 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_abelian_monoid_plus_4_bicremental_types()74 void interval_set_check_abelian_monoid_plus_4_bicremental_types()
75 {
76     typedef IntervalSet<T> IntervalSetT;
77 
78     IntervalSetT set_a, set_b, set_c;
79     set_a.add(I_D(3,6)).add(I_I(5,7));
80     set_b.add(C_D(1,3)).add(I_D(8,9));
81     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
82 
83     typename IntervalSetT::segment_type inter_val1 = I_D(6,9);
84     typename IntervalSetT::segment_type inter_val2 = I_I(5,5);
85 
86     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, inter_val1, inter_val2);
87     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, inter_val1, inter_val2);
88 }
89 
90 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_abelian_monoid_et_4_bicremental_types()91 void interval_set_check_abelian_monoid_et_4_bicremental_types()
92 {
93     typedef IntervalSet<T> IntervalSetT;
94 
95     IntervalSetT set_a, set_b, set_c;
96     set_a.add(I_D(3,6)).add(I_I(5,7));
97     set_b.add(C_D(1,3)).add(I_D(8,9));
98     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
99 
100     typename IntervalSetT::segment_type inter_val1 = I_D(6,9);
101     typename IntervalSetT::segment_type inter_val2 = I_I(5,5);
102 
103     CHECK_ABELIAN_MONOID_INSTANCE_WRT(et)   (set_a, set_b, set_c, inter_val1, inter_val2);
104     CHECK_ABELIAN_MONOID_INSTANCE_WRT(caret)(set_a, set_b, set_c, inter_val1, inter_val2);
105 }
106 
107 
108 //------------------------------------------------------------------------------
109 // Abelian partial invertive monoid
110 //------------------------------------------------------------------------------
111 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_partial_invertive_monoid_plus_4_bicremental_types()112 void interval_set_check_partial_invertive_monoid_plus_4_bicremental_types()
113 {
114     typedef IntervalSet<T> IntervalSetT;
115 
116     IntervalSetT set_a, set_b, set_c;
117     set_a.add(I_D(3,6)).add(I_I(5,7));
118     set_b.add(C_D(1,3)).add(I_D(8,9));
119     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
120 
121     typename IntervalSetT::segment_type inter_val1 = I_D(6,9);
122     typename IntervalSetT::segment_type inter_val2 = I_I(5,5);
123 
124     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, inter_val1, inter_val2);
125     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, inter_val1, inter_val2);
126 }
127 
128 
129 //------------------------------------------------------------------------------
130 // Containedness
131 //------------------------------------------------------------------------------
132 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_containedness_4_bicremental_types()133 void interval_set_check_containedness_4_bicremental_types()
134 {
135     typedef IntervalSet<T> IntervalSetT;
136     typedef typename IntervalSetT::segment_type segment_type;
137     typedef typename IntervalSetT::element_type element_type;
138 
139     IntervalSetT set_a, set_b, set_c;
140     segment_type segm_d;
141     element_type elem_e;
142     make_3_interval_sets_and_derivatives_1(set_a, set_b, set_c, segm_d, elem_e);
143 
144     check_intersection_containedness(set_a, set_c);
145     check_intersection_containedness(set_b, segm_d);
146     check_intersection_containedness(set_c, elem_e);
147 
148     check_union_containedness(set_c, set_c);
149     check_union_containedness(set_b, segm_d);
150     check_union_containedness(set_a, elem_e);
151 }
152 
153 
154 //------------------------------------------------------------------------------
155 // Inner complement
156 //------------------------------------------------------------------------------
157 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_inner_complementarity_4_bicremental_types()158 void interval_set_check_inner_complementarity_4_bicremental_types()
159 {
160     typedef IntervalSet<T> IntervalSetT;
161     typedef typename IntervalSetT::segment_type segment_type;
162     typedef typename IntervalSetT::element_type element_type;
163 
164     IntervalSetT set_a, set_b, set_c;
165     segment_type segm_d;
166     element_type elem_e;
167     make_3_interval_sets_and_derivatives_1(set_a, set_b, set_c, segm_d, elem_e);
168 
169     has_inner_complementarity<IntervalSetT,IntervalSetT>(set_a);
170     has_inner_complementarity<IntervalSetT,IntervalSetT>(set_b);
171     has_inner_complementarity<IntervalSetT,IntervalSetT>(set_c);
172 }
173 
174 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_length_complementarity_4_bicremental_types()175 void interval_set_check_length_complementarity_4_bicremental_types()
176 {
177     typedef IntervalSet<T> IntervalSetT;
178     typedef typename IntervalSetT::segment_type segment_type;
179     typedef typename IntervalSetT::element_type element_type;
180 
181     IntervalSetT set_a, set_b, set_c;
182     segment_type segm_d;
183     element_type elem_e;
184     make_3_interval_sets_and_derivatives_1(set_a, set_b, set_c, segm_d, elem_e);
185 
186     has_length_complementarity(set_a);
187     has_length_complementarity(set_b);
188     has_length_complementarity(set_c);
189 
190     has_length_as_distance<IntervalSetT,IntervalSetT>(set_a);
191     has_length_as_distance<IntervalSetT,IntervalSetT>(set_b);
192     has_length_as_distance<IntervalSetT,IntervalSetT>(set_c);
193 }
194 
195 #endif // LIBS_ICL_TEST_TEST_SET_INTERVAL_SET_SHARED_HPP_JOFA_090119
196