|
26 | 26 | # SVector
|
27 | 27 | mv = MVector{4,Int}()
|
28 | 28 | @test (mv[SVector(1,2,3,4)] = vec; (@inferred getindex(mv, SVector(4,3,2,1)))::SVector{4,Int} == SVector((7,6,5,4)))
|
| 29 | + |
| 30 | + mv = MVector{4,Int}() |
| 31 | + @test (mv[SVector(1,2,3,4)] = [4, 5, 6, 7]; (@inferred getindex(mv, SVector(4,3,2,1)))::SVector{4,Int} == SVector((7,6,5,4))) |
| 32 | + @test (mv[SVector(1,2,3,4)] = 2; (@inferred getindex(mv, SVector(4,3,2,1)))::SVector{4,Int} == SVector((2,2,2,2))) |
29 | 33 |
|
30 | 34 | # Colon
|
31 | 35 | mv = MVector{4,Int}()
|
32 | 36 | @test (mv[:] = vec; (@inferred getindex(mv, :))::SVector{4,Int} == SVector((4,5,6,7)))
|
| 37 | + @test (mv[:] = [4, 5, 6, 7]; (@inferred getindex(mv, :))::SVector{4,Int} == SVector((4,5,6,7))) |
| 38 | + @test (mv[:] = 2; (@inferred getindex(mv, :))::SVector{4,Int} == SVector((2,2,2,2))) |
| 39 | + |
| 40 | + @test_throws DimensionMismatch setindex!(mv, SVector(1,2,3), SVector(1,2,3,4)) |
| 41 | + @test_throws DimensionMismatch setindex!(mv, SVector(1,2,3), :) |
| 42 | + @test_throws DimensionMismatch setindex!(mv, [1,2,3], SVector(1,2,3,4)) |
33 | 43 | end
|
34 | 44 |
|
35 | 45 | @testset "Linear getindex()/setindex!() on MMatrix" begin
|
|
0 commit comments