|
151 | 151 | s = Set([1]) |
152 | 152 | @test isequal(sizehint!(s, 10), Set([1])) |
153 | 153 | @test isequal(empty!(s), Set()) |
| 154 | + s2 = GenericSet(s) |
| 155 | + sizehint!(s2, 10) |
| 156 | + @test s2 == GenericSet(s) |
154 | 157 | end |
155 | 158 | @testset "rehash!" begin |
156 | 159 | # Use a pointer type to have defined behavior for uninitialized |
|
213 | 216 | # union must uniquify |
214 | 217 | @test union([1, 2, 1]) == union!([1, 2, 1]) == [1, 2] |
215 | 218 | @test union([1, 2, 1], [2, 2]) == union!([1, 2, 1], [2, 2]) == [1, 2] |
| 219 | + s2 = Set([nothing]) |
| 220 | + union!(s2, [nothing]) |
| 221 | + @test s2 == Set([nothing]) |
216 | 222 | end |
217 | 223 |
|
218 | 224 | @testset "intersect" begin |
|
369 | 375 | @test !issubset(d3, d2) |
370 | 376 | @test issubset(d1, d3) |
371 | 377 | @test issubset(d2, d3) |
| 378 | + |
| 379 | + # no fast in, long enough container |
| 380 | + @test issubset(Set(Bool[]), rand(Bool, 100)) == true |
| 381 | + # neither has a fast in, right doesn't have a length |
| 382 | + @test isdisjoint([1, 3, 5, 7, 9], Iterators.filter(iseven, 1:10)) |
372 | 383 | end |
373 | 384 |
|
374 | 385 | @testset "unique" begin |
|
653 | 664 | @test B > A |
654 | 665 | end |
655 | 666 | end |
| 667 | + # first doesn't have length |
| 668 | + @test issetequal(Iterators.filter(iseven, 1:10), [2, 4, 6, 8, 10]) |
| 669 | + # both don't have length |
| 670 | + @test issetequal(Iterators.filter(iseven, 1:10), Iterators.filter(iseven, 1:10)) |
656 | 671 | end |
657 | 672 |
|
658 | 673 | @testset "optimized union! with max_values" begin |
|
0 commit comments