From 0888eb81636904678529c74bf0e5057cb79c1c3a Mon Sep 17 00:00:00 2001 From: Michal Horodecki Date: Tue, 6 Sep 2022 13:24:06 +0200 Subject: [PATCH] protein-translation: Add tests for invalid sequences --- .../practice/protein-translation/test/Tests.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/exercises/practice/protein-translation/test/Tests.hs b/exercises/practice/protein-translation/test/Tests.hs index b2ff2da7e..9cd2e28a1 100644 --- a/exercises/practice/protein-translation/test/Tests.hs +++ b/exercises/practice/protein-translation/test/Tests.hs @@ -116,6 +116,22 @@ cases = [ Case { description = "Methionine RNA sequence" , input = "UGGUGUUAUUAAUGGUUU" , expected = Just ["Tryptophan","Cysteine","Tyrosine"] } + , Case { description = "Translation fails on unknown codon" + , input = "ABC" + , expected = Nothing + } + , Case { description = "Translation stops if STOP codon before invalid codon" + , input = "UAGABC" + , expected = Just [] + } + , Case { description = "Translation fails if codon is too short" + , input = "AUGA" + , expected = Nothing + } + , Case { description = "Translation stops if STOP codon before too short codon" + , input = "UAGA" + , expected = Just [] + } ] -- baf663fecc756872af85e8ae6ed24f3f7cbb9388