From fd1a84e0783dd2126fe706dece4bcaa225fb5988 Mon Sep 17 00:00:00 2001 From: huiyuxie Date: Sun, 27 Oct 2024 17:30:36 -1000 Subject: [PATCH] Add test --- test/copy_static_array_test.jl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/copy_static_array_test.jl b/test/copy_static_array_test.jl index 76b9668b..c0aea1d2 100644 --- a/test/copy_static_array_test.jl +++ b/test/copy_static_array_test.jl @@ -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]