1
exercism fetch scala protein-translation

src/test/scala/ProteinTranslationTest.scala

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import org.scalatest.{Matchers, FunSuite}

/** @version 1.1.0 */
class ProteinTranslationTest extends FunSuite with Matchers {

  test("Methionine RNA sequence") {
    ProteinTranslation.proteins("AUG") should be(Seq("Methionine"))
  }

  test("Phenylalanine RNA sequence 1") {
    pending
    ProteinTranslation.proteins("UUU") should be(Seq("Phenylalanine"))
  }

  test("Phenylalanine RNA sequence 2") {
    pending
    ProteinTranslation.proteins("UUC") should be(Seq("Phenylalanine"))
  }

  test("Leucine RNA sequence 1") {
    pending
    ProteinTranslation.proteins("UUA") should be(Seq("Leucine"))
  }

  test("Leucine RNA sequence 2") {
    pending
    ProteinTranslation.proteins("UUG") should be(Seq("Leucine"))
  }

  test("Serine RNA sequence 1") {
    pending
    ProteinTranslation.proteins("UCU") should be(Seq("Serine"))
  }

  test("Serine RNA sequence 2") {
    pending
    ProteinTranslation.proteins("UCC") should be(Seq("Serine"))
  }

  test("Serine RNA sequence 3") {
    pending
    ProteinTranslation.proteins("UCA") should be(Seq("Serine"))
  }

  test("Serine RNA sequence 4") {
    pending
    ProteinTranslation.proteins("UCG") should be(Seq("Serine"))
  }

  test("Tyrosine RNA sequence 1") {
    pending
    ProteinTranslation.proteins("UAU") should be(Seq("Tyrosine"))
  }

  test("Tyrosine RNA sequence 2") {
    pending
    ProteinTranslation.proteins("UAC") should be(Seq("Tyrosine"))
  }

  test("Cysteine RNA sequence 1") {
    pending
    ProteinTranslation.proteins("UGU") should be(Seq("Cysteine"))
  }

  test("Cysteine RNA sequence 2") {
    pending
    ProteinTranslation.proteins("UGC") should be(Seq("Cysteine"))
  }

  test("Tryptophan RNA sequence") {
    pending
    ProteinTranslation.proteins("UGG") should be(Seq("Tryptophan"))
  }

  test("STOP codon RNA sequence 1") {
    pending
    ProteinTranslation.proteins("UAA") should be(Seq())
  }

  test("STOP codon RNA sequence 2") {
    pending
    ProteinTranslation.proteins("UAG") should be(Seq())
  }

  test("STOP codon RNA sequence 3") {
    pending
    ProteinTranslation.proteins("UGA") should be(Seq())
  }

  test("Translate RNA strand into correct protein list") {
    pending
    ProteinTranslation.proteins("AUGUUUUGG") should be(
      Seq("Methionine", "Phenylalanine", "Tryptophan"))
  }

  test("Translation stops if STOP codon at beginning of sequence") {
    pending
    ProteinTranslation.proteins("UAGUGG") should be(Seq())
  }

  test("Translation stops if STOP codon at end of two-codon sequence") {
    pending
    ProteinTranslation.proteins("UGGUAG") should be(Seq("Tryptophan"))
  }

  test("Translation stops if STOP codon at end of three-codon sequence") {
    pending
    ProteinTranslation.proteins("AUGUUUUAA") should be(
      Seq("Methionine", "Phenylalanine"))
  }

  test("Translation stops if STOP codon in middle of three-codon sequence") {
    pending
    ProteinTranslation.proteins("UGGUAGUGG") should be(Seq("Tryptophan"))
  }

  test("Translation stops if STOP codon in middle of six-codon sequence") {
    pending
    ProteinTranslation.proteins("UGGUGUUAUUAAUGGUUU") should be(
      Seq("Tryptophan", "Cysteine", "Tyrosine"))
  }
}