|
119 | 119 | @test (ma[1,2,1,1] = 36; ma[1,2,1,1] === 36)
|
120 | 120 | @test (ma[2,1,1,1] = 48; ma[2,1,1,1] === 48)
|
121 | 121 | end
|
| 122 | + |
| 123 | + @testset "4D StaticArray indexing" begin |
| 124 | + sa = SArray{Tuple{2,2,2,2}, Int}([i*j*k*l for i = 1:2, j = 2:3, k=3:4, l=4:5]) |
| 125 | + @test (@inferred getindex(sa, 1, 1, 1, SVector(1,2))) === @SVector [24,30] |
| 126 | + @test (@inferred getindex(sa, 1, 1, SVector(1,2), 1)) === @SVector [24,32] |
| 127 | + @test (@inferred getindex(sa, 1, SVector(1,2), 1, 1)) === @SVector [24,36] |
| 128 | + @test (@inferred getindex(sa, SVector(1,2), 1, 1, 1)) === @SVector [24,48] |
| 129 | + a = [i*j*k*l for i = 1:2, j = 2:3, k=3:4, l=4:5] |
| 130 | + @test (@inferred getindex(a, 1, 1, 1, SVector(1,2))) == [24,30] |
| 131 | + @test (@inferred getindex(a, 1, 1, SVector(1,2), 1)) == [24,32] |
| 132 | + @test (@inferred getindex(a, 1, SVector(1,2), 1, 1)) == [24,36] |
| 133 | + @test (@inferred getindex(a, SVector(1,2), 1, 1, 1)) == [24,48] |
| 134 | + end |
122 | 135 |
|
123 | 136 | @testset "Indexing with empty vectors" begin
|
124 | 137 | a = randn(2,2)
|
|
0 commit comments