Skip to content

Commit 96776b9

Browse files
committed
add tests
1 parent 9d0bd35 commit 96776b9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/basic_indexing.jl

+11-2
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,18 @@ num_allocs = @allocations foo!(u_matrix)
265265

266266
# check VectorOfArray indexing for a StructArray of mutable structs
267267
using StructArrays
268-
using StaticArrays: MVector
268+
using StaticArrays: MVector, SVector
269269
x = VectorOfArray(StructArray{MVector{1, Float64}}(ntuple(_ -> [1.0, 2.0], 1)))
270+
y = 2 * x
270271

271-
# check VectorOfArray assignment
272+
# check mutable VectorOfArray assignment and broadcast
272273
x[1, 1] = 10
273274
@test x[1, 1] == 10
275+
@. x = y
276+
@test all(all.(y .== x))
277+
278+
# check immutable VectorOfArray broadcast
279+
x = VectorOfArray(StructArray{SVector{1, Float64}}(ntuple(_ -> [1.0, 2.0], 1)))
280+
y = 2 * x
281+
@. x = y
282+
@test all(all.(y .== x))

0 commit comments

Comments
 (0)