Skip to content

Commit ec7427d

Browse files
author
Ben J. Ward
committed
Fixed missing iterate and length methods
1 parent ea6f595 commit ec7427d

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BioSymbols"
22
uuid = "3c28c6f8-a34d-59c4-9654-267d177fcfa9"
33
authors = ["Ben J. Ward <benjward@protonmail.com"]
4-
version = "4.0.0"
4+
version = "4.0.1"
55

66
[deps]
77
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"

src/BioSymbols.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ expected to have the following methods defined:
116116
"""
117117
abstract type BioSymbol end
118118

119+
Base.length(::BioSymbol) = 1
120+
Base.iterate(sym::BioSymbol) = (sym, nothing)
121+
Base.iterate(sym::BioSymbol, state) = nothing
122+
119123
include("nucleicacid.jl")
120124
include("aminoacid.jl")
121125

test/runtests.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ function round_trip(x)
1111
return x == y
1212
end
1313

14+
@testset "BioSymbols" begin
15+
for i in alphabet(DNA)
16+
@test length(i) == 1
17+
@test collect(i) == [i]
18+
end
19+
for i in alphabet(RNA)
20+
@test length(i) == 1
21+
@test collect(i) == [i]
22+
end
23+
for i in alphabet(AminoAcid)
24+
@test length(i) == 1
25+
@test collect(i) == [i]
26+
end
27+
end
28+
1429
@testset "NucleicAcids" begin
1530
@testset "Conversions" begin
1631
@testset "UInt8" begin

0 commit comments

Comments
 (0)