1
exercism fetch vimscript nucleotide-count

nucleotide_count.vader

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
"
" Common test data version: 1.0.0
"

Before:
  unlet! expected

Execute (empty strand):
  let expected = {
        \ 'A': 0,
        \ 'C': 0,
        \ 'G': 0,
        \ 'T': 0,
        \ }
  AssertEqual expected, NucleotideCount('')

Execute (strand with repeated nucleotide):
  let expected = {
        \ 'A': 0,
        \ 'C': 0,
        \ 'G': 7,
        \ 'T': 0,
        \ }
  AssertEqual expected, NucleotideCount('GGGGGGG')

Execute (strand with multiple nucleotides):
  let expected = {
        \ 'A': 20,
        \ 'C': 12,
        \ 'G': 17,
        \ 'T': 21,
        \ }
  AssertEqual expected, NucleotideCount('AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC')

Execute (strand with invalid nucleotides):
  let expected = 'invalid nucleotide in strand'
  AssertThrows call NucleotideCount('AGXXACT')
  AssertEqual expected, g:vader_exception