@@ -19,3 +19,26 @@ end # testset
19
19
@test Scalar{Int}[SVector {1,Int} (3 ), SVector {1,Float64} (2.0 )] == [Scalar {Int} (3 ), Scalar {Int} (2 )]
20
20
@test Scalar[SVector {1,Int} (3 ), SVector {1,Float64} (2.0 )] == [Scalar {Int} (3 ), Scalar {Float64} (2.0 )]
21
21
end
22
+
23
+ @testset " `real` and `float` of SArray/MArray" begin
24
+ # Issue 935
25
+ for SAT in (SArray, MArray)
26
+ vInt = SAT (SA[1 ,2 ,3 ]) # S/MVector{3, Int}
27
+ @test real (typeof (vInt)) === typeof (vInt)
28
+ @test float (typeof (vInt)) === typeof (float .(vInt))
29
+
30
+ vCInt = vInt + 1im * vInt # S/MVector{3, Complex{Int}}
31
+ @test real (typeof (vCInt)) === typeof (vInt)
32
+ @test float (typeof (vCInt)) === typeof (float .(vCInt))
33
+
34
+ vvInt = SAT (SA[vInt, vInt]) # S/MVector{2, S/MVector{3, Int}}
35
+ @test real (typeof (vvInt)) === SAT{Tuple{2 }, SAT{Tuple{3 }, Int, 1 , 3 }, 1 , 2 }
36
+ @test float (typeof (vvInt)) === SAT{Tuple{2 }, SAT{Tuple{3 }, Float64, 1 , 3 }, 1 , 2 }
37
+
38
+ vvCInt = SAT (SA[vCInt, vCInt]) # S/MVector{2, S/MVector{3, Complex{Int}}}
39
+ @test real (typeof (vvCInt)) === SAT{Tuple{2 }, SAT{Tuple{3 }, Int, 1 , 3 }, 1 , 2 }
40
+ @test float (typeof (vvCInt)) === SAT{Tuple{2 }, SAT{Tuple{3 }, Complex{Float64}, 1 , 3 }, 1 , 2 }
41
+ end
42
+ mInt = SA[Int16 (1 ) Int16 (2 ) Int16 (3 ); Int16 (4 ) Int16 (5 ) Int16 (6 )] # SMatrix{3,2,Int16}
43
+ @test float (typeof (mInt)) === SMatrix{2 , 3 , float (Int16), 6 }
44
+ end
0 commit comments