101 // NullMap |
101 // NullMap |
102 { |
102 { |
103 checkConcept<ReadWriteMap<A,B>, NullMap<A,B> >(); |
103 checkConcept<ReadWriteMap<A,B>, NullMap<A,B> >(); |
104 NullMap<A,B> map1; |
104 NullMap<A,B> map1; |
105 NullMap<A,B> map2 = map1; |
105 NullMap<A,B> map2 = map1; |
|
106 ignore_unused_variable_warning(map2); |
106 map1 = nullMap<A,B>(); |
107 map1 = nullMap<A,B>(); |
107 } |
108 } |
108 |
109 |
109 // ConstMap |
110 // ConstMap |
110 { |
111 { |
111 checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >(); |
112 checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >(); |
112 checkConcept<ReadWriteMap<A,C>, ConstMap<A,C> >(); |
113 checkConcept<ReadWriteMap<A,C>, ConstMap<A,C> >(); |
113 ConstMap<A,B> map1; |
114 ConstMap<A,B> map1; |
114 ConstMap<A,B> map2 = B(); |
115 ConstMap<A,B> map2 = B(); |
115 ConstMap<A,B> map3 = map1; |
116 ConstMap<A,B> map3 = map1; |
|
117 ignore_unused_variable_warning(map2,map3); |
|
118 |
116 map1 = constMap<A>(B()); |
119 map1 = constMap<A>(B()); |
117 map1 = constMap<A,B>(); |
120 map1 = constMap<A,B>(); |
118 map1.setAll(B()); |
121 map1.setAll(B()); |
119 ConstMap<A,C> map4(C(1)); |
122 ConstMap<A,C> map4(C(1)); |
120 ConstMap<A,C> map5 = map4; |
123 ConstMap<A,C> map5 = map4; |
|
124 ignore_unused_variable_warning(map5); |
|
125 |
121 map4 = constMap<A>(C(2)); |
126 map4 = constMap<A>(C(2)); |
122 map4.setAll(C(3)); |
127 map4.setAll(C(3)); |
123 |
128 |
124 checkConcept<ReadWriteMap<A,int>, ConstMap<A,int> >(); |
129 checkConcept<ReadWriteMap<A,int>, ConstMap<A,int> >(); |
125 check(constMap<A>(10)[A()] == 10, "Something is wrong with ConstMap"); |
130 check(constMap<A>(10)[A()] == 10, "Something is wrong with ConstMap"); |
136 // IdentityMap |
141 // IdentityMap |
137 { |
142 { |
138 checkConcept<ReadMap<A,A>, IdentityMap<A> >(); |
143 checkConcept<ReadMap<A,A>, IdentityMap<A> >(); |
139 IdentityMap<A> map1; |
144 IdentityMap<A> map1; |
140 IdentityMap<A> map2 = map1; |
145 IdentityMap<A> map2 = map1; |
|
146 ignore_unused_variable_warning(map2); |
|
147 |
141 map1 = identityMap<A>(); |
148 map1 = identityMap<A>(); |
142 |
149 |
143 checkConcept<ReadMap<double,double>, IdentityMap<double> >(); |
150 checkConcept<ReadMap<double,double>, IdentityMap<double> >(); |
144 check(identityMap<double>()[1.0] == 1.0 && |
151 check(identityMap<double>()[1.0] == 1.0 && |
145 identityMap<double>()[3.14] == 3.14, |
152 identityMap<double>()[3.14] == 3.14, |
195 // ComposeMap |
202 // ComposeMap |
196 { |
203 { |
197 typedef ComposeMap<DoubleMap, ReadMap<B,A> > CompMap; |
204 typedef ComposeMap<DoubleMap, ReadMap<B,A> > CompMap; |
198 checkConcept<ReadMap<B,double>, CompMap>(); |
205 checkConcept<ReadMap<B,double>, CompMap>(); |
199 CompMap map1 = CompMap(DoubleMap(),ReadMap<B,A>()); |
206 CompMap map1 = CompMap(DoubleMap(),ReadMap<B,A>()); |
|
207 ignore_unused_variable_warning(map1); |
200 CompMap map2 = composeMap(DoubleMap(), ReadMap<B,A>()); |
208 CompMap map2 = composeMap(DoubleMap(), ReadMap<B,A>()); |
|
209 ignore_unused_variable_warning(map2); |
201 |
210 |
202 SparseMap<double, bool> m1(false); m1[3.14] = true; |
211 SparseMap<double, bool> m1(false); m1[3.14] = true; |
203 RangeMap<double> m2(2); m2[0] = 3.0; m2[1] = 3.14; |
212 RangeMap<double> m2(2); m2[0] = 3.0; m2[1] = 3.14; |
204 check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1], |
213 check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1], |
205 "Something is wrong with ComposeMap") |
214 "Something is wrong with ComposeMap") |
208 // CombineMap |
217 // CombineMap |
209 { |
218 { |
210 typedef CombineMap<DoubleMap, DoubleMap, std::plus<double> > CombMap; |
219 typedef CombineMap<DoubleMap, DoubleMap, std::plus<double> > CombMap; |
211 checkConcept<ReadMap<A,double>, CombMap>(); |
220 checkConcept<ReadMap<A,double>, CombMap>(); |
212 CombMap map1 = CombMap(DoubleMap(), DoubleMap()); |
221 CombMap map1 = CombMap(DoubleMap(), DoubleMap()); |
|
222 ignore_unused_variable_warning(map1); |
213 CombMap map2 = combineMap(DoubleMap(), DoubleMap(), std::plus<double>()); |
223 CombMap map2 = combineMap(DoubleMap(), DoubleMap(), std::plus<double>()); |
|
224 ignore_unused_variable_warning(map2); |
214 |
225 |
215 check(combineMap(constMap<B,int,2>(), identityMap<B>(), &binc)[B()] == 3, |
226 check(combineMap(constMap<B,int,2>(), identityMap<B>(), &binc)[B()] == 3, |
216 "Something is wrong with CombineMap"); |
227 "Something is wrong with CombineMap"); |
217 } |
228 } |
218 |
229 |
220 { |
231 { |
221 checkConcept<ReadMap<A,B>, FunctorToMap<F,A,B> >(); |
232 checkConcept<ReadMap<A,B>, FunctorToMap<F,A,B> >(); |
222 checkConcept<ReadMap<A,B>, FunctorToMap<F> >(); |
233 checkConcept<ReadMap<A,B>, FunctorToMap<F> >(); |
223 FunctorToMap<F> map1; |
234 FunctorToMap<F> map1; |
224 FunctorToMap<F> map2 = FunctorToMap<F>(F()); |
235 FunctorToMap<F> map2 = FunctorToMap<F>(F()); |
|
236 ignore_unused_variable_warning(map2); |
|
237 |
225 B b = functorToMap(F())[A()]; |
238 B b = functorToMap(F())[A()]; |
|
239 ignore_unused_variable_warning(b); |
226 |
240 |
227 checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >(); |
241 checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >(); |
228 MapToFunctor<ReadMap<A,B> > map = |
242 MapToFunctor<ReadMap<A,B> > map = |
229 MapToFunctor<ReadMap<A,B> >(ReadMap<A,B>()); |
243 MapToFunctor<ReadMap<A,B> >(ReadMap<A,B>()); |
|
244 ignore_unused_variable_warning(map); |
230 |
245 |
231 check(functorToMap(&func)[A()] == 3, |
246 check(functorToMap(&func)[A()] == 3, |
232 "Something is wrong with FunctorToMap"); |
247 "Something is wrong with FunctorToMap"); |
233 check(mapToFunctor(constMap<A,int>(2))(A()) == 2, |
248 check(mapToFunctor(constMap<A,int>(2))(A()) == 2, |
234 "Something is wrong with MapToFunctor"); |
249 "Something is wrong with MapToFunctor"); |
242 // ConvertMap |
257 // ConvertMap |
243 { |
258 { |
244 checkConcept<ReadMap<double,double>, |
259 checkConcept<ReadMap<double,double>, |
245 ConvertMap<ReadMap<double, int>, double> >(); |
260 ConvertMap<ReadMap<double, int>, double> >(); |
246 ConvertMap<RangeMap<bool>, int> map1(rangeMap(1, true)); |
261 ConvertMap<RangeMap<bool>, int> map1(rangeMap(1, true)); |
|
262 ignore_unused_variable_warning(map1); |
247 ConvertMap<RangeMap<bool>, int> map2 = convertMap<int>(rangeMap(2, false)); |
263 ConvertMap<RangeMap<bool>, int> map2 = convertMap<int>(rangeMap(2, false)); |
|
264 ignore_unused_variable_warning(map2); |
|
265 |
248 } |
266 } |
249 |
267 |
250 // ForkMap |
268 // ForkMap |
251 { |
269 { |
252 checkConcept<DoubleWriteMap, ForkMap<DoubleWriteMap, DoubleWriteMap> >(); |
270 checkConcept<DoubleWriteMap, ForkMap<DoubleWriteMap, DoubleWriteMap> >(); |