Skip to content

Commit b19b69d

Browse files
wsmosesavik-pal
authored andcommitted
da
1 parent c487361 commit b19b69d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

test/sorting.jl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ end
138138
@test argmax(abs2, x) @jit(argmax(abs2, x_ra))
139139
end
140140

141+
function dual_approx(x, y)
142+
@test (x[1] y[1])
143+
@test (x[2] y[2])
144+
end
145+
141146
@testset "findmin / findmax" begin
142147
xvec = randn(10)
143148
xvec_ra = Reactant.to_rarray(xvec)
@@ -160,14 +165,14 @@ end
160165
fmaxdims(x, d) = findmax(x; dims=d)
161166
fmaxdims(f, x, d) = findmax(f, x; dims=d)
162167

163-
@test fwithlinindices(findmin, identity, x; dims=1) @jit(fmindims(x_ra, 1))
164-
@test fwithlinindices(findmax, identity, x; dims=1) @jit(fmaxdims(x_ra, 1))
165-
@test fwithlinindices(findmin, identity, x; dims=2) @jit(fmindims(x_ra, 2))
166-
@test fwithlinindices(findmax, identity, x; dims=2) @jit(fmaxdims(x_ra, 2))
167-
@test fwithlinindices(findmin, abs2, x; dims=1) @jit(fmindims(abs2, x_ra, 1))
168-
@test fwithlinindices(findmax, abs2, x; dims=1) @jit(fmaxdims(abs2, x_ra, 1))
169-
@test fwithlinindices(findmin, abs2, x; dims=2) @jit(fmindims(abs2, x_ra, 2))
170-
@test fwithlinindices(findmax, abs2, x; dims=2) @jit(fmaxdims(abs2, x_ra, 2))
168+
dual_approx(fwithlinindices(findmin, identity, x; dims=1), @jit(fmindims(x_ra, 1)))
169+
dual_approx(fwithlinindices(findmax, identity, x; dims=1), @jit(fmaxdims(x_ra, 1)))
170+
dual_approx(fwithlinindices(findmin, identity, x; dims=2), @jit(fmindims(x_ra, 2)))
171+
dual_approx(fwithlinindices(findmax, identity, x; dims=2), @jit(fmaxdims(x_ra, 2)))
172+
dual_approx(fwithlinindices(findmin, abs2, x; dims=1), @jit(fmindims(abs2, x_ra, 1)))
173+
dual_approx(fwithlinindices(findmax, abs2, x; dims=1), @jit(fmaxdims(abs2, x_ra, 1)))
174+
dual_approx(fwithlinindices(findmin, abs2, x; dims=2), @jit(fmindims(abs2, x_ra, 2)))
175+
dual_approx(fwithlinindices(findmax, abs2, x; dims=2), @jit(fmaxdims(abs2, x_ra, 2)))
171176
end
172177

173178
@testset "findfirst / findlast" begin

0 commit comments

Comments
 (0)