Skip to content

Commit

Permalink
Add minor tests: reduce on empty array and type-stability for prod fu…
Browse files Browse the repository at this point in the history
…nction (#31205)
  • Loading branch information
dkaysin authored and fredrikekre committed Mar 1, 2019
1 parent 8639dc1 commit 91b1271
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ using .Main.OffsetArrays
@test mapreduce(-, +, Vector(range(1.0, stop=10000.0, length=10000))) == -50005000.0
# empty mr
@test mapreduce(abs2, +, Float64[]) === 0.0
@test mapreduce(abs2, *, Float64[]) === 1.0
@test mapreduce(abs2, max, Float64[]) === 0.0
@test mapreduce(abs, max, Float64[]) === 0.0
@test_throws ArgumentError mapreduce(abs2, &, Float64[])
Expand Down Expand Up @@ -155,6 +156,7 @@ end

@test prod([3]) === 3
@test prod([Int8(3)]) === Int(3)
@test prod([UInt8(3)]) === UInt(3)
@test prod([3.0]) === 3.0

@test prod(z) === 120
Expand Down

0 comments on commit 91b1271

Please sign in to comment.