1
exercism fetch scala nucleotide-count

src/test/scala/NucleotideCountTest.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
import org.scalatest.{Matchers, FunSuite}

/** @version 1.0.0 */
class NucleotideCountTest extends FunSuite with Matchers {


  test("empty strand") {
    new DNA("").nucleotideCounts should be (Right(Map('A' -> 0,
      'C' -> 0,
      'G' -> 0,
      'T' -> 0)))
  }

  test("strand with repeated nucleotide") {
    pending
    new DNA("GGGGGGG").nucleotideCounts should be (Right(Map('A' -> 0,
      'C' -> 0,
      'G' -> 7,
      'T' -> 0)))
  }

  test("strand with multiple nucleotides") {
    pending
    new DNA("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC").nucleotideCounts should be (Right(Map('A' -> 20,
      'C' -> 12,
      'G' -> 17,
      'T' -> 21)))
  }

  test("strand with invalid nucleotides") {
    pending
    new DNA("AGXXACT").nucleotideCounts.isLeft should be (true)
  }
}