From 45d5b2e738abce0a4d6cab8a4cbaaba7fa0d89c3 Mon Sep 17 00:00:00 2001 From: Lilith Hafner Date: Wed, 30 Aug 2023 15:02:11 -0500 Subject: [PATCH] add tests for #51113 --- test/floatfuncs.jl | 2 +- test/rounding.jl | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/floatfuncs.jl b/test/floatfuncs.jl index 8ca5c3836529f..cc29052d722f3 100644 --- a/test/floatfuncs.jl +++ b/test/floatfuncs.jl @@ -271,7 +271,7 @@ end result = result !== error && typemin(Ti) <= result <= typemax(Ti) ? result : error if result === error - # @test_throws InexactError round(Ti, z) Broken because of #51113 + @test_throws InexactError round(Ti, z) @test_throws InexactError Ti(z) else @test result == round(Ti, z) diff --git a/test/rounding.jl b/test/rounding.jl index 3205036d3b5c2..d0d59b2568c3a 100644 --- a/test/rounding.jl +++ b/test/rounding.jl @@ -448,3 +448,10 @@ const native_rounding_modes = ( end end end + +@testset "round(Int, -Inf16) should throw (#51113)" begin + @test_throws InexactError round(Int32, -Inf16) + @test_throws InexactError round(Int64, -Inf16) + @test_throws InexactError round(Int128, -Inf16) + # More comprehensive testing is present in test/floatfuncs.jl +end