diff --git a/src/CircularArrays.jl b/src/CircularArrays.jl index 268b8a3..4429638 100644 --- a/src/CircularArrays.jl +++ b/src/CircularArrays.jl @@ -15,6 +15,7 @@ export CircularArray, CircularVector struct CircularArray{T, N, A <: AbstractArray{T,N}} <: AbstractArray{T,N} data::A CircularArray{T,N}(data::A) where A <: AbstractArray{T,N} where {T,N} = new{T,N,A}(data) + CircularArray{T,N,A}(data::A) where A <: AbstractArray{T,N} where {T,N} = new{T,N,A}(data) end """ diff --git a/test/runtests.jl b/test/runtests.jl index 010642d..b1db12a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -15,6 +15,15 @@ end @test all(a == first(arrays) for a in arrays) @test all(a isa CircularVector{T,Vector{T}} for a in arrays) end + + @testset "matrix construction" begin + data = zeros(Float64, 2, 2) + ref = CircularArray(data) + @test CircularArray{Float64}(data) == ref + @test CircularArray{Float64, 2}(data) == ref + @test CircularArray{Float64, 2, Array{Float64, 2}}(data) == ref + @test CircularArray{Float64, 2, Matrix{Float64}}(data) == ref + end end @testset "type stability" begin