Skip to content

Commit

Permalink
Test CircularDeque for leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kpamnany committed Feb 20, 2024
1 parent acc6ad8 commit c1ed503
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test_circ_deque.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,29 @@
for i in 1:5 push!(D, i) end
@test collect([i for i in D]) == collect(1:5)
end

@testset "pop! and popfirst! do not leak" begin
D = CircularDeque{Int}(5)

@testset "pop! doesn't leak" begin
push!(D,2)
pushfirst!(D,1)
ss2 = Base.summarysize(D)
pop!(D)
GC.gc(true)
ss1 = Base.summarysize(D)
@test ss1 < ss2
end
@testset "popfirst! doesn't leak" begin
push!(D,2)
push!(D,3)
ss2 = Base.summarysize(D)
popfirst!(D)
GC.gc(true)
ss1 = Base.summarysize(D)
@test ss1 < ss2
end
end
end

nothing

0 comments on commit c1ed503

Please sign in to comment.