Skip to content

Commit 61c1de9

Browse files
committed
A few tests for SizedArray
1 parent c76fddf commit 61c1de9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/SizedArray.jl

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
# Uninitialized
3434
@test @inferred(SizedArray{Tuple{2,2},Int,2,2,Matrix{Int}}(undef)) isa SizedArray{Tuple{2,2},Int,2,2,Matrix{Int}}
3535
@test @inferred(SizedArray{Tuple{2,2},Int,2,2}(undef)) isa SizedArray{Tuple{2,2},Int,2,2,Matrix{Int}}
36+
@test @inferred(SizedArray{Tuple{2,2},Int,2,1}(undef)) isa SizedArray{Tuple{2,2},Int,2,1,Vector{Int}}
3637
@test @inferred(SizedArray{Tuple{2,2},Int,2}(undef)) isa SizedArray{Tuple{2,2},Int,2,2,Matrix{Int}}
3738
@test @inferred(SizedArray{Tuple{2,2},Int}(undef)) isa SizedArray{Tuple{2,2},Int,2,2,Matrix{Int}}
3839
@test size(SizedArray{Tuple{4,5},Int,2}(undef).data) == (4, 5)
@@ -44,6 +45,7 @@
4445
@test @inferred(SizedArray{Tuple{2},Float64}((1,2)))::SizedArray{Tuple{2},Float64,1,1,Vector{Float64}} == [1.0, 2.0]
4546
@test @inferred(SizedArray{Tuple{2}}((1,2)))::SizedArray{Tuple{2},Int,1,1,Vector{Int}} == [1,2]
4647
@test @inferred(SizedArray{Tuple{2,2}}((1,2,3,4)))::SizedArray{Tuple{2,2},Int,2,2,Matrix{Int}} == [1 3; 2 4]
48+
@test @inferred(SizedArray{Tuple{2,2},Int,2,1}((1,2,3,4)))::SizedArray{Tuple{2,2},Int,2,1,Vector{Int}} == [1 3; 2 4]
4749
@test SizedArray{Tuple{2},Int,1}((3, 4)).data == [3, 4]
4850
end
4951

@@ -121,15 +123,16 @@
121123
@testset "sized views" begin
122124
x = rand(4,1,2)
123125
y = SizedMatrix{4,2}(view(x, :, 1, :))
124-
@test isa(y, SizedArray{Tuple{4,2},Float64,2,2,SubArray{Float64,2,Array{Float64,3},Tuple{Base.Slice{Base.OneTo{Int64}},Int64,Base.Slice{Base.OneTo{Int64}}},false}})
126+
127+
@test isa(y, SizedArray{Tuple{4,2},Float64,2,2,<:SubArray{Float64,2}})
125128
@test Array(y) isa Matrix{Float64}
126129
@test Array(y) == x[:, 1, :]
127130
@test convert(Array, y) isa Matrix{Float64}
128131
@test convert(Array, y) == x[:, 1, :]
129132

130133
x2 = rand(10)
131134
y2 = SizedMatrix{4,2}(view(x2, 1:8))
132-
@test isa(y2, SizedArray{Tuple{4,2},Float64,2,1,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true}})
135+
@test isa(y2, SizedArray{Tuple{4,2},Float64,2,1,<:SubArray{Float64,1}})
133136
@test Array(y2) isa Matrix{Float64}
134137
@test Array(y2) == reshape(x2[1:8], 4, 2)
135138
@test convert(Array, y2) isa Matrix{Float64}

0 commit comments

Comments
 (0)