Skip to content

Commit

Permalink
changes to the structure of the exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
golanor committed Jan 30, 2024
1 parent 7bbbe61 commit 857570d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 6 additions & 1 deletion exercises/practice/protein-translation/.meta/example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ struct TranslationError <: Exception
end

macro rna_str(str)
rna_translator(str)
end

function rna_translator(str)
n = 3
result = []
for i=1:n:length(str)
Expand All @@ -35,7 +39,8 @@ macro rna_str(str)
protein == "STOP" && break
push!(result, protein)
end
return result
result

end


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
macro rna_str()
# I'm a ribosome macro!
end
end


function rna_translator()
# I'm a ribosome function!
end
4 changes: 2 additions & 2 deletions exercises/practice/protein-translation/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ include("protein-translation.jl")
end

@testset "Non existent codon causes translation exception" begin
@test_throws TranslationError @macroexpand rna"AAA"
@test_throws TranslationError rna_translator("AAA")
end

@testset "Incomplete codon causes translation exception" begin
@test_throws TranslationError @macroexpand rna"UGGU"
@test_throws TranslationError rna_translator("UGUU")
end

@testset "Incomplete RNA sequence can translate if given a stop codon" begin
Expand Down

0 comments on commit 857570d

Please sign in to comment.