File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ isrear(blk::DequeBlock) = blk.next === blk
3838# reset the block to empty, and position
3939
4040function reset! (blk:: DequeBlock{T} , front:: Int ) where T
41+ empty! (blk. data)
42+ resize! (blk. data, blk. capa)
4143 blk. front = front
4244 blk. back = front - 1
4345 blk. prev = blk
Original file line number Diff line number Diff line change 196196 @test length (sprint (dump,q)) >= 0
197197 @test typeof (empty! (q)) === typeof (Deque {Int} ())
198198 @test isempty (q)
199+ @test num_blocks (q) == 1
200+ @test q. head === q. rear
201+ @test sizeof (q. head. data) == q. head. capa * sizeof (eltype (q))
202+ end
203+
204+ @testset " push! after empty!" begin
205+ q = Deque {Int} (1 )
206+ push! (q,1 )
207+ push! (q,2 )
208+ empty! (q)
209+ push! (q,3 )
210+ @test length (q) == 1
211+ @test first (q) == 3
212+ @test last (q) == 3
213+ @test num_blocks (q) == 1
199214 end
200215end # @testset Deque
You can’t perform that action at this time.
0 commit comments