Skip to content

Commit

Permalink
Tests with non-trivial mapping function
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Oct 19, 2023
1 parent 6480b93 commit 831933f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,14 @@ end
@test_throws Exception reduce(max, Fill(2,0), dims=1)
function testreduce(op, A; kw...)
B = Array(A)
@test reduce(op, A; kw...) == reduce(op, B; kw...)
F = reduce(op, A; kw...)
@test F == reduce(op, B; kw...)
if haskey(kw, :dims)
@test F isa Fill
end
if !isempty(A)
@test mapreduce(x->x^2, op, A; kw...) == mapreduce(x->x^2, op, B; kw...)
end
end
@testset for (op, init) in ((+, 0), (*, 1))
testreduce(op, Fill(2,0))
Expand Down

0 comments on commit 831933f

Please sign in to comment.