small tweaks to printing

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

View File

@ -208,9 +208,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

@ -77,7 +77,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
@ -89,7 +90,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