Skip to content

Commit 831933f

Browse files
committed
Tests with non-trivial mapping function
1 parent 6480b93 commit 831933f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/runtests.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,14 @@ end
11201120
@test_throws Exception reduce(max, Fill(2,0), dims=1)
11211121
function testreduce(op, A; kw...)
11221122
B = Array(A)
1123-
@test reduce(op, A; kw...) == reduce(op, B; kw...)
1123+
F = reduce(op, A; kw...)
1124+
@test F == reduce(op, B; kw...)
1125+
if haskey(kw, :dims)
1126+
@test F isa Fill
1127+
end
1128+
if !isempty(A)
1129+
@test mapreduce(x->x^2, op, A; kw...) == mapreduce(x->x^2, op, B; kw...)
1130+
end
11241131
end
11251132
@testset for (op, init) in ((+, 0), (*, 1))
11261133
testreduce(op, Fill(2,0))

0 commit comments

Comments
 (0)