Skip to content

Commit

Permalink
More deque tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt committed Sep 3, 2015
1 parent 9d1985a commit 3fa8483
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/test_deque.jl
Expand Up @@ -11,13 +11,15 @@ q = Deque{Int}()
@test q.blksize == DataStructures.DEFAULT_DEQUEUE_BLOCKSIZE
@test_throws ErrorException front(q)
@test_throws ErrorException back(q)
@test length(sprint(dump,q)) >= 0

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

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

q = Deque{Int}(3)
@test length(q) == 0
Expand Down Expand Up @@ -50,7 +52,7 @@ for i = 1 : n
cq = collect(q)
@test isa(cq, Vector{Int})
@test cq == collect(1:i)
@test sprint(show,q) == "Deque [$cq]"
@test length(sprint(show,q)) >= 0
end

# pop back
Expand Down Expand Up @@ -158,3 +160,11 @@ push!(q,1)
@test !isempty(q)
empty!(q)
@test isempty(q)

#empty!
q = Deque{Int}(1)
push!(q,1)
push!(q,2)
@test length(sprint(dump,q)) >= 0
@test typeof(empty!(q)) == typeof(Deque{Int}())
@test isempty(q)

0 comments on commit 3fa8483

Please sign in to comment.