1
exercism fetch julia nucleotide-count

runtests.jl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using Base.Test

include("nucleotide-count.jl")

@testset "empty strand" begin
    @test count_nucleotides("") == Dict('A' => 0, 'C' => 0, 'G' => 0, 'T' => 0)
end

@testset "strand with repeated nucleotide" begin
    @test count_nucleotides("GGGGGGG") == Dict('A' => 0, 'C' => 0, 'G' => 7, 'T' => 0)
end

@testset "strand with multiple nucleotides" begin
    @test count_nucleotides("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC") == Dict('A' => 20, 'C' => 12, 'G' => 17, 'T' => 21)
end

@testset "strand with invalid nucleotides" begin
    @test_throws ErrorException count_nucleotides("AGXXACT")
end