From 796917e70716d935652fec33872ac6364a09400b Mon Sep 17 00:00:00 2001 From: Allen Hill Date: Sun, 4 Sep 2022 20:42:46 -0400 Subject: [PATCH] Improve test coverage --- test/runtests.jl | 15 +++++++++++++++ test/vaxfloatd.jl | 3 +++ 2 files changed, 18 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index c54c3f6..f094209 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,20 @@ using VaxData, Test, InteractiveUtils +@testset "General" begin + # Overflowing conversion + @test_throws InexactError convert(VaxFloatF, big"1.7e39") + + @test sprint(show, vaxf"1.0") == "vaxf\"1.0\"" + + @test -one(VaxFloatF) < one(VaxFloatF) + @test one(VaxFloatF) < nextfloat(one(VaxFloatF)) + + @test -one(VaxFloatF) <= one(VaxFloatF) + @test one(VaxFloatF) <= nextfloat(one(VaxFloatF)) + + @test prevfloat(one(VaxFloatF), -5) === nextfloat(one(VaxFloatF), 5) +end + include("vaxints.jl") include("vaxfloatf.jl") include("vaxfloatd.jl") diff --git a/test/vaxfloatd.jl b/test/vaxfloatd.jl index fbb7e12..a8e8f06 100644 --- a/test/vaxfloatd.jl +++ b/test/vaxfloatd.jl @@ -98,6 +98,9 @@ @test VaxFloatD(prevfloat(convert(Float64, floatmin(VaxFloatD)))) === zero(VaxFloatD) @test VaxFloatD(convert(Float64, floatmin(VaxFloatD))) === floatmin(VaxFloatD) + # Subnormals become zero + @test VaxFloatD(prevfloat(floatmin(Float64))) == zero(VaxFloatD) + # Numbers larger than floatmax(VaxFloatD) should error @test_throws InexactError VaxFloatD(nextfloat(convert(Float64, floatmax(VaxFloatD))))