Skip to content

Commit 7c4ffae

Browse files
nalimilantkelman
authored andcommittedAug 29, 2016
Add tests for conversions from ReshapedArray to Array/Vector/Matrix (#18262)
These were not tested systematically, and are more generally useful to test conversions from AbstractArray. (cherry picked from commit 4d6ceac)
1 parent f34a3a8 commit 7c4ffae

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎test/arrayops.jl

+16
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,22 @@ for idx in ((3,), (2,2), (Base.ReshapedIndex(1),))
146146
end
147147
end
148148

149+
# conversion from ReshapedArray to Array (#18262)
150+
a = Base.ReshapedArray(1:3, (3, 1), ())
151+
@test convert(Array, a) == a
152+
@test convert(Array{Int}, a) == a
153+
@test convert(Array{Float64}, a) == a
154+
@test convert(Matrix, a) == a
155+
@test convert(Matrix{Int}, a) == a
156+
@test convert(Matrix{Float64}, a) == a
157+
b = Base.ReshapedArray(1:3, (3,), ())
158+
@test convert(Array, b) == b
159+
@test convert(Array{Int}, b) == b
160+
@test convert(Array{Float64}, b) == b
161+
@test convert(Vector, b) == b
162+
@test convert(Vector{Int}, b) == b
163+
@test convert(Vector{Float64}, b) == b
164+
149165
# operations with LinearFast ReshapedArray
150166
b = collect(1:12)
151167
a = Base.ReshapedArray(b, (4,3), ())

0 commit comments

Comments
 (0)
Please sign in to comment.