Skip to content

Commit

Permalink
Merge pull request #41 from fingolfin/mh/fix-conformance-test
Browse files Browse the repository at this point in the history
conformance: types can't imply finiteness
  • Loading branch information
Marek Kaluba authored Feb 3, 2022
2 parents 04a34f4 + 1d9bd0b commit f90a9fe
Showing 1 changed file with 31 additions and 15 deletions.
46 changes: 31 additions & 15 deletions test/conformance_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,38 @@ function test_Group_interface(G::Group)
@testset "Group interface" begin
@testset "Iteration protocol" begin
IS = Base.IteratorSize(typeof(G))
if IS isa Base.HasLength || IS isa Base.HasShape
@test isfinite(G) == true
@test length(G) isa Int
@test length(G) > 0

@test eltype(G) <: GroupElement
@test one(G) isa eltype(G)

if GroupsCore.hasgens(G)
@test first(iterate(G)) isa eltype(G)
_, s = iterate(G)
@test first(iterate(G, s)) isa eltype(G)
@test isone(first(G))
end
else
if IS isa Base.IsInfinite
@test isfinite(G) == false
else
isfiniteG = false
if IS isa Base.HasLength || IS isa Base.HasShape
@test isfinite(G) == true
isfiniteG = true
else
@test IS isa Base.SizeUnknown
try
@test isfinite(G) isa Bool
isfiniteG = isfinite(G)
catch e
@test e isa GroupsCore.InfiniteOrder
isfiniteG = false
end
end

if isfiniteG
@test length(G) isa Int
@test length(G) > 0

@test eltype(G) <: GroupElement
@test one(G) isa eltype(G)

if GroupsCore.hasgens(G)
@test first(iterate(G)) isa eltype(G)
_, s = iterate(G)
@test first(iterate(G, s)) isa eltype(G)
@test isone(first(G))
end
end
end
end

Expand Down

0 comments on commit f90a9fe

Please sign in to comment.