Skip to content

Commit 145b81e

Browse files
Update tests accordingly
1 parent 79c318f commit 145b81e

File tree

2 files changed

+41
-9
lines changed

2 files changed

+41
-9
lines changed

test/reducedim.jl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ end
116116
end
117117
end
118118

119-
@testset "NaN in findmin/findmax/minimum/maximum" begin
119+
@testset "NaN in findmin/findmax" begin
120120
A = [1.0 NaN 6.0;
121121
NaN 2.0 4.0]
122122
A′ = [-1.0 NaN -6.0;
@@ -126,15 +126,31 @@ end
126126
((1,2), fill(1.0,1,1),fill(CartesianIndex(1,1),1,1))]
127127
@test isequal(vfindmin1(A, dims=tup), (rval, rind))
128128
@test isequal(vfindmin1(abs, A′, dims=tup), (rval, rind))
129-
@test isequal(vvminimum(A, dims=tup), rval)
130-
@test isequal(vvminimum(abs, A′, dims=tup), rval)
131129
end
132130

133131
for (tup, rval, rind) in [((1,), [1.0 2.0 6.0], [CartesianIndex(1,1) CartesianIndex(2,2) CartesianIndex(1,3)]),
134132
((2,), reshape([6.0, 4.0], 2, 1), reshape([CartesianIndex(1,3),CartesianIndex(2,3)], 2, 1)),
135133
((1,2), fill(6.0,1,1),fill(CartesianIndex(1,3),1,1))]
136134
@test isequal(vfindmax1(A, dims=tup), (rval, rind))
137135
@test isequal(vfindmax1(abs, A′, dims=tup), (rval, rind))
136+
end
137+
end
138+
139+
@testset "NaN in minimum/maximum" begin
140+
A = [1.0 NaN 6.0;
141+
NaN 2.0 4.0]
142+
A′ = [-1.0 NaN -6.0;
143+
NaN -2.0 4.0]
144+
for (tup, rval, rind) in [((1,), [NaN 2.0 4.0], [CartesianIndex(1,1) CartesianIndex(2,2) CartesianIndex(2,3)]),
145+
((2,), reshape([6.0, 2.0], 2, 1), reshape([CartesianIndex(1,1),CartesianIndex(2,2)], 2, 1)),
146+
((1,2), fill(1.0,1,1),fill(CartesianIndex(1,1),1,1))]
147+
@test isequal(vvminimum(A, dims=tup), rval)
148+
@test isequal(vvminimum(abs, A′, dims=tup), rval)
149+
end
150+
151+
for (tup, rval, rind) in [((1,), [NaN 2.0 6.0], [CartesianIndex(1,1) CartesianIndex(2,2) CartesianIndex(1,3)]),
152+
((2,), reshape([6.0, 4.0], 2, 1), reshape([CartesianIndex(1,3),CartesianIndex(2,3)], 2, 1)),
153+
((1,2), fill(6.0,1,1),fill(CartesianIndex(1,3),1,1))]
138154
@test isequal(vvmaximum(A, dims=tup), rval)
139155
@test isequal(vvmaximum(abs, A′, dims=tup), rval)
140156
end

test/treducedim.jl

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,25 +128,41 @@ end
128128
end
129129
end
130130

131-
@testset "NaN in findmin/findmax/minimum/maximum" begin
131+
@testset "NaN in findmin/findmax" begin
132132
A = [1.0 NaN 6.0;
133133
NaN 2.0 4.0]
134134
A′ = [-1.0 NaN -6.0;
135135
NaN -2.0 4.0]
136136
for (tup, rval, rind) in [((1,), [1.0 2.0 4.0], [CartesianIndex(1,1) CartesianIndex(2,2) CartesianIndex(2,3)]),
137137
((2,), reshape([1.0, 2.0], 2, 1), reshape([CartesianIndex(1,1),CartesianIndex(2,2)], 2, 1)),
138138
((1,2), fill(1.0,1,1),fill(CartesianIndex(1,1),1,1))]
139-
@test isequal(vfindmin1(A, dims=tup), (rval, rind))
140-
@test isequal(vfindmin1(abs, A′, dims=tup), (rval, rind))
139+
@test isequal(vtfindmin1(A, dims=tup), (rval, rind))
140+
@test isequal(vtfindmin1(abs, A′, dims=tup), (rval, rind))
141+
end
142+
143+
for (tup, rval, rind) in [((1,), [1.0 2.0 6.0], [CartesianIndex(1,1) CartesianIndex(2,2) CartesianIndex(1,3)]),
144+
((2,), reshape([6.0, 4.0], 2, 1), reshape([CartesianIndex(1,3),CartesianIndex(2,3)], 2, 1)),
145+
((1,2), fill(6.0,1,1),fill(CartesianIndex(1,3),1,1))]
146+
@test isequal(vtfindmax1(A, dims=tup), (rval, rind))
147+
@test isequal(vtfindmax1(abs, A′, dims=tup), (rval, rind))
148+
end
149+
end
150+
151+
@testset "NaN in minimum/maximum" begin
152+
A = [1.0 NaN 6.0;
153+
NaN 2.0 4.0]
154+
A′ = [-1.0 NaN -6.0;
155+
NaN -2.0 4.0]
156+
for (tup, rval, rind) in [((1,), [NaN 2.0 4.0], [CartesianIndex(1,1) CartesianIndex(2,2) CartesianIndex(2,3)]),
157+
((2,), reshape([6.0, 2.0], 2, 1), reshape([CartesianIndex(1,1),CartesianIndex(2,2)], 2, 1)),
158+
((1,2), fill(1.0,1,1),fill(CartesianIndex(1,1),1,1))]
141159
@test isequal(vtminimum(A, dims=tup), rval)
142160
@test isequal(vtminimum(abs, A′, dims=tup), rval)
143161
end
144162

145-
for (tup, rval, rind) in [((1,), [1.0 2.0 6.0], [CartesianIndex(1,1) CartesianIndex(2,2) CartesianIndex(1,3)]),
163+
for (tup, rval, rind) in [((1,), [NaN 2.0 6.0], [CartesianIndex(1,1) CartesianIndex(2,2) CartesianIndex(1,3)]),
146164
((2,), reshape([6.0, 4.0], 2, 1), reshape([CartesianIndex(1,3),CartesianIndex(2,3)], 2, 1)),
147165
((1,2), fill(6.0,1,1),fill(CartesianIndex(1,3),1,1))]
148-
@test isequal(vfindmax1(A, dims=tup), (rval, rind))
149-
@test isequal(vfindmax1(abs, A′, dims=tup), (rval, rind))
150166
@test isequal(vtmaximum(A, dims=tup), rval)
151167
@test isequal(vtmaximum(abs, A′, dims=tup), rval)
152168
end

0 commit comments

Comments
 (0)