|
60 | 60 | @test isa(@inferred(similar(SArray{Tuple{1,1,1},Int,3,1}, Float64)), MArray{Tuple{1,1,1},Float64,3,1})
|
61 | 61 | @test isa(@inferred(similar(sv, Size(3,3,3))), MArray{Tuple{3,3,3},Int,3,27})
|
62 | 62 | @test isa(@inferred(similar(sv, Float64, Size(3,3,3))), MArray{Tuple{3,3,3},Float64,3,27})
|
| 63 | + |
| 64 | + @test isa(@inferred(similar(Diagonal{Int}, Size(2,2))), MArray{Tuple{2, 2}, Int, 2, 4}) |
| 65 | + @test isa(@inferred(similar(Matrix{Int}, Int, Size(2,2))), SizedArray{Tuple{2, 2}, Int, 2, 2}) |
63 | 66 | end
|
64 | 67 |
|
65 | 68 | @testset "reshape" begin
|
|
69 | 72 | @test @inferred(vec(SMatrix{2, 2}([1 2; 3 4])))::SVector{4,Int} == [1, 3, 2, 4]
|
70 | 73 |
|
71 | 74 | # AbstractArray
|
72 |
| - @test reshape(view(ones(4,4), 1:4, 1:2), Size(4,2)) == SMatrix{4,2}(ones(4,2)) |
| 75 | + # CartesianIndex |
| 76 | + @test reshape(view(ones(4, 4), 1:4, 1:2), Size(4, 2)) == SMatrix{4,2}(ones(4, 2)) |
| 77 | + # IndexLinear |
| 78 | + @test reshape(view(ones(4, 4), 1, 1:4), Size(4, 1)) == SMatrix{4,1}(ones(4, 1)) |
| 79 | + @test_throws DimensionMismatch reshape(view(ones(4,4), 1:4, 1:2), Size(5, 2)) |
73 | 80 | end
|
74 | 81 |
|
75 | 82 | @testset "copy" begin
|
|
0 commit comments