DGtal
1.4.0
Loading...
Searching...
No Matches
testContainerTraits.cpp
Go to the documentation of this file.
1
32
#include <vector>
33
#include <list>
34
#include <deque>
35
#include <set>
36
#include <map>
37
#include <boost/unordered_set.hpp>
38
#include <boost/unordered_map.hpp>
39
#include <forward_list>
40
#include <array>
41
#include <unordered_set>
42
#include <unordered_map>
43
44
#include "DGtal/base/Common.h"
45
#include "DGtal/base/ContainerTraits.h"
46
47
#include "DGtalCatch.h"
48
49
using namespace
DGtal
;
50
using namespace
std
;
51
52
53
TEST_CASE
(
"int container traits"
,
"[int][traits]"
)
54
{
55
typedef
int
Container;
56
SECTION
(
"Checking container traits"
)
57
{
58
REQUIRE
( (
IsContainer< Container >::value
==
false
) );
59
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
60
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
false
) );
61
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
62
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
63
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
64
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
65
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
66
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
67
}
68
}
69
70
TEST_CASE
(
"std::vector<> container traits"
,
"[vector][traits]"
)
71
{
72
typedef
std::vector<int> Container;
73
SECTION
(
"Checking container traits"
)
74
{
75
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
76
REQUIRE
( (
IsSequenceContainer< Container >::value
==
true
) );
77
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
false
) );
78
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
79
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
80
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
81
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
82
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
83
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
84
}
85
}
86
87
TEST_CASE
(
"std::list<> container traits"
,
"[list][traits]"
)
88
{
89
typedef
std::list<int> Container;
90
SECTION
(
"Checking container traits"
)
91
{
92
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
93
REQUIRE
( (
IsSequenceContainer< Container >::value
==
true
) );
94
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
false
) );
95
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
96
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
97
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
98
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
99
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
100
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
101
}
102
}
103
104
TEST_CASE
(
"std::deque<> container traits"
,
"[deque][traits]"
)
105
{
106
typedef
std::deque<int> Container;
107
SECTION
(
"Checking container traits"
)
108
{
109
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
110
REQUIRE
( (
IsSequenceContainer< Container >::value
==
true
) );
111
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
false
) );
112
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
113
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
114
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
115
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
116
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
117
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
118
}
119
}
120
121
TEST_CASE
(
"std::forward_list<> container traits"
,
"[forward_list][traits]"
)
122
{
123
typedef
std::forward_list<int> Container;
124
SECTION
(
"Checking container traits"
)
125
{
126
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
127
REQUIRE
( (
IsSequenceContainer< Container >::value
==
true
) );
128
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
false
) );
129
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
130
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
131
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
132
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
133
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
134
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
135
}
136
}
137
138
TEST_CASE
(
"std::array<> container traits"
,
"[array][traits]"
)
139
{
140
typedef
std::array<int, 10> Container;
141
SECTION
(
"Checking container traits"
)
142
{
143
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
144
REQUIRE
( (
IsSequenceContainer< Container >::value
==
true
) );
145
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
false
) );
146
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
147
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
148
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
149
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
150
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
151
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
152
}
153
}
154
155
TEST_CASE
(
"std::set<> container traits"
,
"[set][traits]"
)
156
{
157
typedef
std::set<int> Container;
158
SECTION
(
"Checking container traits"
)
159
{
160
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
161
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
162
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
163
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
true
) );
164
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
165
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
true
) );
166
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
167
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
true
) );
168
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
169
}
170
}
171
172
TEST_CASE
(
"std::multiset<> container traits"
,
"[multiset][traits]"
)
173
{
174
typedef
std::multiset<int> Container;
175
SECTION
(
"Checking container traits"
)
176
{
177
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
178
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
179
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
180
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
true
) );
181
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
182
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
true
) );
183
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
184
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
185
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
true
) );
186
}
187
}
188
189
TEST_CASE
(
"std::map<> container traits"
,
"[map][traits]"
)
190
{
191
typedef
std::map<int,int> Container;
192
SECTION
(
"Checking container traits"
)
193
{
194
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
195
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
196
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
197
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
true
) );
198
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
199
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
200
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
true
) );
201
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
true
) );
202
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
203
}
204
}
205
206
TEST_CASE
(
"std::multimap<> container traits"
,
"[multimap][traits]"
)
207
{
208
typedef
std::multimap<int,int> Container;
209
SECTION
(
"Checking container traits"
)
210
{
211
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
212
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
213
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
214
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
true
) );
215
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
false
) );
216
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
217
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
true
) );
218
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
219
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
true
) );
220
}
221
}
222
223
TEST_CASE
(
"boost::unordered_set<> container traits"
,
"[unordered_set][traits]"
)
224
{
225
typedef
boost::unordered_set<int> Container;
226
SECTION
(
"Checking container traits"
)
227
{
228
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
229
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
230
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
231
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
232
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
true
) );
233
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
true
) );
234
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
235
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
true
) );
236
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
237
}
238
}
239
240
TEST_CASE
(
"boost::unordered_map<> container traits"
,
"[unordered_map][traits]"
)
241
{
242
typedef
boost::unordered_map<int,int> Container;
243
SECTION
(
"Checking container traits"
)
244
{
245
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
246
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
247
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
248
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
249
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
true
) );
250
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
251
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
true
) );
252
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
true
) );
253
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
254
}
255
}
256
257
TEST_CASE
(
"boost::unordered_multiset<> container traits"
,
"[unordered_multiset][traits]"
)
258
{
259
typedef
boost::unordered_multiset<int> Container;
260
SECTION
(
"Checking container traits"
)
261
{
262
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
263
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
264
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
265
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
266
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
true
) );
267
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
true
) );
268
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
269
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
270
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
true
) );
271
}
272
}
273
274
TEST_CASE
(
"boost::unordered_multimap<> container traits"
,
"[unordered_multimap][traits]"
)
275
{
276
typedef
boost::unordered_multimap<int,int> Container;
277
SECTION
(
"Checking container traits"
)
278
{
279
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
280
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
281
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
282
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
283
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
true
) );
284
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
285
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
true
) );
286
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
287
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
true
) );
288
}
289
}
290
291
TEST_CASE
(
"std::unordered_set<> container traits"
,
"[unordered_set][traits]"
)
292
{
293
typedef
std::unordered_set<int> Container;
294
SECTION
(
"Checking container traits"
)
295
{
296
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
297
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
298
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
299
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
300
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
true
) );
301
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
true
) );
302
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
303
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
true
) );
304
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
305
}
306
}
307
TEST_CASE
(
"std::unordered_multiset<> container traits"
,
"[unordered_multiset][traits]"
)
308
{
309
typedef
std::unordered_multiset<int> Container;
310
SECTION
(
"Checking container traits"
)
311
{
312
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
313
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
314
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
315
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
316
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
true
) );
317
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
true
) );
318
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
false
) );
319
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
320
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
true
) );
321
}
322
}
323
324
TEST_CASE
(
"std::unordered_map<> container traits"
,
"[unordered_map][traits]"
)
325
{
326
typedef
std::unordered_map<int,int> Container;
327
SECTION
(
"Checking container traits"
)
328
{
329
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
330
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
331
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
332
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
333
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
true
) );
334
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
335
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
true
) );
336
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
true
) );
337
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
false
) );
338
}
339
}
340
341
TEST_CASE
(
"std::unordered_multimap<> container traits"
,
"[unordered_multimap][traits]"
)
342
{
343
typedef
std::unordered_multimap<int,int> Container;
344
SECTION
(
"Checking container traits"
)
345
{
346
REQUIRE
( (
IsContainer< Container >::value
==
true
) );
347
REQUIRE
( (
IsSequenceContainer< Container >::value
==
false
) );
348
REQUIRE
( (
IsAssociativeContainer< Container >::value
==
true
) );
349
REQUIRE
( (
IsOrderedAssociativeContainer< Container >::value
==
false
) );
350
REQUIRE
( (
IsUnorderedAssociativeContainer< Container >::value
==
true
) );
351
REQUIRE
( (
IsSimpleAssociativeContainer< Container >::value
==
false
) );
352
REQUIRE
( (
IsPairAssociativeContainer< Container >::value
==
true
) );
353
REQUIRE
( (
IsUniqueAssociativeContainer< Container >::value
==
false
) );
354
REQUIRE
( (
IsMultipleAssociativeContainer< Container >::value
==
true
) );
355
}
356
}
357
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
std
STL namespace.
DGtal::IsAssociativeContainer
Definition
ContainerTraits.h:337
DGtal::IsContainer
Definition
ContainerTraits.h:317
DGtal::IsMultipleAssociativeContainer
Definition
ContainerTraits.h:397
DGtal::IsOrderedAssociativeContainer
Definition
ContainerTraits.h:347
DGtal::IsPairAssociativeContainer
Definition
ContainerTraits.h:377
DGtal::IsSequenceContainer
Definition
ContainerTraits.h:327
DGtal::IsSimpleAssociativeContainer
Definition
ContainerTraits.h:367
DGtal::IsUniqueAssociativeContainer
Definition
ContainerTraits.h:387
DGtal::IsUnorderedAssociativeContainer
Definition
ContainerTraits.h:357
TEST_CASE
TEST_CASE("int container traits", "[int][traits]")
Definition
testContainerTraits.cpp:53
SECTION
SECTION("Testing constant forward iterators")
Definition
testSimpleRandomAccessRangeFromPoint.cpp:66
REQUIRE
REQUIRE(domain.isInside(aPoint))
tests
base
testContainerTraits.cpp
Generated on Mon Jun 10 2024 17:36:09 for DGtal by
1.11.0