@@ -33,4 +33,30 @@ using FixedSizeArrays
33
33
@test similar (FixedSizeArray{Int}, (2 , 3 )) isa FixedSizeMatrix{Int}
34
34
@test FixedSizeArray {Int} (undef, 2 , 3 ) isa FixedSizeMatrix{Int}
35
35
end
36
+
37
+ @testset " broadcasting" begin
38
+ v3 = FixedSizeArray {Int} (undef, 3 )
39
+ @test v3 isa FixedSizeVector{Int}
40
+ @test (@inferred (v3 + v3)) isa FixedSizeVector{Int}
41
+ @test (@inferred (v3 .+ v3)) isa FixedSizeVector{Int}
42
+ @test (@inferred (v3 .* v3)) isa FixedSizeVector{Int}
43
+ @test (@inferred (v3 .+ 3 )) isa FixedSizeVector{Int}
44
+ @test (@inferred (v3 .* 3 )) isa FixedSizeVector{Int}
45
+ @test (@inferred (v3 .+ .3 )) isa FixedSizeVector{Float64}
46
+ @test (@inferred (v3 .* .3 )) isa FixedSizeVector{Float64}
47
+ @testset " matrices" begin
48
+ m33 = FixedSizeArray {Int} (undef, 3 , 3 )
49
+ m13 = FixedSizeArray {Int} (undef, 1 , 3 )
50
+ m31 = FixedSizeArray {Int} (undef, 3 , 1 )
51
+ @test m33 isa FixedSizeMatrix{Int}
52
+ @test m13 isa FixedSizeMatrix{Int}
53
+ @test m31 isa FixedSizeMatrix{Int}
54
+ @test (@inferred (m33 .+ .3 )) isa FixedSizeMatrix{Float64}
55
+ @test (@inferred (m33 .+ 3 )) isa FixedSizeMatrix{Int}
56
+ @test (@inferred (m33 .+ v3 )) isa FixedSizeMatrix{Int}
57
+ @test (@inferred (m33 .+ m13)) isa FixedSizeMatrix{Int}
58
+ @test (@inferred (m33 .+ m31)) isa FixedSizeMatrix{Int}
59
+ @test (@inferred (m33 .+ m33)) isa FixedSizeMatrix{Int}
60
+ end
61
+ end
36
62
end
0 commit comments