-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_erase_size.cpp
521 lines (508 loc) · 25 KB
/
test_erase_size.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
#include <gtest/gtest.h>
#include <algorithm>
#include <vector>
#include "rangesizeset.h"
static void setup(HyoutaUtilities::RangeSizeSet<std::size_t>& rs) {
rs.insert(10, 20);
rs.insert(21, 30);
rs.insert(50, 65);
rs.insert(70, 71);
rs.insert(75, 90);
ASSERT_TRUE(rs.size() == 5);
}
static HyoutaUtilities::RangeSizeSet<std::size_t> r(std::vector<std::size_t> v) {
HyoutaUtilities::RangeSizeSet<std::size_t> rs;
for (std::size_t i = 1; i < v.size(); i += 2) {
rs.insert(v[i - 1], v[i]);
}
return rs;
}
static HyoutaUtilities::RangeSizeSet<std::size_t> without(std::size_t from, std::size_t to) {
HyoutaUtilities::RangeSizeSet<std::size_t> rs;
setup(rs);
rs.erase(from, to);
return rs;
}
static void check(const HyoutaUtilities::RangeSizeSet<std::size_t>& actual, const std::vector<std::size_t>& expected_vec) {
HyoutaUtilities::RangeSizeSet<std::size_t> expected = r(expected_vec);
EXPECT_TRUE(actual == expected);
ASSERT_TRUE(expected_vec.size() % 2 == 0);
std::vector<std::size_t> sizes;
for (std::size_t i = 0; i < expected_vec.size(); i += 2) {
sizes.push_back(expected_vec[i + 1] - expected_vec[i]);
}
std::sort(sizes.begin(), sizes.end());
std::reverse(sizes.begin(), sizes.end());
std::size_t idx = 0;
for (auto it = actual.by_size_begin(); it != actual.by_size_end(); ++it) {
std::size_t actual_size = it.to() - it.from();
EXPECT_TRUE(actual_size == sizes[idx]);
++idx;
}
}
TEST(EraseSizeTest, Tests) {
check(without(5, 8), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(5, 10), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(5, 14), {14, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(5, 15), {15, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(5, 20), {21, 30, 50, 65, 70, 71, 75, 90});
check(without(5, 21), {21, 30, 50, 65, 70, 71, 75, 90});
check(without(5, 25), {25, 30, 50, 65, 70, 71, 75, 90});
check(without(5, 28), {28, 30, 50, 65, 70, 71, 75, 90});
check(without(5, 30), {50, 65, 70, 71, 75, 90});
check(without(5, 35), {50, 65, 70, 71, 75, 90});
check(without(5, 40), {50, 65, 70, 71, 75, 90});
check(without(5, 45), {50, 65, 70, 71, 75, 90});
check(without(5, 50), {50, 65, 70, 71, 75, 90});
check(without(5, 55), {55, 65, 70, 71, 75, 90});
check(without(5, 60), {60, 65, 70, 71, 75, 90});
check(without(5, 65), {70, 71, 75, 90});
check(without(5, 67), {70, 71, 75, 90});
check(without(5, 68), {70, 71, 75, 90});
check(without(5, 70), {70, 71, 75, 90});
check(without(5, 71), {75, 90});
check(without(5, 72), {75, 90});
check(without(5, 73), {75, 90});
check(without(5, 75), {75, 90});
check(without(5, 80), {80, 90});
check(without(5, 85), {85, 90});
check(without(5, 90), {});
check(without(5, 95), {});
check(without(5, 100), {});
check(without(8, 10), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(8, 14), {14, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(8, 15), {15, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(8, 20), {21, 30, 50, 65, 70, 71, 75, 90});
check(without(8, 21), {21, 30, 50, 65, 70, 71, 75, 90});
check(without(8, 25), {25, 30, 50, 65, 70, 71, 75, 90});
check(without(8, 28), {28, 30, 50, 65, 70, 71, 75, 90});
check(without(8, 30), {50, 65, 70, 71, 75, 90});
check(without(8, 35), {50, 65, 70, 71, 75, 90});
check(without(8, 40), {50, 65, 70, 71, 75, 90});
check(without(8, 45), {50, 65, 70, 71, 75, 90});
check(without(8, 50), {50, 65, 70, 71, 75, 90});
check(without(8, 55), {55, 65, 70, 71, 75, 90});
check(without(8, 60), {60, 65, 70, 71, 75, 90});
check(without(8, 65), {70, 71, 75, 90});
check(without(8, 67), {70, 71, 75, 90});
check(without(8, 68), {70, 71, 75, 90});
check(without(8, 70), {70, 71, 75, 90});
check(without(8, 71), {75, 90});
check(without(8, 72), {75, 90});
check(without(8, 73), {75, 90});
check(without(8, 75), {75, 90});
check(without(8, 80), {80, 90});
check(without(8, 85), {85, 90});
check(without(8, 90), {});
check(without(8, 95), {});
check(without(8, 100), {});
check(without(10, 14), {14, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(10, 15), {15, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(10, 20), {21, 30, 50, 65, 70, 71, 75, 90});
check(without(10, 21), {21, 30, 50, 65, 70, 71, 75, 90});
check(without(10, 25), {25, 30, 50, 65, 70, 71, 75, 90});
check(without(10, 28), {28, 30, 50, 65, 70, 71, 75, 90});
check(without(10, 30), {50, 65, 70, 71, 75, 90});
check(without(10, 35), {50, 65, 70, 71, 75, 90});
check(without(10, 40), {50, 65, 70, 71, 75, 90});
check(without(10, 45), {50, 65, 70, 71, 75, 90});
check(without(10, 50), {50, 65, 70, 71, 75, 90});
check(without(10, 55), {55, 65, 70, 71, 75, 90});
check(without(10, 60), {60, 65, 70, 71, 75, 90});
check(without(10, 65), {70, 71, 75, 90});
check(without(10, 67), {70, 71, 75, 90});
check(without(10, 68), {70, 71, 75, 90});
check(without(10, 70), {70, 71, 75, 90});
check(without(10, 71), {75, 90});
check(without(10, 72), {75, 90});
check(without(10, 73), {75, 90});
check(without(10, 75), {75, 90});
check(without(10, 80), {80, 90});
check(without(10, 85), {85, 90});
check(without(10, 90), {});
check(without(10, 95), {});
check(without(10, 100), {});
check(without(14, 15), {10, 14, 15, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(14, 20), {10, 14, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(14, 21), {10, 14, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(14, 25), {10, 14, 25, 30, 50, 65, 70, 71, 75, 90});
check(without(14, 28), {10, 14, 28, 30, 50, 65, 70, 71, 75, 90});
check(without(14, 30), {10, 14, 50, 65, 70, 71, 75, 90});
check(without(14, 35), {10, 14, 50, 65, 70, 71, 75, 90});
check(without(14, 40), {10, 14, 50, 65, 70, 71, 75, 90});
check(without(14, 45), {10, 14, 50, 65, 70, 71, 75, 90});
check(without(14, 50), {10, 14, 50, 65, 70, 71, 75, 90});
check(without(14, 55), {10, 14, 55, 65, 70, 71, 75, 90});
check(without(14, 60), {10, 14, 60, 65, 70, 71, 75, 90});
check(without(14, 65), {10, 14, 70, 71, 75, 90});
check(without(14, 67), {10, 14, 70, 71, 75, 90});
check(without(14, 68), {10, 14, 70, 71, 75, 90});
check(without(14, 70), {10, 14, 70, 71, 75, 90});
check(without(14, 71), {10, 14, 75, 90});
check(without(14, 72), {10, 14, 75, 90});
check(without(14, 73), {10, 14, 75, 90});
check(without(14, 75), {10, 14, 75, 90});
check(without(14, 80), {10, 14, 80, 90});
check(without(14, 85), {10, 14, 85, 90});
check(without(14, 90), {10, 14});
check(without(14, 95), {10, 14});
check(without(14, 100), {10, 14});
check(without(15, 20), {10, 15, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(15, 21), {10, 15, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(15, 25), {10, 15, 25, 30, 50, 65, 70, 71, 75, 90});
check(without(15, 28), {10, 15, 28, 30, 50, 65, 70, 71, 75, 90});
check(without(15, 30), {10, 15, 50, 65, 70, 71, 75, 90});
check(without(15, 35), {10, 15, 50, 65, 70, 71, 75, 90});
check(without(15, 40), {10, 15, 50, 65, 70, 71, 75, 90});
check(without(15, 45), {10, 15, 50, 65, 70, 71, 75, 90});
check(without(15, 50), {10, 15, 50, 65, 70, 71, 75, 90});
check(without(15, 55), {10, 15, 55, 65, 70, 71, 75, 90});
check(without(15, 60), {10, 15, 60, 65, 70, 71, 75, 90});
check(without(15, 65), {10, 15, 70, 71, 75, 90});
check(without(15, 67), {10, 15, 70, 71, 75, 90});
check(without(15, 68), {10, 15, 70, 71, 75, 90});
check(without(15, 70), {10, 15, 70, 71, 75, 90});
check(without(15, 71), {10, 15, 75, 90});
check(without(15, 72), {10, 15, 75, 90});
check(without(15, 73), {10, 15, 75, 90});
check(without(15, 75), {10, 15, 75, 90});
check(without(15, 80), {10, 15, 80, 90});
check(without(15, 85), {10, 15, 85, 90});
check(without(15, 90), {10, 15});
check(without(15, 95), {10, 15});
check(without(15, 100), {10, 15});
check(without(20, 21), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(20, 25), {10, 20, 25, 30, 50, 65, 70, 71, 75, 90});
check(without(20, 28), {10, 20, 28, 30, 50, 65, 70, 71, 75, 90});
check(without(20, 30), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(20, 35), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(20, 40), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(20, 45), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(20, 50), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(20, 55), {10, 20, 55, 65, 70, 71, 75, 90});
check(without(20, 60), {10, 20, 60, 65, 70, 71, 75, 90});
check(without(20, 65), {10, 20, 70, 71, 75, 90});
check(without(20, 67), {10, 20, 70, 71, 75, 90});
check(without(20, 68), {10, 20, 70, 71, 75, 90});
check(without(20, 70), {10, 20, 70, 71, 75, 90});
check(without(20, 71), {10, 20, 75, 90});
check(without(20, 72), {10, 20, 75, 90});
check(without(20, 73), {10, 20, 75, 90});
check(without(20, 75), {10, 20, 75, 90});
check(without(20, 80), {10, 20, 80, 90});
check(without(20, 85), {10, 20, 85, 90});
check(without(20, 90), {10, 20});
check(without(20, 95), {10, 20});
check(without(20, 100), {10, 20});
check(without(21, 25), {10, 20, 25, 30, 50, 65, 70, 71, 75, 90});
check(without(21, 28), {10, 20, 28, 30, 50, 65, 70, 71, 75, 90});
check(without(21, 30), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(21, 35), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(21, 40), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(21, 45), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(21, 50), {10, 20, 50, 65, 70, 71, 75, 90});
check(without(21, 55), {10, 20, 55, 65, 70, 71, 75, 90});
check(without(21, 60), {10, 20, 60, 65, 70, 71, 75, 90});
check(without(21, 65), {10, 20, 70, 71, 75, 90});
check(without(21, 67), {10, 20, 70, 71, 75, 90});
check(without(21, 68), {10, 20, 70, 71, 75, 90});
check(without(21, 70), {10, 20, 70, 71, 75, 90});
check(without(21, 71), {10, 20, 75, 90});
check(without(21, 72), {10, 20, 75, 90});
check(without(21, 73), {10, 20, 75, 90});
check(without(21, 75), {10, 20, 75, 90});
check(without(21, 80), {10, 20, 80, 90});
check(without(21, 85), {10, 20, 85, 90});
check(without(21, 90), {10, 20});
check(without(21, 95), {10, 20});
check(without(21, 100), {10, 20});
check(without(25, 28), {10, 20, 21, 25, 28, 30, 50, 65, 70, 71, 75, 90});
check(without(25, 30), {10, 20, 21, 25, 50, 65, 70, 71, 75, 90});
check(without(25, 35), {10, 20, 21, 25, 50, 65, 70, 71, 75, 90});
check(without(25, 40), {10, 20, 21, 25, 50, 65, 70, 71, 75, 90});
check(without(25, 45), {10, 20, 21, 25, 50, 65, 70, 71, 75, 90});
check(without(25, 50), {10, 20, 21, 25, 50, 65, 70, 71, 75, 90});
check(without(25, 55), {10, 20, 21, 25, 55, 65, 70, 71, 75, 90});
check(without(25, 60), {10, 20, 21, 25, 60, 65, 70, 71, 75, 90});
check(without(25, 65), {10, 20, 21, 25, 70, 71, 75, 90});
check(without(25, 67), {10, 20, 21, 25, 70, 71, 75, 90});
check(without(25, 68), {10, 20, 21, 25, 70, 71, 75, 90});
check(without(25, 70), {10, 20, 21, 25, 70, 71, 75, 90});
check(without(25, 71), {10, 20, 21, 25, 75, 90});
check(without(25, 72), {10, 20, 21, 25, 75, 90});
check(without(25, 73), {10, 20, 21, 25, 75, 90});
check(without(25, 75), {10, 20, 21, 25, 75, 90});
check(without(25, 80), {10, 20, 21, 25, 80, 90});
check(without(25, 85), {10, 20, 21, 25, 85, 90});
check(without(25, 90), {10, 20, 21, 25});
check(without(25, 95), {10, 20, 21, 25});
check(without(25, 100), {10, 20, 21, 25});
check(without(28, 30), {10, 20, 21, 28, 50, 65, 70, 71, 75, 90});
check(without(28, 35), {10, 20, 21, 28, 50, 65, 70, 71, 75, 90});
check(without(28, 40), {10, 20, 21, 28, 50, 65, 70, 71, 75, 90});
check(without(28, 45), {10, 20, 21, 28, 50, 65, 70, 71, 75, 90});
check(without(28, 50), {10, 20, 21, 28, 50, 65, 70, 71, 75, 90});
check(without(28, 55), {10, 20, 21, 28, 55, 65, 70, 71, 75, 90});
check(without(28, 60), {10, 20, 21, 28, 60, 65, 70, 71, 75, 90});
check(without(28, 65), {10, 20, 21, 28, 70, 71, 75, 90});
check(without(28, 67), {10, 20, 21, 28, 70, 71, 75, 90});
check(without(28, 68), {10, 20, 21, 28, 70, 71, 75, 90});
check(without(28, 70), {10, 20, 21, 28, 70, 71, 75, 90});
check(without(28, 71), {10, 20, 21, 28, 75, 90});
check(without(28, 72), {10, 20, 21, 28, 75, 90});
check(without(28, 73), {10, 20, 21, 28, 75, 90});
check(without(28, 75), {10, 20, 21, 28, 75, 90});
check(without(28, 80), {10, 20, 21, 28, 80, 90});
check(without(28, 85), {10, 20, 21, 28, 85, 90});
check(without(28, 90), {10, 20, 21, 28});
check(without(28, 95), {10, 20, 21, 28});
check(without(28, 100), {10, 20, 21, 28});
check(without(30, 35), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(30, 40), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(30, 45), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(30, 50), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(30, 55), {10, 20, 21, 30, 55, 65, 70, 71, 75, 90});
check(without(30, 60), {10, 20, 21, 30, 60, 65, 70, 71, 75, 90});
check(without(30, 65), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(30, 67), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(30, 68), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(30, 70), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(30, 71), {10, 20, 21, 30, 75, 90});
check(without(30, 72), {10, 20, 21, 30, 75, 90});
check(without(30, 73), {10, 20, 21, 30, 75, 90});
check(without(30, 75), {10, 20, 21, 30, 75, 90});
check(without(30, 80), {10, 20, 21, 30, 80, 90});
check(without(30, 85), {10, 20, 21, 30, 85, 90});
check(without(30, 90), {10, 20, 21, 30});
check(without(30, 95), {10, 20, 21, 30});
check(without(30, 100), {10, 20, 21, 30});
check(without(35, 40), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(35, 45), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(35, 50), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(35, 55), {10, 20, 21, 30, 55, 65, 70, 71, 75, 90});
check(without(35, 60), {10, 20, 21, 30, 60, 65, 70, 71, 75, 90});
check(without(35, 65), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(35, 67), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(35, 68), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(35, 70), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(35, 71), {10, 20, 21, 30, 75, 90});
check(without(35, 72), {10, 20, 21, 30, 75, 90});
check(without(35, 73), {10, 20, 21, 30, 75, 90});
check(without(35, 75), {10, 20, 21, 30, 75, 90});
check(without(35, 80), {10, 20, 21, 30, 80, 90});
check(without(35, 85), {10, 20, 21, 30, 85, 90});
check(without(35, 90), {10, 20, 21, 30});
check(without(35, 95), {10, 20, 21, 30});
check(without(35, 100), {10, 20, 21, 30});
check(without(40, 45), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(40, 50), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(40, 55), {10, 20, 21, 30, 55, 65, 70, 71, 75, 90});
check(without(40, 60), {10, 20, 21, 30, 60, 65, 70, 71, 75, 90});
check(without(40, 65), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(40, 67), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(40, 68), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(40, 70), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(40, 71), {10, 20, 21, 30, 75, 90});
check(without(40, 72), {10, 20, 21, 30, 75, 90});
check(without(40, 73), {10, 20, 21, 30, 75, 90});
check(without(40, 75), {10, 20, 21, 30, 75, 90});
check(without(40, 80), {10, 20, 21, 30, 80, 90});
check(without(40, 85), {10, 20, 21, 30, 85, 90});
check(without(40, 90), {10, 20, 21, 30});
check(without(40, 95), {10, 20, 21, 30});
check(without(40, 100), {10, 20, 21, 30});
check(without(45, 50), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(45, 55), {10, 20, 21, 30, 55, 65, 70, 71, 75, 90});
check(without(45, 60), {10, 20, 21, 30, 60, 65, 70, 71, 75, 90});
check(without(45, 65), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(45, 67), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(45, 68), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(45, 70), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(45, 71), {10, 20, 21, 30, 75, 90});
check(without(45, 72), {10, 20, 21, 30, 75, 90});
check(without(45, 73), {10, 20, 21, 30, 75, 90});
check(without(45, 75), {10, 20, 21, 30, 75, 90});
check(without(45, 80), {10, 20, 21, 30, 80, 90});
check(without(45, 85), {10, 20, 21, 30, 85, 90});
check(without(45, 90), {10, 20, 21, 30});
check(without(45, 95), {10, 20, 21, 30});
check(without(45, 100), {10, 20, 21, 30});
check(without(50, 55), {10, 20, 21, 30, 55, 65, 70, 71, 75, 90});
check(without(50, 60), {10, 20, 21, 30, 60, 65, 70, 71, 75, 90});
check(without(50, 65), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(50, 67), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(50, 68), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(50, 70), {10, 20, 21, 30, 70, 71, 75, 90});
check(without(50, 71), {10, 20, 21, 30, 75, 90});
check(without(50, 72), {10, 20, 21, 30, 75, 90});
check(without(50, 73), {10, 20, 21, 30, 75, 90});
check(without(50, 75), {10, 20, 21, 30, 75, 90});
check(without(50, 80), {10, 20, 21, 30, 80, 90});
check(without(50, 85), {10, 20, 21, 30, 85, 90});
check(without(50, 90), {10, 20, 21, 30});
check(without(50, 95), {10, 20, 21, 30});
check(without(50, 100), {10, 20, 21, 30});
check(without(55, 60), {10, 20, 21, 30, 50, 55, 60, 65, 70, 71, 75, 90});
check(without(55, 65), {10, 20, 21, 30, 50, 55, 70, 71, 75, 90});
check(without(55, 67), {10, 20, 21, 30, 50, 55, 70, 71, 75, 90});
check(without(55, 68), {10, 20, 21, 30, 50, 55, 70, 71, 75, 90});
check(without(55, 70), {10, 20, 21, 30, 50, 55, 70, 71, 75, 90});
check(without(55, 71), {10, 20, 21, 30, 50, 55, 75, 90});
check(without(55, 72), {10, 20, 21, 30, 50, 55, 75, 90});
check(without(55, 73), {10, 20, 21, 30, 50, 55, 75, 90});
check(without(55, 75), {10, 20, 21, 30, 50, 55, 75, 90});
check(without(55, 80), {10, 20, 21, 30, 50, 55, 80, 90});
check(without(55, 85), {10, 20, 21, 30, 50, 55, 85, 90});
check(without(55, 90), {10, 20, 21, 30, 50, 55});
check(without(55, 95), {10, 20, 21, 30, 50, 55});
check(without(55, 100), {10, 20, 21, 30, 50, 55});
check(without(60, 65), {10, 20, 21, 30, 50, 60, 70, 71, 75, 90});
check(without(60, 67), {10, 20, 21, 30, 50, 60, 70, 71, 75, 90});
check(without(60, 68), {10, 20, 21, 30, 50, 60, 70, 71, 75, 90});
check(without(60, 70), {10, 20, 21, 30, 50, 60, 70, 71, 75, 90});
check(without(60, 71), {10, 20, 21, 30, 50, 60, 75, 90});
check(without(60, 72), {10, 20, 21, 30, 50, 60, 75, 90});
check(without(60, 73), {10, 20, 21, 30, 50, 60, 75, 90});
check(without(60, 75), {10, 20, 21, 30, 50, 60, 75, 90});
check(without(60, 80), {10, 20, 21, 30, 50, 60, 80, 90});
check(without(60, 85), {10, 20, 21, 30, 50, 60, 85, 90});
check(without(60, 90), {10, 20, 21, 30, 50, 60});
check(without(60, 95), {10, 20, 21, 30, 50, 60});
check(without(60, 100), {10, 20, 21, 30, 50, 60});
check(without(65, 67), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(65, 68), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(65, 70), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(65, 71), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(65, 72), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(65, 73), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(65, 75), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(65, 80), {10, 20, 21, 30, 50, 65, 80, 90});
check(without(65, 85), {10, 20, 21, 30, 50, 65, 85, 90});
check(without(65, 90), {10, 20, 21, 30, 50, 65});
check(without(65, 95), {10, 20, 21, 30, 50, 65});
check(without(65, 100), {10, 20, 21, 30, 50, 65});
check(without(67, 68), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(67, 70), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(67, 71), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(67, 72), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(67, 73), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(67, 75), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(67, 80), {10, 20, 21, 30, 50, 65, 80, 90});
check(without(67, 85), {10, 20, 21, 30, 50, 65, 85, 90});
check(without(67, 90), {10, 20, 21, 30, 50, 65});
check(without(67, 95), {10, 20, 21, 30, 50, 65});
check(without(67, 100), {10, 20, 21, 30, 50, 65});
check(without(68, 70), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(68, 71), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(68, 72), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(68, 73), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(68, 75), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(68, 80), {10, 20, 21, 30, 50, 65, 80, 90});
check(without(68, 85), {10, 20, 21, 30, 50, 65, 85, 90});
check(without(68, 90), {10, 20, 21, 30, 50, 65});
check(without(68, 95), {10, 20, 21, 30, 50, 65});
check(without(68, 100), {10, 20, 21, 30, 50, 65});
check(without(70, 71), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(70, 72), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(70, 73), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(70, 75), {10, 20, 21, 30, 50, 65, 75, 90});
check(without(70, 80), {10, 20, 21, 30, 50, 65, 80, 90});
check(without(70, 85), {10, 20, 21, 30, 50, 65, 85, 90});
check(without(70, 90), {10, 20, 21, 30, 50, 65});
check(without(70, 95), {10, 20, 21, 30, 50, 65});
check(without(70, 100), {10, 20, 21, 30, 50, 65});
check(without(71, 72), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(71, 73), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(71, 75), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(71, 80), {10, 20, 21, 30, 50, 65, 70, 71, 80, 90});
check(without(71, 85), {10, 20, 21, 30, 50, 65, 70, 71, 85, 90});
check(without(71, 90), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(71, 95), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(71, 100), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(72, 73), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(72, 75), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(72, 80), {10, 20, 21, 30, 50, 65, 70, 71, 80, 90});
check(without(72, 85), {10, 20, 21, 30, 50, 65, 70, 71, 85, 90});
check(without(72, 90), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(72, 95), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(72, 100), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(73, 75), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(73, 80), {10, 20, 21, 30, 50, 65, 70, 71, 80, 90});
check(without(73, 85), {10, 20, 21, 30, 50, 65, 70, 71, 85, 90});
check(without(73, 90), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(73, 95), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(73, 100), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(75, 80), {10, 20, 21, 30, 50, 65, 70, 71, 80, 90});
check(without(75, 85), {10, 20, 21, 30, 50, 65, 70, 71, 85, 90});
check(without(75, 90), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(75, 95), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(75, 100), {10, 20, 21, 30, 50, 65, 70, 71});
check(without(80, 85), {10, 20, 21, 30, 50, 65, 70, 71, 75, 80, 85, 90});
check(without(80, 90), {10, 20, 21, 30, 50, 65, 70, 71, 75, 80});
check(without(80, 95), {10, 20, 21, 30, 50, 65, 70, 71, 75, 80});
check(without(80, 100), {10, 20, 21, 30, 50, 65, 70, 71, 75, 80});
check(without(85, 90), {10, 20, 21, 30, 50, 65, 70, 71, 75, 85});
check(without(85, 95), {10, 20, 21, 30, 50, 65, 70, 71, 75, 85});
check(without(85, 100), {10, 20, 21, 30, 50, 65, 70, 71, 75, 85});
check(without(90, 95), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(90, 100), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
check(without(95, 100), {10, 20, 21, 30, 50, 65, 70, 71, 75, 90});
}
TEST(EraseSizeTest, ViaIterator) {
HyoutaUtilities::RangeSizeSet<std::size_t> r;
r.insert(1, 5);
r.insert(7, 20);
r.insert(40, 44);
auto it = r.begin();
ASSERT_TRUE(it != r.end());
ASSERT_TRUE(it.from() == 1);
ASSERT_TRUE(it.to() == 5);
++it;
ASSERT_TRUE(it != r.end());
ASSERT_TRUE(it.from() == 7);
ASSERT_TRUE(it.to() == 20);
it = r.erase(it);
ASSERT_TRUE(it != r.end());
ASSERT_TRUE(it.from() == 40);
ASSERT_TRUE(it.to() == 44);
--it;
ASSERT_TRUE(it != r.end());
ASSERT_TRUE(it.from() == 1);
ASSERT_TRUE(it.to() == 5);
it = r.erase(it);
ASSERT_TRUE(it != r.end());
ASSERT_TRUE(it.from() == 40);
ASSERT_TRUE(it.to() == 44);
it = r.erase(it);
ASSERT_TRUE(it == r.end());
ASSERT_TRUE(r.begin() == r.end());
}
TEST(EraseSizeTest, ViaSizeIterator) {
HyoutaUtilities::RangeSizeSet<std::size_t> r;
r.insert(1, 5);
r.insert(7, 20);
r.insert(40, 45);
auto it = r.by_size_begin();
ASSERT_TRUE(it != r.by_size_end());
ASSERT_TRUE(it.from() == 7);
ASSERT_TRUE(it.to() == 20);
++it;
ASSERT_TRUE(it != r.by_size_end());
ASSERT_TRUE(it.from() == 40);
ASSERT_TRUE(it.to() == 45);
it = r.erase(it);
ASSERT_TRUE(it != r.by_size_end());
ASSERT_TRUE(it.from() == 1);
ASSERT_TRUE(it.to() == 5);
--it;
ASSERT_TRUE(it != r.by_size_end());
ASSERT_TRUE(it.from() == 7);
ASSERT_TRUE(it.to() == 20);
it = r.erase(it);
ASSERT_TRUE(it != r.by_size_end());
ASSERT_TRUE(it.from() == 1);
ASSERT_TRUE(it.to() == 5);
it = r.erase(it);
ASSERT_TRUE(it == r.by_size_end());
ASSERT_TRUE(r.by_size_begin() == r.by_size_end());
}