1
exercism fetch php nucleotide-count

nucleotide-count_test.php

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
<?php

require "nucleotide-count.php";

class NucleotideCountTest extends PHPUnit\Framework\TestCase
{
    public function testEmptyDNASequence()
    {
        $this->assertSame([
            'a' => 0,
            'c' => 0,
            't' => 0,
            'g' => 0,
        ], nucleotideCount(''));
    }

    public function testRepetitiveDNASequence()
    {
        $this->assertSame([
            'a' => 9,
            'c' => 0,
            't' => 0,
            'g' => 0,
        ], nucleotideCount('AAAAAAAAA'));
    }

    public function testDNASequence()
    {
        $this->assertSame([
            'a' => 20,
            'c' => 12,
            't' => 21,
            'g' => 17,
        ], nucleotideCount('AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'));
    }
}