Skip to content

Commit df23036

Browse files
committed
Test a few more corner cases in reductions
1 parent 3c16583 commit df23036

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/testsuite/reductions.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ end
5555
@test compare(A->mapreduce(x->x+x, +, A; dims=dims, init=zero(ET)), AT, rand(range, sz))
5656
end
5757
end
58+
# Test more corner cases. Tests from AcceleraterKernels.jl
59+
for dims in [1,2,3,4,[1,2],[1,3],[1,4],[2,3],[2,4],[3,4],[1,2,3],[1,2,4],[1,3,4],[2,3,4],[1,2,3,4]]
60+
for isize in 0:3
61+
for jsize in 0:3
62+
for ksize in 0:3
63+
@test compare(A->mapreduce(x->x+x, +, A; init=zero(Int32), dims), AT, rand(Int32(1):Int32(10), isize, jsize, ksize))
64+
end
65+
end
66+
end
67+
end
5868
end
5969

6070
@testsuite "reductions/reduce" (AT, eltypes)->begin
@@ -68,6 +78,16 @@ end
6878
@test compare(A->reduce(*, A; dims=dims, init=one(ET)), AT, rand(range, sz))
6979
end
7080
end
81+
# Test more corner cases. Tests from AcceleraterKernels.jl
82+
for dims in [1,2,3,4,[1,2],[1,3],[1,4],[2,3],[2,4],[3,4],[1,2,3],[1,2,4],[1,3,4],[2,3,4],[1,2,3,4]]
83+
for isize in 0:3
84+
for jsize in 0:3
85+
for ksize in 0:3
86+
@test compare(A->reduce(+, A; init=zero(Int32), dims), AT, rand(Int32(1):Int32(10), isize, jsize, ksize))
87+
end
88+
end
89+
end
90+
end
7191
end
7292

7393
@testsuite "reductions/sum prod" (AT, eltypes)->begin

0 commit comments

Comments
 (0)