Skip to content

Commit

Permalink
Added tests for deque
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt committed Aug 30, 2015
1 parent 9899967 commit b87ad65
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/test_deque.jl
Expand Up @@ -12,6 +12,13 @@ q = Deque{Int}()
@test_throws ErrorException front(q)
@test_throws ErrorException back(q)

@test typeof(deque(Int)) == typeof(Deque{Int}())

q = DataStructures.DequeBlock{Int}(0,0)
@test length(q) == 0
@test capacity(q) == 0
@test isempty(q)

q = Deque{Int}(3)
@test length(q) == 0
@test isempty(q)
Expand All @@ -34,10 +41,16 @@ for i = 1 : n

@test front(q) == 1
@test back(q) == i


k = 1
for j in q
@test j == k
k += 1
end
cq = collect(q)
@test isa(cq, Vector{Int})
@test cq == collect(1:i)
@test sprint(show,q) == "Deque [$cq]"
end

# pop back
Expand Down

0 comments on commit b87ad65

Please sign in to comment.