small tweaks to printing

This commit is contained in:
kalmar 2017-07-11 18:44:08 +02:00
parent f852a6ca8e
commit 4cb4d299de
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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