From 4cb4d299de63f867c82d78a87d38bb85db8cc35e Mon Sep 17 00:00:00 2001 From: kalmar Date: Tue, 11 Jul 2017 18:44:08 +0200 Subject: [PATCH] small tweaks to printing --- src/GroupRings.jl | 4 ++-- test/runtests.jl | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index d781f59..b87b1ae 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -214,9 +214,9 @@ function show(io::IO, X::GroupRingElem) elseif isdefined(RG, :basis) non_zeros = ((X.coeffs[i], RG.basis[i]) for i in findn(X.coeffs)) elts = ("$(sign(c)> 0? " + ": " - ")$(abs(c))*$g" for (c,g) in non_zeros) - str = join(elts, "") + str = join(elts, "")[2:end] if sign(first(non_zeros)[1]) > 0 - str = str[4:end] + str = str[3:end] end print(io, str) else diff --git a/test/runtests.jl b/test/runtests.jl index 36d476c..d2e228d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -83,7 +83,8 @@ using Nemo @test a[5] == 1 @test a[p] == 1 - @test string(a) == " + 1*[2, 3, 1]" + @test string(a) == "1*[2, 3, 1]" + @test string(-a) == "- 1*[2, 3, 1]" @test RG([0,0,0,0,1,0]) == a @@ -95,7 +96,8 @@ using Nemo @test a[1] == 2 @test a[s] == 2 - @test string(a) == " + 2*[1, 2, 3] + 1*[2, 3, 1]" + @test string(a) == "2*[1, 2, 3] + 1*[2, 3, 1]" + @test string(-a) == "- 2*[1, 2, 3] - 1*[2, 3, 1]" @test length(a) == 2 end