Skip to content

Commit cbfc277

Browse files
committed
Add (broken) tests for mod
1 parent 239fb6b commit cbfc277

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

test/basic.jl

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -825,13 +825,22 @@ end
825825
@test !isfinite(Reactant.to_rarray(Inf; track_numbers=Number))
826826
end
827827

828-
@testset "rem" begin
828+
@testset "mod and rem" begin
829829
a = [-1.1, 7.7, -3.3, 9.9, -5.5]
830830
b = [6.6, -2.2, -8.8, 4.4, -10.1]
831-
expected = rem.(a, b)
832-
@test Reactant.@jit(rem.(Reactant.to_rarray(a), Reactant.to_rarray(b))) expected
833-
@test Reactant.@jit(rem.(a, Reactant.to_rarray(b))) expected
834-
@test Reactant.@jit(rem.(Reactant.to_rarray(a), b)) expected
831+
832+
# Currently broken because `mod` is JIT-ed to an HLO operator with same semantic as
833+
# Julia's `rem`, rather than `mod`.
834+
expected_mod = mod.(a, b)
835+
@test_broken Reactant.@jit(mod.(Reactant.to_rarray(a), Reactant.to_rarray(b)))
836+
expected_mod
837+
@test_broken Reactant.@jit(mod.(a, Reactant.to_rarray(b))) expected_mod
838+
@test_broken Reactant.@jit(mod.(Reactant.to_rarray(a), b)) expected_mod
839+
840+
expected_rem = rem.(a, b)
841+
@test Reactant.@jit(rem.(Reactant.to_rarray(a), Reactant.to_rarray(b))) expected_rem
842+
@test Reactant.@jit(rem.(a, Reactant.to_rarray(b))) expected_rem
843+
@test Reactant.@jit(rem.(Reactant.to_rarray(a), b)) expected_rem
835844
end
836845

837846
@testset "reduce integers" begin

0 commit comments

Comments
 (0)