|
2 | 2 | @testset "$ET" for ET in eltypes
|
3 | 3 | range = ET <: Real ? (ET(1):ET(10)) : ET
|
4 | 4 |
|
5 |
| - # 1d arrays |
6 |
| - for num_elems in 1:256 |
7 |
| - @test compare(A->accumulate(+, A; init=zero(ET)), AT, rand(range, num_elems)) |
8 |
| - end |
9 |
| - |
10 |
| - for num_elems = rand(1:100, 10) |
11 |
| - @test compare(A->accumulate(+, A; init=zero(ET)), AT, rand(range, num_elems)) |
12 |
| - end |
13 |
| - |
14 |
| - for _ in 1:10 # nd arrays reduced as 1d |
15 |
| - n1 = rand(1:10) |
16 |
| - n2 = rand(1:10) |
17 |
| - n3 = rand(1:10) |
18 |
| - @test compare(A->accumulate(+, A; init=zero(ET)), AT, rand(range, n1, n2, n3)) |
19 |
| - end |
20 |
| - |
21 |
| - for num_elems = rand(1:100, 10) # init value |
22 |
| - init = rand(range) |
23 |
| - @test compare(A->accumulate(+, A; init), AT, rand(range, num_elems)) |
24 |
| - end |
25 |
| - |
26 |
| - |
27 |
| - # nd arrays |
28 |
| - for dims in 1:4 # corner cases |
29 |
| - for isize in 1:3 |
30 |
| - for jsize in 1:3 |
31 |
| - for ksize in 1:3 |
32 |
| - @test compare(A->accumulate(+, A; dims, init=zero(ET)), AT, rand(range, isize, jsize, ksize)) |
33 |
| - end |
34 |
| - end |
35 |
| - end |
36 |
| - end |
37 |
| - |
38 |
| - for _ in 1:10 |
39 |
| - for dims in 1:3 |
40 |
| - n1 = rand(1:10) |
41 |
| - n2 = rand(1:10) |
42 |
| - n3 = rand(1:10) |
43 |
| - @test compare(A->accumulate(+, A; dims, init=zero(ET)), AT, rand(range, n1, n2, n3)) |
44 |
| - end |
45 |
| - end |
46 |
| - |
47 |
| - for _ in 1:10 # init value |
48 |
| - for dims in 1:3 |
49 |
| - n1 = rand(1:10) |
50 |
| - n2 = rand(1:10) |
51 |
| - n3 = rand(1:10) |
52 |
| - init = rand(range) |
53 |
| - @test compare(A->accumulate(+, A; init, dims), AT, rand(range, n1, n2, n3)) |
54 |
| - end |
55 |
| - end |
| 5 | + # # 1d arrays |
| 6 | + # for num_elems in 1:256 |
| 7 | + # @test compare(A->accumulate(+, A; init=zero(ET)), AT, rand(range, num_elems)) |
| 8 | + # end |
| 9 | + |
| 10 | + # for num_elems = rand(1:100, 10) |
| 11 | + # @test compare(A->accumulate(+, A; init=zero(ET)), AT, rand(range, num_elems)) |
| 12 | + # end |
| 13 | + |
| 14 | + # for _ in 1:10 # nd arrays reduced as 1d |
| 15 | + # n1 = rand(1:10) |
| 16 | + # n2 = rand(1:10) |
| 17 | + # n3 = rand(1:10) |
| 18 | + # @test compare(A->accumulate(+, A; init=zero(ET)), AT, rand(range, n1, n2, n3)) |
| 19 | + # end |
| 20 | + |
| 21 | + # for num_elems = rand(1:100, 10) # init value |
| 22 | + # init = rand(range) |
| 23 | + # @test compare(A->accumulate(+, A; init), AT, rand(range, num_elems)) |
| 24 | + # end |
| 25 | + |
| 26 | + |
| 27 | + # # nd arrays |
| 28 | + # for dims in 1:4 # corner cases |
| 29 | + # for isize in 1:3 |
| 30 | + # for jsize in 1:3 |
| 31 | + # for ksize in 1:3 |
| 32 | + # @test compare(A->accumulate(+, A; dims, init=zero(ET)), AT, rand(range, isize, jsize, ksize)) |
| 33 | + # end |
| 34 | + # end |
| 35 | + # end |
| 36 | + # end |
| 37 | + |
| 38 | + # for _ in 1:10 |
| 39 | + # for dims in 1:3 |
| 40 | + # n1 = rand(1:10) |
| 41 | + # n2 = rand(1:10) |
| 42 | + # n3 = rand(1:10) |
| 43 | + # @test compare(A->accumulate(+, A; dims, init=zero(ET)), AT, rand(range, n1, n2, n3)) |
| 44 | + # end |
| 45 | + # end |
| 46 | + |
| 47 | + # for _ in 1:10 # init value |
| 48 | + # for dims in 1:3 |
| 49 | + # n1 = rand(1:10) |
| 50 | + # n2 = rand(1:10) |
| 51 | + # n3 = rand(1:10) |
| 52 | + # init = rand(range) |
| 53 | + # @test compare(A->accumulate(+, A; init, dims), AT, rand(range, n1, n2, n3)) |
| 54 | + # end |
| 55 | + # end |
56 | 56 |
|
57 | 57 | # Larger containers to try and detect weird bugs
|
58 | 58 | for n in (0, 1, 2, 3, 10, 10_000, 16384, 16384+1) # small, large, odd & even, pow2 and not
|
| 59 | + # Skip large tests on small datatypes |
| 60 | + n >= 10000 && sizeof(real(ET)) <= 2 && continue |
| 61 | + |
59 | 62 | @test compare(x->accumulate(+, x), AT, rand(range, n))
|
60 | 63 | @test compare(x->accumulate(+, x), AT, rand(range, n, 2))
|
61 | 64 | @test compare(Base.Fix2((x,y)->accumulate(+, x; init=y), rand(range)), AT, rand(range, n))
|
|
68 | 71 | end
|
69 | 72 | end
|
70 | 73 |
|
71 |
| -@testsuite "accumulations/cumsum & cumprod" (AT, eltypes)->begin |
72 |
| - @test compare(cumsum, AT, rand(Bool, 16)) |
73 |
| - |
74 |
| - @testset "$ET" for ET in eltypes |
75 |
| - range = ET <: Real ? (ET(1):ET(10)) : ET |
76 |
| - |
77 |
| - # cumsum |
78 |
| - for num_elems in rand(1:100, 10) |
79 |
| - @test compare(A->cumsum(A; dims=1), AT, rand(range, num_elems)) |
80 |
| - end |
81 |
| - |
82 |
| - for _ in 1:10 |
83 |
| - for dims in 1:3 |
84 |
| - n1 = rand(1:10) |
85 |
| - n2 = rand(1:10) |
86 |
| - n3 = rand(1:10) |
87 |
| - @test compare(A->cumsum(A; dims), AT, rand(range, n1, n2, n3)) |
88 |
| - end |
89 |
| - end |
90 |
| - |
91 |
| - |
92 |
| - # cumprod |
93 |
| - range = ET <: Real ? (ET(1):ET(10)) : ET |
94 |
| - @test compare(A->cumprod(A; dims=1), AT, ones(ET, 100_000)) |
95 |
| - |
96 |
| - for _ in 1:10 |
97 |
| - for dims in 1:3 |
98 |
| - n1 = rand(1:10) |
99 |
| - n2 = rand(1:10) |
100 |
| - n3 = rand(1:10) |
101 |
| - @test compare(A->cumprod(A; dims), AT, rand(range, n1, n2, n3)) |
102 |
| - end |
103 |
| - end |
104 |
| - end |
105 |
| -end |
| 74 | +# @testsuite "accumulations/cumsum & cumprod" (AT, eltypes)->begin |
| 75 | +# @test compare(cumsum, AT, rand(Bool, 16)) |
| 76 | + |
| 77 | +# @testset "$ET" for ET in eltypes |
| 78 | +# range = ET <: Real ? (ET(1):ET(10)) : ET |
| 79 | + |
| 80 | +# # cumsum |
| 81 | +# for num_elems in rand(1:100, 10) |
| 82 | +# @test compare(A->cumsum(A; dims=1), AT, rand(range, num_elems)) |
| 83 | +# end |
| 84 | + |
| 85 | +# for _ in 1:10 |
| 86 | +# for dims in 1:3 |
| 87 | +# n1 = rand(1:10) |
| 88 | +# n2 = rand(1:10) |
| 89 | +# n3 = rand(1:10) |
| 90 | +# @test compare(A->cumsum(A; dims), AT, rand(range, n1, n2, n3)) |
| 91 | +# end |
| 92 | +# end |
| 93 | + |
| 94 | + |
| 95 | +# # cumprod |
| 96 | +# range = ET <: Real ? (ET(1):ET(10)) : ET |
| 97 | +# @test compare(A->cumprod(A; dims=1), AT, ones(ET, 100_000)) |
| 98 | + |
| 99 | +# for _ in 1:10 |
| 100 | +# for dims in 1:3 |
| 101 | +# n1 = rand(1:10) |
| 102 | +# n2 = rand(1:10) |
| 103 | +# n3 = rand(1:10) |
| 104 | +# @test compare(A->cumprod(A; dims), AT, rand(range, n1, n2, n3)) |
| 105 | +# end |
| 106 | +# end |
| 107 | +# end |
| 108 | +# end |
0 commit comments