Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Apr 12, 2017
1 parent 71143cf commit 109c761
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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) == "-∞"
Expand All @@ -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

0 comments on commit 109c761

Please sign in to comment.