Skip to content

Commit

Permalink
Test the behavior of NaN in a where clause. (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
gafter authored Nov 13, 2024
1 parent d7a0a2b commit eb6162f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/matchtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -445,4 +445,32 @@ end
end
end

@testset "Test the behavior of NaN values" begin
v = 0.0 / 0.0
@test @match v begin
x where x > 0 => false
x where x <= 0 => false
_ => true
end
@test @match v begin
x where x < 0 => false
x where x >= 0 => false
_ => true
end
@test @match v begin
x where x >= 0 => false
x where x < 0 => false
_ => true
end
@test @match v begin
x where x <= 0 => false
x where x > 0 => false
_ => true
end
@test @match v begin
x where x == 0 => false
x where x != 0 => true
end
end

end

0 comments on commit eb6162f

Please sign in to comment.