From cef2ef041349501f474d6c98f27104739a700165 Mon Sep 17 00:00:00 2001 From: Marek Kaluba Date: Wed, 29 Nov 2023 17:03:29 +0100 Subject: [PATCH] add tests for powering (and the required copy method) --- src/group_elements.jl | 2 ++ test/conformance_test.jl | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/group_elements.jl b/src/group_elements.jl index c797e0a..a4eb350 100644 --- a/src/group_elements.jl +++ b/src/group_elements.jl @@ -38,6 +38,8 @@ Base.deepcopy_internal(g::GroupElement, stackdict::IdDict) = throw( # or a singleton). However by defining this fallback we force everybody to # implement it, except isbits group elements. +Base.copy(g::GroupElement) = deepcopy(g) + @doc Markdown.doc""" inv(g::GroupElement) diff --git a/test/conformance_test.jl b/test/conformance_test.jl index 071e613..352b350 100644 --- a/test/conformance_test.jl +++ b/test/conformance_test.jl @@ -129,6 +129,12 @@ function test_GroupElement_interface(g::GEl, h::GEl) where {GEl<:GroupElement} @test g^-3 == inv(g) * inv(g) * inv(g) @test (g, h) == (old_g, old_h) + pow(g,n) = g^n + + @test pow(g, 6) isa GroupElement + @test pow(g, 1) isa GroupElement + @test (g, h) == (old_g, old_h) + @test (g * h)^-1 == inv(h) * inv(g) @test (g, h) == (old_g, old_h)