From a1b8444274af52ee6b6966e13222e0f199b58c24 Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Fri, 8 Jan 2021 13:12:57 +0100 Subject: [PATCH 1/2] more broadcasting tests --- test/broadcast.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/broadcast.jl b/test/broadcast.jl index 0a888bb..c343205 100644 --- a/test/broadcast.jl +++ b/test/broadcast.jl @@ -44,6 +44,10 @@ Broadcast.broadcastable(x::ScalarTest) = Ref(x) @test @inferred(m ./ (v .* v')) == @SMatrix [1.0 0.5; 0.75 0.25] testinf(m, v) = m ./ (v .* v') @test @inferred(testinf(m, v)) == @SMatrix [1.0 0.5; 0.75 0.25] + + # mutating + m .+= v + @test m == [2 3; 7 8] end @testset "2x2 HybridMatrix with 1x2 HybridMatrix" begin @@ -60,6 +64,10 @@ Broadcast.broadcastable(x::ScalarTest) = Ref(x) @test @inferred(m1 .- m2) == @SMatrix [0 -2; 2 0] @test @inferred(m2 .- m1) == @SMatrix [0 2; -2 0] @test @inferred(m1 .^ m2) == @SMatrix [1 16; 3 256] + + # mutating + m1 .+= m2 + @test m1 == [2 6; 4 8] end @testset "1x2 HybridMatrix with SVector" begin @@ -113,6 +121,10 @@ Broadcast.broadcastable(x::ScalarTest) = Ref(x) @test @inferred(2 .- m) == @SMatrix [1 0; -1 -2] @test @inferred(m .^ 2) == @SMatrix [1 4; 9 16] @test @inferred(2 .^ m) == @SMatrix [2 4; 8 16] + + # mutating + m .+= 2 + @test m == [3 4; 5 6] end @testset "Empty arrays" begin @test @inferred(1.0 .+ HybridMatrix{2,0,Float64}(zeros(2,0))) == HybridMatrix{2,0,Float64}(zeros(2,0)) From b9cc8606c256eb31f3f220c33be34e84da8b6883 Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Fri, 8 Jan 2021 13:28:04 +0100 Subject: [PATCH 2/2] one more test --- test/broadcast.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/broadcast.jl b/test/broadcast.jl index c343205..a310f72 100644 --- a/test/broadcast.jl +++ b/test/broadcast.jl @@ -46,8 +46,11 @@ Broadcast.broadcastable(x::ScalarTest) = Ref(x) @test @inferred(testinf(m, v)) == @SMatrix [1.0 0.5; 0.75 0.25] # mutating - m .+= v - @test m == [2 3; 7 8] + m .+= v .+ [1, 2] + @test m == [3 4; 9 10] + m = HybridMatrix{2,StaticArrays.Dynamic()}([1 2; 3 4]) + m .+= v .+ SA[1, 2] + @test m == [3 4; 9 10] end @testset "2x2 HybridMatrix with 1x2 HybridMatrix" begin