Skip to content

Commit 082b283

Browse files
authored
Merge pull request #613 from tozanski/patch-1
RobinDict empty! not zeroing hashes bugfix
2 parents 994a75e + 4bc9438 commit 082b283

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/robin_dict.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ function empty!(h::RobinDict{K,V}) where {K, V}
285285
resize!(h.keys, sz)
286286
resize!(h.vals, sz)
287287
resize!(h.hashes, sz)
288+
fill!(h.hashes, 0)
288289
h.count = 0
289290
h.idxfloor = 0
290291
return h

test/test_robin_dict.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ end
330330
@test h.count == 0
331331
@test h.idxfloor == 0
332332
@test length(h.hashes) == length(h.keys) == length(h.vals) == length0
333+
for i=-1000:1000
334+
@test !haskey(h, i)
335+
end
333336
end
334337

335338
@testset "ArgumentError" begin
@@ -424,4 +427,4 @@ end
424427
h[i] = i+1
425428
end
426429
check_invariants(h)
427-
end
430+
end

0 commit comments

Comments
 (0)