diff --git a/src/symbols.jl b/src/symbols.jl index e13435c..a6258bc 100644 --- a/src/symbols.jl +++ b/src/symbols.jl @@ -1,7 +1,7 @@ change_pow(s::S, n::Integer) where S<:GSymbol = S(s.id, n) function Base.iterate(s::GS, i=1) where GS<:GSymbol - return i <= abs(s.pow) ? (GS(s.id, sign(s.pow)), i+1) : nothing + return i <= abs(s.pow) ? (change_pow(s, sign(s.pow)), i+1) : nothing end Base.size(s::GSymbol) = (abs(s.pow), ) Base.length(s::GSymbol) = first(size(s)) diff --git a/test/AutGroup-tests.jl b/test/AutGroup-tests.jl index 0b9c658..234ac60 100644 --- a/test/AutGroup-tests.jl +++ b/test/AutGroup-tests.jl @@ -142,12 +142,17 @@ @test (Groups.change_pow(f, -2)).pow == 1 @test (inv(f)).pow == 1 - f = Groups.AutSymbol(perm"(1,2)(3,4)") - @test isa(inv(f), Groups.AutSymbol) + g = Groups.AutSymbol(perm"(1,2)(3,4)") + @test isa(inv(g), Groups.AutSymbol) - @test_throws MethodError f*f + @test_throws MethodError g*f - @test A(f)^-1 == A(inv(f)) + @test A(g)^-1 == A(inv(g)) + + h = Groups.transvection_R(1,2) + + @test collect(A(g)*A(h)) == [g, h] + @test collect(A(h)^2) == [h, h] end @testset "reductions/arithmetic" begin