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_ICL_SET_HPP_JOFA_090119
9 #define LIBS_ICL_TEST_TEST_SET_ICL_SET_HPP_JOFA_090119
10
11 #include "portability.hpp"
12
13 //------------------------------------------------------------------------------
14 // Monoid EAN
15 //------------------------------------------------------------------------------
16 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
itl_set_check_monoid_plus_4_bicremental_types()17 void itl_set_check_monoid_plus_4_bicremental_types()
18 {
19 typedef IntervalSet<T> IntervalSetT;
20 typedef std::set<T> SetT;
21
22 IntervalSetT itv_set_a, itv_set_b, itv_set_c;
23 itv_set_a.add(I_D(3,6)).add(I_I(5,7));
24 itv_set_b.add(C_D(1,3)).add(I_D(8,9));
25 itv_set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
26
27 SetT set_a, set_b, set_c;
28 segmental::atomize(set_a, itv_set_a);
29 segmental::atomize(set_b, itv_set_b);
30 segmental::atomize(set_c, itv_set_c);
31
32 T val1 = MK_v(7);
33 T val2 = MK_v(5);
34
35 CHECK_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, val1, val2);
36 CHECK_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, val1, val2);
37 }
38
39 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
itl_set_check_monoid_et_4_bicremental_types()40 void itl_set_check_monoid_et_4_bicremental_types()
41 {
42 typedef IntervalSet<T> IntervalSetT;
43 typedef std::set<T> SetT;
44
45 IntervalSetT itv_set_a, itv_set_b, itv_set_c;
46 itv_set_a.add(I_D(3,6)).add(I_I(5,7));
47 itv_set_b.add(C_D(1,3)).add(I_D(8,9));
48 itv_set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
49
50 SetT set_a, set_b, set_c;
51 segmental::atomize(set_a, itv_set_a);
52 segmental::atomize(set_b, itv_set_b);
53 segmental::atomize(set_c, itv_set_c);
54
55 T val1 = MK_v(7);
56 T val2 = MK_v(5);
57
58 CHECK_MONOID_INSTANCE_WRT(et) (set_a, set_b, set_c, val1, val2);
59 CHECK_MONOID_INSTANCE_WRT(caret)(set_a, set_b, set_c, val1, val2);
60 }
61
62 //------------------------------------------------------------------------------
63 // Abelian monoid EANC
64 //------------------------------------------------------------------------------
65
66 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
itl_set_check_abelian_monoid_plus_4_bicremental_types()67 void itl_set_check_abelian_monoid_plus_4_bicremental_types()
68 {
69 typedef IntervalSet<T> IntervalSetT;
70 typedef std::set<T> SetT;
71
72 IntervalSetT itv_set_a, itv_set_b, itv_set_c;
73 itv_set_a.add(I_D(3,6)).add(I_I(5,7));
74 itv_set_b.add(C_D(1,3)).add(I_D(8,9));
75 itv_set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
76
77 SetT set_a, set_b, set_c;
78 segmental::atomize(set_a, itv_set_a);
79 segmental::atomize(set_b, itv_set_b);
80 segmental::atomize(set_c, itv_set_c);
81
82 T val1 = MK_v(7);
83 T val2 = MK_v(5);
84
85 CHECK_ABELIAN_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, val1, val2);
86 CHECK_ABELIAN_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, val1, val2);
87 }
88
89 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
itl_set_check_abelian_monoid_et_4_bicremental_types()90 void itl_set_check_abelian_monoid_et_4_bicremental_types()
91 {
92 typedef IntervalSet<T> IntervalSetT;
93 typedef std::set<T> SetT;
94
95 IntervalSetT itv_set_a, itv_set_b, itv_set_c;
96 itv_set_a.add(I_D(3,6)).add(I_I(5,7));
97 itv_set_b.add(C_D(1,3)).add(I_D(8,9));
98 itv_set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
99
100 SetT set_a, set_b, set_c;
101 segmental::atomize(set_a, itv_set_a);
102 segmental::atomize(set_b, itv_set_b);
103 segmental::atomize(set_c, itv_set_c);
104
105 T val1 = MK_v(7);
106 T val2 = MK_v(5);
107
108 CHECK_ABELIAN_MONOID_INSTANCE_WRT(et) (set_a, set_b, set_c, val1, val2);
109 CHECK_ABELIAN_MONOID_INSTANCE_WRT(caret)(set_a, set_b, set_c, val1, val2);
110 }
111
112
113 //------------------------------------------------------------------------------
114 // Abelian partial invertive monoid
115 //------------------------------------------------------------------------------
116 template <class T, ICL_IntervalSet_TEMPLATE(_T) IntervalSet>
itl_set_check_partial_invertive_monoid_plus_4_bicremental_types()117 void itl_set_check_partial_invertive_monoid_plus_4_bicremental_types()
118 {
119 typedef IntervalSet<T> IntervalSetT;
120 typedef std::set<T> SetT;
121
122 IntervalSetT itv_set_a, itv_set_b, itv_set_c;
123 itv_set_a.add(I_D(3,6)).add(I_I(5,7));
124 itv_set_b.add(C_D(1,3)).add(I_D(8,9));
125 itv_set_c.add(I_D(0,9)).add(I_I(3,6)).add(I_D(5,7));
126
127 SetT set_a, set_b, set_c;
128 segmental::atomize(set_a, itv_set_a);
129 segmental::atomize(set_b, itv_set_b);
130 segmental::atomize(set_c, itv_set_c);
131
132 T val1 = MK_v(7);
133 T val2 = MK_v(5);
134
135 CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(plus) (set_a, set_b, set_c, val1, val2);
136 CHECK_PARTIAL_INVERTIVE_MONOID_INSTANCE_WRT(pipe) (set_a, set_b, set_c, val1, val2);
137 }
138
139 #endif // LIBS_ICL_TEST_TEST_SET_ICL_SET_HPP_JOFA_090119
140