Skip to content

Commit

Permalink
Merge ca5529b into 78ef22c
Browse files Browse the repository at this point in the history
  • Loading branch information
scls19fr committed Jun 12, 2019
2 parents 78ef22c + ca5529b commit 3c5d1a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/circular_buffer.jl
Expand Up @@ -16,6 +16,8 @@ mutable struct CircularBuffer{T} <: AbstractVector{T}
CircularBuffer{T}(capacity::Int) where {T} = new{T}(capacity, 1, 0, Vector{T}(undef, capacity))
end

CircularBuffer(capacity) = CircularBuffer{Any}(capacity)

"""
empty!(cb)
Expand Down
5 changes: 5 additions & 0 deletions test/test_circular_buffer.jl
Expand Up @@ -44,6 +44,11 @@
end
end

@testset "other constructor" begin
cb = CircularBuffer(10)
@test length(cb) == 0
@test typeof(cb) <: CircularBuffer{Any}
end

@testset "pushfirst" begin
cb = CircularBuffer{Int}(5) # New, empty one for full test coverage
Expand Down

0 comments on commit 3c5d1a8

Please sign in to comment.