Skip to content

Commit 2ee1724

Browse files
committed
add tests
1 parent 3f65897 commit 2ee1724

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/copy_static_array_test.jl

+11-1
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,14 @@ x = StructArray{SVector{2, Float64}}((randn(2), randn(2)))
120120
vx = VectorOfArray(x)
121121
vx2 = copy(vx) .+ 1
122122
ans = vx .+ vx2
123-
@test ans.u isa StructArray
123+
@test ans.u isa StructArray
124+
125+
# check that Base.similar(VectorOfArray{<:StaticArray}) returns the
126+
# same type as the original VectorOfArray
127+
x_staticvector = [SVector(0.0, 0.0) for _ in 1:2]
128+
x_structarray = StructArray{SVector{2, Float64}}((randn(2), randn(2)))
129+
x_mutablefv = [MutableFV(1.0, 2.0)]
130+
x_immutablefv = [ImmutableFV(1.0, 2.0)]
131+
for vec in [x_staticvector, x_structarray, x_mutablefv, x_immutablefv]
132+
@test typeof(similar(VectorOfArray(vec))) === typeof(VectorOfArray(vec))
133+
end

0 commit comments

Comments
 (0)