From eb6162f2b9ffbde0ec5539462f0a58d72c065c7a Mon Sep 17 00:00:00 2001 From: Neal Gafter Date: Wed, 13 Nov 2024 14:35:38 -0800 Subject: [PATCH] Test the behavior of NaN in a where clause. (#115) --- test/matchtests.jl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/matchtests.jl b/test/matchtests.jl index 29563ed..bc6c9ef 100644 --- a/test/matchtests.jl +++ b/test/matchtests.jl @@ -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