diff --git a/test/runtests.jl b/test/runtests.jl index 13e6267..891bc06 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -20,8 +20,11 @@ using Base.Test end @testset "Formatting" begin - @test Showoff.format_fixed(10.0, 0) == "10" + @test Showoff.format_fixed(-10.0, 0) == "-10" @test Showoff.format_fixed(0.012345, 3) == "0.012" + @test Showoff.format_fixed(Inf, 1) == "∞" + @test Showoff.format_fixed(-Inf, 1) == "-∞" + @test Showoff.format_fixed(NaN, 1) == "NaN" @test Showoff.format_fixed_scientific(0.0, 1, false) == "0" @test Showoff.format_fixed_scientific(Inf, 1, false) == "∞" @test Showoff.format_fixed_scientific(-Inf, 1, false) == "-∞" @@ -33,9 +36,11 @@ end @testset "Showoff" begin x = [1.12345, 4.5678] @test showoff(x) == ["1.12345", "4.56780"] + @test showoff([0.0, 50000.0]) == ["0", "5×10⁴"] @test showoff(x, :plain) == ["1.12345", "4.56780"] @test showoff(x, :scientific) == ["1.12345×10⁰", "4.56780×10⁰"] @test showoff(x, :engineering) == ["1.12345×10⁰", "4.56780×10⁰"] @test showoff([Dates.DateTime("2017-04-11", "yyyy-mm-dd")]) == ["Apr 11, 2017"] @test_throws ArgumentError showoff(x, :nevergonnagiveyouup) + @test_throws ArgumentError showoff([Inf, Inf, NaN]) end