Skip to content

Commit

Permalink
test/broadcast: put r1, r2, ratio, m into let (JuliaLang#36817)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlatanvasovic committed Jul 27, 2020
1 parent 7adb9ce commit 3b67e47
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,16 @@ for arr in (identity, as_sub)
end
end

r1 = 1:1
r2 = 1:5
ratio = [1,1/2,1/3,1/4,1/5]
@test r1.*r2 == [1:5;]
@test r1./r2 == ratio
m = [1:2;]'
@test m.*r2 == [1:5 2:2:10]
@test m./r2 [ratio 2ratio]
@test m./[r2;] [ratio 2ratio]
let r1 = 1:1,
r2 = 1:5,
ratio = [1,1/2,1/3,1/4,1/5],
m = [1:2;]'
@test r1.*r2 == [1:5;]
@test r1./r2 == ratio
@test m.*r2 == [1:5 2:2:10]
@test m./r2 [ratio 2ratio]
@test m./[r2;] [ratio 2ratio]
end

@test @inferred(broadcast(+,[0,1.2],reshape([0,-2],1,1,2))) == reshape([0 -2; 1.2 -0.8],2,1,2)
rt = Base.return_types(broadcast, Tuple{typeof(+), Array{Float64, 3}, Array{Int, 1}})
Expand Down

0 comments on commit 3b67e47

Please sign in to comment.