Skip to content

Commit

Permalink
Improve show coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Dec 16, 2016
1 parent ab73835 commit 51b6f1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ function Base.show(io::IO, p::SOSDecomposition)
end

function Base.show(io::IO, p::RationalPoly)
print(io, "(")
print(io, p.num)
print(io, " / ")
print(io, ") / (")
print(io, p.den)
print(io, ")")
end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ include("diff.jl")
include("subs.jl")
include("algebraicset.jl")

#include("show.jl")
include("show.jl")
5 changes: 5 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@testset "Show" begin
@polyvar x y
@test sprint(show, SOSDecomposition([x+y, x-y])) == "(x + y)^2 + (x + -1y)^2"
@test sprint(show, (x + 1 + y) / x^2) == "(x + y + 1) / (x^2)"
end

0 comments on commit 51b6f1e

Please sign in to comment.