| ... |
... |
@@ -64,49 +64,49 @@
|
| 64 |
64 |
{
|
| 65 |
65 |
// Map concepts
|
| 66 |
66 |
checkConcept<ReadMap<A,B>, ReadMap<A,B> >();
|
| 67 |
67 |
checkConcept<ReadMap<A,C>, ReadMap<A,C> >();
|
| 68 |
68 |
checkConcept<WriteMap<A,B>, WriteMap<A,B> >();
|
| 69 |
69 |
checkConcept<WriteMap<A,C>, WriteMap<A,C> >();
|
| 70 |
70 |
checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >();
|
| 71 |
71 |
checkConcept<ReadWriteMap<A,C>, ReadWriteMap<A,C> >();
|
| 72 |
72 |
checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >();
|
| 73 |
73 |
checkConcept<ReferenceMap<A,C,C&,const C&>, ReferenceMap<A,C,C&,const C&> >();
|
| 74 |
74 |
|
| 75 |
75 |
// NullMap
|
| 76 |
76 |
{
|
| 77 |
77 |
checkConcept<ReadWriteMap<A,B>, NullMap<A,B> >();
|
| 78 |
78 |
NullMap<A,B> map1;
|
| 79 |
79 |
NullMap<A,B> map2 = map1;
|
| 80 |
80 |
map1 = nullMap<A,B>();
|
| 81 |
81 |
}
|
| 82 |
82 |
|
| 83 |
83 |
// ConstMap
|
| 84 |
84 |
{
|
| 85 |
85 |
checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >();
|
| 86 |
86 |
checkConcept<ReadWriteMap<A,C>, ConstMap<A,C> >();
|
| 87 |
87 |
ConstMap<A,B> map1;
|
| 88 |
|
ConstMap<A,B> map2(B());
|
|
88 |
ConstMap<A,B> map2 = B();
|
| 89 |
89 |
ConstMap<A,B> map3 = map1;
|
| 90 |
90 |
map1 = constMap<A>(B());
|
| 91 |
91 |
map1 = constMap<A,B>();
|
| 92 |
92 |
map1.setAll(B());
|
| 93 |
93 |
ConstMap<A,C> map4(C(1));
|
| 94 |
94 |
ConstMap<A,C> map5 = map4;
|
| 95 |
95 |
map4 = constMap<A>(C(2));
|
| 96 |
96 |
map4.setAll(C(3));
|
| 97 |
97 |
|
| 98 |
98 |
checkConcept<ReadWriteMap<A,int>, ConstMap<A,int> >();
|
| 99 |
99 |
check(constMap<A>(10)[A()] == 10, "Something is wrong with ConstMap");
|
| 100 |
100 |
|
| 101 |
101 |
checkConcept<ReadWriteMap<A,int>, ConstMap<A,Const<int,10> > >();
|
| 102 |
102 |
ConstMap<A,Const<int,10> > map6;
|
| 103 |
103 |
ConstMap<A,Const<int,10> > map7 = map6;
|
| 104 |
104 |
map6 = constMap<A,int,10>();
|
| 105 |
105 |
map7 = constMap<A,Const<int,10> >();
|
| 106 |
106 |
check(map6[A()] == 10 && map7[A()] == 10, "Something is wrong with ConstMap");
|
| 107 |
107 |
}
|
| 108 |
108 |
|
| 109 |
109 |
// IdentityMap
|
| 110 |
110 |
{
|
| 111 |
111 |
checkConcept<ReadMap<A,A>, IdentityMap<A> >();
|
| 112 |
112 |
IdentityMap<A> map1;
|
| ... |
... |
@@ -122,49 +122,49 @@
|
| 122 |
122 |
{
|
| 123 |
123 |
checkConcept<ReferenceMap<int,B,B&,const B&>, RangeMap<B> >();
|
| 124 |
124 |
RangeMap<B> map1;
|
| 125 |
125 |
RangeMap<B> map2(10);
|
| 126 |
126 |
RangeMap<B> map3(10,B());
|
| 127 |
127 |
RangeMap<B> map4 = map1;
|
| 128 |
128 |
RangeMap<B> map5 = rangeMap<B>();
|
| 129 |
129 |
RangeMap<B> map6 = rangeMap<B>(10);
|
| 130 |
130 |
RangeMap<B> map7 = rangeMap(10,B());
|
| 131 |
131 |
|
| 132 |
132 |
checkConcept< ReferenceMap<int, double, double&, const double&>,
|
| 133 |
133 |
RangeMap<double> >();
|
| 134 |
134 |
std::vector<double> v(10, 0);
|
| 135 |
135 |
v[5] = 100;
|
| 136 |
136 |
RangeMap<double> map8(v);
|
| 137 |
137 |
RangeMap<double> map9 = rangeMap(v);
|
| 138 |
138 |
check(map9.size() == 10 && map9[2] == 0 && map9[5] == 100,
|
| 139 |
139 |
"Something is wrong with RangeMap");
|
| 140 |
140 |
}
|
| 141 |
141 |
|
| 142 |
142 |
// SparseMap
|
| 143 |
143 |
{
|
| 144 |
144 |
checkConcept<ReferenceMap<A,B,B&,const B&>, SparseMap<A,B> >();
|
| 145 |
145 |
SparseMap<A,B> map1;
|
| 146 |
|
SparseMap<A,B> map2(B());
|
|
146 |
SparseMap<A,B> map2 = B();
|
| 147 |
147 |
SparseMap<A,B> map3 = sparseMap<A,B>();
|
| 148 |
148 |
SparseMap<A,B> map4 = sparseMap<A>(B());
|
| 149 |
149 |
|
| 150 |
150 |
checkConcept< ReferenceMap<double, int, int&, const int&>,
|
| 151 |
151 |
SparseMap<double, int> >();
|
| 152 |
152 |
std::map<double, int> m;
|
| 153 |
153 |
SparseMap<double, int> map5(m);
|
| 154 |
154 |
SparseMap<double, int> map6(m,10);
|
| 155 |
155 |
SparseMap<double, int> map7 = sparseMap(m);
|
| 156 |
156 |
SparseMap<double, int> map8 = sparseMap(m,10);
|
| 157 |
157 |
|
| 158 |
158 |
check(map5[1.0] == 0 && map5[3.14] == 0 && map6[1.0] == 10 && map6[3.14] == 10,
|
| 159 |
159 |
"Something is wrong with SparseMap");
|
| 160 |
160 |
map5[1.0] = map6[3.14] = 100;
|
| 161 |
161 |
check(map5[1.0] == 100 && map5[3.14] == 0 && map6[1.0] == 10 && map6[3.14] == 100,
|
| 162 |
162 |
"Something is wrong with SparseMap");
|
| 163 |
163 |
}
|
| 164 |
164 |
|
| 165 |
165 |
// ComposeMap
|
| 166 |
166 |
{
|
| 167 |
167 |
typedef ComposeMap<DoubleMap, ReadMap<B,A> > CompMap;
|
| 168 |
168 |
checkConcept<ReadMap<B,double>, CompMap>();
|
| 169 |
169 |
CompMap map1(DoubleMap(),ReadMap<B,A>());
|
| 170 |
170 |
CompMap map2 = composeMap(DoubleMap(), ReadMap<B,A>());
|