Skip to content

Commit 8ad0eab

Browse files
committed
tests for f.(args...) syntax
1 parent fe53f21 commit 8ad0eab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/broadcast.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@ rt = Base.return_types(broadcast, Tuple{Function, Array{Float64, 3}, Array{Int,
117117
rt = Base.return_types(broadcast!, Tuple{Function, Array{Float64, 3}, Array{Float64, 3}, Array{Int, 1}})
118118
@test length(rt) == 1 && rt[1] == Array{Float64, 3}
119119

120+
# f.(args...) syntax (#15032)
121+
let x = [1,3.2,4.7], y = [3.5, pi, 1e-4], α = 0.2342
122+
@test sin.(x) == broadcast(sin, x)
123+
@test sin.(α) == broadcast(sin, α)
124+
@test factorial.(3) == broadcast(factorial, 3)
125+
@test atan2.(x, y) == broadcast(atan2, x, y)
126+
@test atan2.(x, y') == broadcast(atan2, x, y')
127+
@test atan2.(x, α) == broadcast(atan2, x, α)
128+
@test atan2.(α, y') == broadcast(atan2, α, y')
129+
end
130+
120131
# issue 14725
121132
let a = Number[2, 2.0, 4//2, 2+0im] / 2
122133
@test eltype(a) == Number

0 commit comments

Comments
 (0)