Skip to content

Commit

Permalink
add tests for powering (and the required copy method)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmarek committed Nov 29, 2023
1 parent d063952 commit cef2ef0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/group_elements.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions test/conformance_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit cef2ef0

Please sign in to comment.