Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyuxie committed Oct 28, 2024
1 parent ed07b28 commit fd1a84e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/copy_static_array_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,23 @@ b = recursivecopy(a)
@test a[1] == b[1]
a[1] *= 2
@test a[1] != b[1]

# Broadcasting when SVector{1}
a = [SVector(0.0) for _ in 1:2]
a_voa = VectorOfArray(a)
b_voa = copy(a_voa)
a_voa[1] = SVector(1.0)
a_voa[2] = SVector(1.0)
@. b_voa = a_voa
@test b_voa[1] == a_voa[1]
@test b_voa[2] == a_voa[2]

# Broadcasting when SVector{N} where N > 1
a = [SVector(0.0, 0.0) for _ in 1:2]
a_voa = VectorOfArray(a)
b_voa = copy(a_voa)
a_voa[1] = SVector(1.0, 1.0)
a_voa[2] = SVector(1.0, 1.0)
@. b_voa = a_voa
@test b_voa[1] == a_voa[1]
@test b_voa[2] == a_voa[2]

0 comments on commit fd1a84e

Please sign in to comment.