|
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,)
|
|
204 | 206 | @test @inferred(promote_type(SMatrix{2,3,Float32,6}, SMatrix{2,3,Complex{Float64},6})) === SMatrix{2,3,Complex{Float64},6}
|
205 | 207 | end
|
206 | 208 | end
|
| 209 | + |
| 210 | +@testset "some special case" begin |
| 211 | + @test_throws Exception Scalar(1, 2) # issue #809 |
| 212 | + |
| 213 | + @test_throws Exception SVector{1}(1, 2) |
| 214 | + @test (@inferred(SVector{1}((1, 2)))::SVector{1,NTuple{2,Int}}).data === ((1,2),) |
| 215 | + @test (@inferred(SVector{2}((1, 2)))::SVector{2,Int}).data === (1,2) |
| 216 | + @test (@inferred(SVector(1, 2))::SVector{2,Int}).data === (1,2) |
| 217 | + @test (@inferred(SVector((1, 2)))::SVector{2,Int}).data === (1,2) |
| 218 | + |
| 219 | + @test_throws Exception SMatrix{1,1}(1, 2) |
| 220 | + @test (@inferred(SMatrix{1,1}((1, 2)))::SMatrix{1,1,NTuple{2,Int}}).data === ((1,2),) |
| 221 | + @test (@inferred(SMatrix{1,2}((1, 2)))::SMatrix{1,2,Int}).data === (1,2) |
| 222 | + @test (@inferred(SMatrix{1}((1, 2)))::SMatrix{1,2,Int}).data === (1,2) |
| 223 | + @test (@inferred(SMatrix{1}(1, 2))::SMatrix{1,2,Int}).data === (1,2) |
| 224 | + @test (@inferred(SMatrix{2}((1, 2)))::SMatrix{2,1,Int}).data === (1,2) |
| 225 | + @test (@inferred(SMatrix{2}(1, 2))::SMatrix{2,1,Int}).data === (1,2) |
| 226 | +end |
0 commit comments