-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_erase.cpp
471 lines (462 loc) · 27.7 KB
/
test_erase.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
#include <gtest/gtest.h>
#include <vector>
#include "rangeset.h"
static HyoutaUtilities::RangeSet<std::size_t> r(std::vector<std::size_t> v) {
HyoutaUtilities::RangeSet<std::size_t> rs;
for (std::size_t i = 1; i < v.size(); i += 2) {
rs.insert(v[i - 1], v[i]);
}
return rs;
}
class EraseTest : public ::testing::Test {
public:
HyoutaUtilities::RangeSet<std::size_t> rs;
void SetUp() override {
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);
}
HyoutaUtilities::RangeSet<std::size_t> without(std::size_t from, std::size_t to) {
HyoutaUtilities::RangeSet<std::size_t> tmp = rs;
tmp.erase(from, to);
return tmp;
}
};
TEST_F(EraseTest, Tests) {
EXPECT_TRUE(without(5, 8) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 10) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 14) == r({14, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 15) == r({15, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 20) == r({21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 21) == r({21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 25) == r({25, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 28) == r({28, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 30) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 35) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 40) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 45) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 50) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 55) == r({55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 60) == r({60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(5, 65) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(5, 67) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(5, 68) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(5, 70) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(5, 71) == r({75, 90}));
EXPECT_TRUE(without(5, 72) == r({75, 90}));
EXPECT_TRUE(without(5, 73) == r({75, 90}));
EXPECT_TRUE(without(5, 75) == r({75, 90}));
EXPECT_TRUE(without(5, 80) == r({80, 90}));
EXPECT_TRUE(without(5, 85) == r({85, 90}));
EXPECT_TRUE(without(5, 90) == r({}));
EXPECT_TRUE(without(5, 95) == r({}));
EXPECT_TRUE(without(5, 100) == r({}));
EXPECT_TRUE(without(8, 10) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 14) == r({14, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 15) == r({15, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 20) == r({21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 21) == r({21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 25) == r({25, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 28) == r({28, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 30) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 35) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 40) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 45) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 50) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 55) == r({55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 60) == r({60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(8, 65) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(8, 67) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(8, 68) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(8, 70) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(8, 71) == r({75, 90}));
EXPECT_TRUE(without(8, 72) == r({75, 90}));
EXPECT_TRUE(without(8, 73) == r({75, 90}));
EXPECT_TRUE(without(8, 75) == r({75, 90}));
EXPECT_TRUE(without(8, 80) == r({80, 90}));
EXPECT_TRUE(without(8, 85) == r({85, 90}));
EXPECT_TRUE(without(8, 90) == r({}));
EXPECT_TRUE(without(8, 95) == r({}));
EXPECT_TRUE(without(8, 100) == r({}));
EXPECT_TRUE(without(10, 14) == r({14, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 15) == r({15, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 20) == r({21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 21) == r({21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 25) == r({25, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 28) == r({28, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 30) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 35) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 40) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 45) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 50) == r({50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 55) == r({55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 60) == r({60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(10, 65) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(10, 67) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(10, 68) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(10, 70) == r({70, 71, 75, 90}));
EXPECT_TRUE(without(10, 71) == r({75, 90}));
EXPECT_TRUE(without(10, 72) == r({75, 90}));
EXPECT_TRUE(without(10, 73) == r({75, 90}));
EXPECT_TRUE(without(10, 75) == r({75, 90}));
EXPECT_TRUE(without(10, 80) == r({80, 90}));
EXPECT_TRUE(without(10, 85) == r({85, 90}));
EXPECT_TRUE(without(10, 90) == r({}));
EXPECT_TRUE(without(10, 95) == r({}));
EXPECT_TRUE(without(10, 100) == r({}));
EXPECT_TRUE(without(14, 15) == r({10, 14, 15, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 20) == r({10, 14, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 21) == r({10, 14, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 25) == r({10, 14, 25, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 28) == r({10, 14, 28, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 30) == r({10, 14, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 35) == r({10, 14, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 40) == r({10, 14, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 45) == r({10, 14, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 50) == r({10, 14, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 55) == r({10, 14, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 60) == r({10, 14, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 65) == r({10, 14, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 67) == r({10, 14, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 68) == r({10, 14, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 70) == r({10, 14, 70, 71, 75, 90}));
EXPECT_TRUE(without(14, 71) == r({10, 14, 75, 90}));
EXPECT_TRUE(without(14, 72) == r({10, 14, 75, 90}));
EXPECT_TRUE(without(14, 73) == r({10, 14, 75, 90}));
EXPECT_TRUE(without(14, 75) == r({10, 14, 75, 90}));
EXPECT_TRUE(without(14, 80) == r({10, 14, 80, 90}));
EXPECT_TRUE(without(14, 85) == r({10, 14, 85, 90}));
EXPECT_TRUE(without(14, 90) == r({10, 14}));
EXPECT_TRUE(without(14, 95) == r({10, 14}));
EXPECT_TRUE(without(14, 100) == r({10, 14}));
EXPECT_TRUE(without(15, 20) == r({10, 15, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 21) == r({10, 15, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 25) == r({10, 15, 25, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 28) == r({10, 15, 28, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 30) == r({10, 15, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 35) == r({10, 15, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 40) == r({10, 15, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 45) == r({10, 15, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 50) == r({10, 15, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 55) == r({10, 15, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 60) == r({10, 15, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 65) == r({10, 15, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 67) == r({10, 15, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 68) == r({10, 15, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 70) == r({10, 15, 70, 71, 75, 90}));
EXPECT_TRUE(without(15, 71) == r({10, 15, 75, 90}));
EXPECT_TRUE(without(15, 72) == r({10, 15, 75, 90}));
EXPECT_TRUE(without(15, 73) == r({10, 15, 75, 90}));
EXPECT_TRUE(without(15, 75) == r({10, 15, 75, 90}));
EXPECT_TRUE(without(15, 80) == r({10, 15, 80, 90}));
EXPECT_TRUE(without(15, 85) == r({10, 15, 85, 90}));
EXPECT_TRUE(without(15, 90) == r({10, 15}));
EXPECT_TRUE(without(15, 95) == r({10, 15}));
EXPECT_TRUE(without(15, 100) == r({10, 15}));
EXPECT_TRUE(without(20, 21) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 25) == r({10, 20, 25, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 28) == r({10, 20, 28, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 30) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 35) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 40) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 45) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 50) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 55) == r({10, 20, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 60) == r({10, 20, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 65) == r({10, 20, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 67) == r({10, 20, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 68) == r({10, 20, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 70) == r({10, 20, 70, 71, 75, 90}));
EXPECT_TRUE(without(20, 71) == r({10, 20, 75, 90}));
EXPECT_TRUE(without(20, 72) == r({10, 20, 75, 90}));
EXPECT_TRUE(without(20, 73) == r({10, 20, 75, 90}));
EXPECT_TRUE(without(20, 75) == r({10, 20, 75, 90}));
EXPECT_TRUE(without(20, 80) == r({10, 20, 80, 90}));
EXPECT_TRUE(without(20, 85) == r({10, 20, 85, 90}));
EXPECT_TRUE(without(20, 90) == r({10, 20}));
EXPECT_TRUE(without(20, 95) == r({10, 20}));
EXPECT_TRUE(without(20, 100) == r({10, 20}));
EXPECT_TRUE(without(21, 25) == r({10, 20, 25, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 28) == r({10, 20, 28, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 30) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 35) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 40) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 45) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 50) == r({10, 20, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 55) == r({10, 20, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 60) == r({10, 20, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 65) == r({10, 20, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 67) == r({10, 20, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 68) == r({10, 20, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 70) == r({10, 20, 70, 71, 75, 90}));
EXPECT_TRUE(without(21, 71) == r({10, 20, 75, 90}));
EXPECT_TRUE(without(21, 72) == r({10, 20, 75, 90}));
EXPECT_TRUE(without(21, 73) == r({10, 20, 75, 90}));
EXPECT_TRUE(without(21, 75) == r({10, 20, 75, 90}));
EXPECT_TRUE(without(21, 80) == r({10, 20, 80, 90}));
EXPECT_TRUE(without(21, 85) == r({10, 20, 85, 90}));
EXPECT_TRUE(without(21, 90) == r({10, 20}));
EXPECT_TRUE(without(21, 95) == r({10, 20}));
EXPECT_TRUE(without(21, 100) == r({10, 20}));
EXPECT_TRUE(without(25, 28) == r({10, 20, 21, 25, 28, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 30) == r({10, 20, 21, 25, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 35) == r({10, 20, 21, 25, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 40) == r({10, 20, 21, 25, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 45) == r({10, 20, 21, 25, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 50) == r({10, 20, 21, 25, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 55) == r({10, 20, 21, 25, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 60) == r({10, 20, 21, 25, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 65) == r({10, 20, 21, 25, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 67) == r({10, 20, 21, 25, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 68) == r({10, 20, 21, 25, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 70) == r({10, 20, 21, 25, 70, 71, 75, 90}));
EXPECT_TRUE(without(25, 71) == r({10, 20, 21, 25, 75, 90}));
EXPECT_TRUE(without(25, 72) == r({10, 20, 21, 25, 75, 90}));
EXPECT_TRUE(without(25, 73) == r({10, 20, 21, 25, 75, 90}));
EXPECT_TRUE(without(25, 75) == r({10, 20, 21, 25, 75, 90}));
EXPECT_TRUE(without(25, 80) == r({10, 20, 21, 25, 80, 90}));
EXPECT_TRUE(without(25, 85) == r({10, 20, 21, 25, 85, 90}));
EXPECT_TRUE(without(25, 90) == r({10, 20, 21, 25}));
EXPECT_TRUE(without(25, 95) == r({10, 20, 21, 25}));
EXPECT_TRUE(without(25, 100) == r({10, 20, 21, 25}));
EXPECT_TRUE(without(28, 30) == r({10, 20, 21, 28, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 35) == r({10, 20, 21, 28, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 40) == r({10, 20, 21, 28, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 45) == r({10, 20, 21, 28, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 50) == r({10, 20, 21, 28, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 55) == r({10, 20, 21, 28, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 60) == r({10, 20, 21, 28, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 65) == r({10, 20, 21, 28, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 67) == r({10, 20, 21, 28, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 68) == r({10, 20, 21, 28, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 70) == r({10, 20, 21, 28, 70, 71, 75, 90}));
EXPECT_TRUE(without(28, 71) == r({10, 20, 21, 28, 75, 90}));
EXPECT_TRUE(without(28, 72) == r({10, 20, 21, 28, 75, 90}));
EXPECT_TRUE(without(28, 73) == r({10, 20, 21, 28, 75, 90}));
EXPECT_TRUE(without(28, 75) == r({10, 20, 21, 28, 75, 90}));
EXPECT_TRUE(without(28, 80) == r({10, 20, 21, 28, 80, 90}));
EXPECT_TRUE(without(28, 85) == r({10, 20, 21, 28, 85, 90}));
EXPECT_TRUE(without(28, 90) == r({10, 20, 21, 28}));
EXPECT_TRUE(without(28, 95) == r({10, 20, 21, 28}));
EXPECT_TRUE(without(28, 100) == r({10, 20, 21, 28}));
EXPECT_TRUE(without(30, 35) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 40) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 45) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 50) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 55) == r({10, 20, 21, 30, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 60) == r({10, 20, 21, 30, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 65) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 67) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 68) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 70) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(30, 71) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(30, 72) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(30, 73) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(30, 75) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(30, 80) == r({10, 20, 21, 30, 80, 90}));
EXPECT_TRUE(without(30, 85) == r({10, 20, 21, 30, 85, 90}));
EXPECT_TRUE(without(30, 90) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(30, 95) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(30, 100) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(35, 40) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(35, 45) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(35, 50) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(35, 55) == r({10, 20, 21, 30, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(35, 60) == r({10, 20, 21, 30, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(35, 65) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(35, 67) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(35, 68) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(35, 70) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(35, 71) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(35, 72) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(35, 73) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(35, 75) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(35, 80) == r({10, 20, 21, 30, 80, 90}));
EXPECT_TRUE(without(35, 85) == r({10, 20, 21, 30, 85, 90}));
EXPECT_TRUE(without(35, 90) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(35, 95) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(35, 100) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(40, 45) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(40, 50) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(40, 55) == r({10, 20, 21, 30, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(40, 60) == r({10, 20, 21, 30, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(40, 65) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(40, 67) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(40, 68) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(40, 70) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(40, 71) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(40, 72) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(40, 73) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(40, 75) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(40, 80) == r({10, 20, 21, 30, 80, 90}));
EXPECT_TRUE(without(40, 85) == r({10, 20, 21, 30, 85, 90}));
EXPECT_TRUE(without(40, 90) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(40, 95) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(40, 100) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(45, 50) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(45, 55) == r({10, 20, 21, 30, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(45, 60) == r({10, 20, 21, 30, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(45, 65) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(45, 67) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(45, 68) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(45, 70) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(45, 71) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(45, 72) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(45, 73) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(45, 75) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(45, 80) == r({10, 20, 21, 30, 80, 90}));
EXPECT_TRUE(without(45, 85) == r({10, 20, 21, 30, 85, 90}));
EXPECT_TRUE(without(45, 90) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(45, 95) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(45, 100) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(50, 55) == r({10, 20, 21, 30, 55, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(50, 60) == r({10, 20, 21, 30, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(50, 65) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(50, 67) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(50, 68) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(50, 70) == r({10, 20, 21, 30, 70, 71, 75, 90}));
EXPECT_TRUE(without(50, 71) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(50, 72) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(50, 73) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(50, 75) == r({10, 20, 21, 30, 75, 90}));
EXPECT_TRUE(without(50, 80) == r({10, 20, 21, 30, 80, 90}));
EXPECT_TRUE(without(50, 85) == r({10, 20, 21, 30, 85, 90}));
EXPECT_TRUE(without(50, 90) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(50, 95) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(50, 100) == r({10, 20, 21, 30}));
EXPECT_TRUE(without(55, 60) == r({10, 20, 21, 30, 50, 55, 60, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(55, 65) == r({10, 20, 21, 30, 50, 55, 70, 71, 75, 90}));
EXPECT_TRUE(without(55, 67) == r({10, 20, 21, 30, 50, 55, 70, 71, 75, 90}));
EXPECT_TRUE(without(55, 68) == r({10, 20, 21, 30, 50, 55, 70, 71, 75, 90}));
EXPECT_TRUE(without(55, 70) == r({10, 20, 21, 30, 50, 55, 70, 71, 75, 90}));
EXPECT_TRUE(without(55, 71) == r({10, 20, 21, 30, 50, 55, 75, 90}));
EXPECT_TRUE(without(55, 72) == r({10, 20, 21, 30, 50, 55, 75, 90}));
EXPECT_TRUE(without(55, 73) == r({10, 20, 21, 30, 50, 55, 75, 90}));
EXPECT_TRUE(without(55, 75) == r({10, 20, 21, 30, 50, 55, 75, 90}));
EXPECT_TRUE(without(55, 80) == r({10, 20, 21, 30, 50, 55, 80, 90}));
EXPECT_TRUE(without(55, 85) == r({10, 20, 21, 30, 50, 55, 85, 90}));
EXPECT_TRUE(without(55, 90) == r({10, 20, 21, 30, 50, 55}));
EXPECT_TRUE(without(55, 95) == r({10, 20, 21, 30, 50, 55}));
EXPECT_TRUE(without(55, 100) == r({10, 20, 21, 30, 50, 55}));
EXPECT_TRUE(without(60, 65) == r({10, 20, 21, 30, 50, 60, 70, 71, 75, 90}));
EXPECT_TRUE(without(60, 67) == r({10, 20, 21, 30, 50, 60, 70, 71, 75, 90}));
EXPECT_TRUE(without(60, 68) == r({10, 20, 21, 30, 50, 60, 70, 71, 75, 90}));
EXPECT_TRUE(without(60, 70) == r({10, 20, 21, 30, 50, 60, 70, 71, 75, 90}));
EXPECT_TRUE(without(60, 71) == r({10, 20, 21, 30, 50, 60, 75, 90}));
EXPECT_TRUE(without(60, 72) == r({10, 20, 21, 30, 50, 60, 75, 90}));
EXPECT_TRUE(without(60, 73) == r({10, 20, 21, 30, 50, 60, 75, 90}));
EXPECT_TRUE(without(60, 75) == r({10, 20, 21, 30, 50, 60, 75, 90}));
EXPECT_TRUE(without(60, 80) == r({10, 20, 21, 30, 50, 60, 80, 90}));
EXPECT_TRUE(without(60, 85) == r({10, 20, 21, 30, 50, 60, 85, 90}));
EXPECT_TRUE(without(60, 90) == r({10, 20, 21, 30, 50, 60}));
EXPECT_TRUE(without(60, 95) == r({10, 20, 21, 30, 50, 60}));
EXPECT_TRUE(without(60, 100) == r({10, 20, 21, 30, 50, 60}));
EXPECT_TRUE(without(65, 67) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(65, 68) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(65, 70) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(65, 71) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(65, 72) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(65, 73) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(65, 75) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(65, 80) == r({10, 20, 21, 30, 50, 65, 80, 90}));
EXPECT_TRUE(without(65, 85) == r({10, 20, 21, 30, 50, 65, 85, 90}));
EXPECT_TRUE(without(65, 90) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(65, 95) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(65, 100) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(67, 68) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(67, 70) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(67, 71) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(67, 72) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(67, 73) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(67, 75) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(67, 80) == r({10, 20, 21, 30, 50, 65, 80, 90}));
EXPECT_TRUE(without(67, 85) == r({10, 20, 21, 30, 50, 65, 85, 90}));
EXPECT_TRUE(without(67, 90) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(67, 95) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(67, 100) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(68, 70) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(68, 71) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(68, 72) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(68, 73) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(68, 75) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(68, 80) == r({10, 20, 21, 30, 50, 65, 80, 90}));
EXPECT_TRUE(without(68, 85) == r({10, 20, 21, 30, 50, 65, 85, 90}));
EXPECT_TRUE(without(68, 90) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(68, 95) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(68, 100) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(70, 71) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(70, 72) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(70, 73) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(70, 75) == r({10, 20, 21, 30, 50, 65, 75, 90}));
EXPECT_TRUE(without(70, 80) == r({10, 20, 21, 30, 50, 65, 80, 90}));
EXPECT_TRUE(without(70, 85) == r({10, 20, 21, 30, 50, 65, 85, 90}));
EXPECT_TRUE(without(70, 90) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(70, 95) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(70, 100) == r({10, 20, 21, 30, 50, 65}));
EXPECT_TRUE(without(71, 72) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(71, 73) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(71, 75) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(71, 80) == r({10, 20, 21, 30, 50, 65, 70, 71, 80, 90}));
EXPECT_TRUE(without(71, 85) == r({10, 20, 21, 30, 50, 65, 70, 71, 85, 90}));
EXPECT_TRUE(without(71, 90) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(71, 95) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(71, 100) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(72, 73) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(72, 75) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(72, 80) == r({10, 20, 21, 30, 50, 65, 70, 71, 80, 90}));
EXPECT_TRUE(without(72, 85) == r({10, 20, 21, 30, 50, 65, 70, 71, 85, 90}));
EXPECT_TRUE(without(72, 90) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(72, 95) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(72, 100) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(73, 75) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(73, 80) == r({10, 20, 21, 30, 50, 65, 70, 71, 80, 90}));
EXPECT_TRUE(without(73, 85) == r({10, 20, 21, 30, 50, 65, 70, 71, 85, 90}));
EXPECT_TRUE(without(73, 90) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(73, 95) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(73, 100) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(75, 80) == r({10, 20, 21, 30, 50, 65, 70, 71, 80, 90}));
EXPECT_TRUE(without(75, 85) == r({10, 20, 21, 30, 50, 65, 70, 71, 85, 90}));
EXPECT_TRUE(without(75, 90) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(75, 95) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(75, 100) == r({10, 20, 21, 30, 50, 65, 70, 71}));
EXPECT_TRUE(without(80, 85) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 80, 85, 90}));
EXPECT_TRUE(without(80, 90) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 80}));
EXPECT_TRUE(without(80, 95) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 80}));
EXPECT_TRUE(without(80, 100) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 80}));
EXPECT_TRUE(without(85, 90) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 85}));
EXPECT_TRUE(without(85, 95) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 85}));
EXPECT_TRUE(without(85, 100) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 85}));
EXPECT_TRUE(without(90, 95) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(90, 100) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
EXPECT_TRUE(without(95, 100) == r({10, 20, 21, 30, 50, 65, 70, 71, 75, 90}));
}
TEST_F(EraseTest, ViaIterator) {
HyoutaUtilities::RangeSet<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());
++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());
}