• 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_INTERVAL_SET_LAWS_SHARED_HPP_JOFA_090201
9 #define LIBS_ICL_TEST_TEST_INTERVAL_SET_LAWS_SHARED_HPP_JOFA_090201
10 
11 
12 //------------------------------------------------------------------------------
13 // Monoid EAN
14 //------------------------------------------------------------------------------
15 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_monoid_plus_4_bicremental_types()16 void interval_set_check_monoid_plus_4_bicremental_types()
17 {
18     typedef IntervalSet<T> IntervalSetT;
19 
20     IntervalSetT set_a, set_b, set_c;
21     set_a.add(I_D(3,6)).add(I_I(5,7));
22     set_b.add(C_D(1,3)).add(I_D(8,9));
23     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
24 
25     typename IntervalSetT::segment_type segm = I_D(6,9);
26     T elem = make<T>(5);
27 
28     CHECK_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, segm, elem);
29     CHECK_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, segm, elem);
30 }
31 
32 
33 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_monoid_et_4_bicremental_types()34 void interval_set_check_monoid_et_4_bicremental_types()
35 {
36     typedef IntervalSet<T> IntervalSetT;
37 
38     IntervalSetT set_a, set_b, set_c;
39     set_a.add(I_D(3,6)).add(I_I(5,7));
40     set_b.add(C_D(1,3)).add(I_D(8,9));
41     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
42 
43     typename IntervalSetT::segment_type segm = I_D(6,9);
44     T elem = make<T>(5);
45 
46     CHECK_MONOID_INSTANCE_WRT(et)   (set_a, set_b, set_c, segm, elem);
47     CHECK_MONOID_INSTANCE_WRT(caret)(set_a, set_b, set_c, segm, elem);
48 }
49 
50 //------------------------------------------------------------------------------
51 // Abelian monoid EANC
52 //------------------------------------------------------------------------------
53 
54 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_abelian_monoid_plus_4_bicremental_types()55 void interval_set_check_abelian_monoid_plus_4_bicremental_types()
56 {
57     typedef IntervalSet<T> IntervalSetT;
58 
59     IntervalSetT set_a, set_b, set_c;
60     set_a.add(I_D(3,6)).add(I_I(5,7));
61     set_b.add(C_D(1,3)).add(I_D(8,9));
62     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
63 
64     typename IntervalSetT::segment_type segm = I_D(6,9);
65     T elem = make<T>(5);
66 
67     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, segm, elem);
68     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, segm, elem);
69 }
70 
71 
72 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_abelian_monoid_et_4_bicremental_types()73 void interval_set_check_abelian_monoid_et_4_bicremental_types()
74 {
75     typedef IntervalSet<T> IntervalSetT;
76 
77     IntervalSetT set_a, set_b, set_c;
78     set_a.add(I_D(3,6)).add(I_I(5,7));
79     set_b.add(C_D(1,3)).add(I_D(8,9));
80     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
81 
82     typename IntervalSetT::segment_type segm = I_D(6,9);
83     T elem = make<T>(5);
84 
85     CHECK_ABELIAN_MONOID_INSTANCE_WRT(et)   (set_a, set_b, set_c, segm, elem);
86     CHECK_ABELIAN_MONOID_INSTANCE_WRT(caret)(set_a, set_b, set_c, segm, elem);
87 }
88 
89 
90 //------------------------------------------------------------------------------
91 // Abelian partial invertive monoid
92 //------------------------------------------------------------------------------
93 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_partial_invertive_monoid_plus_4_bicremental_types()94 void interval_set_check_partial_invertive_monoid_plus_4_bicremental_types()
95 {
96     typedef IntervalSet<T> IntervalSetT;
97 
98     IntervalSetT set_a, set_b, set_c;
99     set_a.add(I_D(3,6)).add(I_I(5,7));
100     set_b.add(C_D(1,3)).add(I_D(8,9));
101     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
102 
103     typename IntervalSetT::segment_type segm = I_D(6,9);
104     T elem = make<T>(5);
105 
106     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, segm, elem);
107     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, segm, elem);
108 }
109 
110 //------------------------------------------------------------------------------
111 // Abelian partial invertive monoid with distinct equality for inversion
112 //------------------------------------------------------------------------------
113 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types()114 void interval_set_check_partial_invertive_monoid_plus_prot_inv_4_bicremental_types()
115 {
116     typedef IntervalSet<T> IntervalSetT;
117 
118     IntervalSetT set_a, set_b, set_c;
119     set_a.add(I_D(3,6)).add(I_I(5,7));
120     set_b.add(C_D(1,3)).add(I_D(8,9));
121     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
122 
123     typename IntervalSetT::segment_type segm = I_D(6,9);
124     T elem = make<T>(5);
125 
126     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus)(set_a, set_b, set_c, segm, elem);
127     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe)(set_a, set_b, set_c, segm, elem);
128 
129 #if !defined(_MSC_VER) || (_MSC_VER >= 1400) // 1310==MSVC-7.1  1400 ==MSVC-8.0
130     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(plus)(is_distinct_equal, set_a, set_b, set_c, segm, elem);
131     CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT_EQUAL(pipe)(is_distinct_equal, set_a, set_b, set_c, segm, elem);
132 #endif
133 }
134 
135 
136 //------------------------------------------------------------------------------
137 // Abelian group EANIC
138 //------------------------------------------------------------------------------
139 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_abelian_group_plus_4_bicremental_types()140 void interval_set_check_abelian_group_plus_4_bicremental_types()
141 {
142     typedef IntervalSet<T> IntervalSetT;
143 
144     IntervalSetT set_a, set_b, set_c;
145     set_a.add(I_D(3,6)).add(I_I(5,7));
146     set_b.add(C_D(1,3)).add(I_D(8,9));
147     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
148 
149     typename IntervalSetT::segment_type segm = I_D(6,9);
150     T elem = make<T>(5);
151 
152     CHECK_ABELIAN_GROUP_INSTANCE_WRT(plus) (set_a, set_b, set_c, segm, elem);
153     CHECK_ABELIAN_GROUP_INSTANCE_WRT(pipe) (set_a, set_b, set_c, segm, elem);
154 }
155 
156 //------------------------------------------------------------------------------
157 // (0 - x) + x =d= 0  |
158 //------------------------------------------------------------------------------
159 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
interval_set_check_abelian_group_plus_prot_inv_4_bicremental_types()160 void interval_set_check_abelian_group_plus_prot_inv_4_bicremental_types()
161 {
162     typedef IntervalSet<T> IntervalSetT;
163 
164     IntervalSetT set_a, set_b, set_c;
165     set_a.add(I_D(3,6)).add(I_I(5,7));
166     set_b.add(C_D(1,3)).add(I_D(8,9));
167     set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
168 
169     typename IntervalSetT::segment_type segm = I_D(6,9);
170     T elem = make<T>(5);
171 
172     CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, segm, elem);
173     CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, segm, elem);
174 
175 #if !defined(_MSC_VER) || (_MSC_VER >= 1400) // 1310==MSVC-7.1  1400 ==MSVC-8.0
176     CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(plus) (is_distinct_equal, set_a, set_b, set_c, segm, elem);
177     CHECK_ABELIAN_GROUP_INSTANCE_WRT_EQUAL(pipe) (is_distinct_equal, set_a, set_b, set_c, segm, elem);
178 #endif
179 }
180 
181 #endif // LIBS_ICL_TEST_TEST_INTERVAL_SET_LAWS_SHARED_HPP_JOFA_090201
182 
183