diff --git a/src/bases_fixed.jl b/src/bases_fixed.jl index 5273279..25642b5 100644 --- a/src/bases_fixed.jl +++ b/src/bases_fixed.jl @@ -138,6 +138,8 @@ end Base.in(x::T, b::SubBasis{T}) where T = !isnothing(get(b, x, nothing)) Base.haskey(b::SubBasis, i::Integer) = i in eachindex(b.keys) +Base.firstindex(b::SubBasis) = firstindex(b.keys) +Base.lastindex(b::SubBasis) = lastindex(b.keys) Base.getindex(b::SubBasis, i::Integer) = parent(b)[b.keys[i]] function Base.getindex(b::SubBasis{T,I}, x::T) where {T,I} i = get(b, x, nothing) diff --git a/test/perm_grp_algebra.jl b/test/perm_grp_algebra.jl index ae18b01..1e4d3b2 100644 --- a/test/perm_grp_algebra.jl +++ b/test/perm_grp_algebra.jl @@ -125,6 +125,9 @@ import StarAlgebras as SA S1 = unique!(rand(G, 7)) S = unique!([S1; [a * b for a in S1 for b in S1]]) subb = SA.SubBasis(db, S) + @test length(subb) == length(S) + @test firstindex(subb) == 1 + @test lastindex(subb) == length(S) a = S1[1] @test subb[a] == 1 @test a in subb