|
17 | 17 | end |
18 | 18 |
|
19 | 19 | @testset "Outer constructors and macro" begin |
| 20 | + @test_throws Exception SArray(1,2,3,4) # unknown constructor |
| 21 | + |
20 | 22 | @test SArray{Tuple{1},Int,1}((1,)).data === (1,) |
21 | 23 | @test SArray{Tuple{1},Int}((1,)).data === (1,) |
22 | 24 | @test SArray{Tuple{1}}((1,)).data === (1,) |
|
175 | 177 | @test @inferred(promote_type(SMatrix{2,3,Float32,6}, SMatrix{2,3,Complex{Float64},6})) === SMatrix{2,3,Complex{Float64},6} |
176 | 178 | end |
177 | 179 | end |
| 180 | + |
| 181 | +@testset "some special case" begin |
| 182 | + @test_throws Exception (SArray{Tuple{2,M,N}} where {M,N})(SArray{Tuple{3,2,1}}(1,2,3,4,5,6)) |
| 183 | + |
| 184 | + @test_throws Exception SVector{1}(1, 2) |
| 185 | + @test (@inferred(SVector{1}((1, 2)))::SVector{1,NTuple{2,Int}}).data === ((1,2),) |
| 186 | + @test (@inferred(SVector{2}((1, 2)))::SVector{2,Int}).data === (1,2) |
| 187 | + @test (@inferred(SVector(1, 2))::SVector{2,Int}).data === (1,2) |
| 188 | + @test (@inferred(SVector((1, 2)))::SVector{2,Int}).data === (1,2) |
| 189 | + |
| 190 | + @test_throws Exception SMatrix{1,1}(1, 2) |
| 191 | + @test (@inferred(SMatrix{1,1}((1, 2)))::SMatrix{1,1,NTuple{2,Int}}).data === ((1,2),) |
| 192 | + @test (@inferred(SMatrix{1,2}((1, 2)))::SMatrix{1,2,Int}).data === (1,2) |
| 193 | + @test (@inferred(SMatrix{1}((1, 2)))::SMatrix{1,2,Int}).data === (1,2) |
| 194 | + @test (@inferred(SMatrix{1}(1, 2))::SMatrix{1,2,Int}).data === (1,2) |
| 195 | + @test (@inferred(SMatrix{2}((1, 2)))::SMatrix{2,1,Int}).data === (1,2) |
| 196 | + @test (@inferred(SMatrix{2}(1, 2))::SMatrix{2,1,Int}).data === (1,2) |
| 197 | +end |
0 commit comments