Skip to content

Commit

Permalink
Adjust tests for Nucleotide Count exercise to match problem-specifica…
Browse files Browse the repository at this point in the history
…tions (#612)

* Adjust tests to match problem-specifications

* Add uuid to docblocks, and added to contributors
  • Loading branch information
tomasnorre committed Feb 15, 2024
1 parent 23dbcd1 commit 06ad849
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
3 changes: 2 additions & 1 deletion exercises/practice/nucleotide-count/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"contributors": [
"arueckauer",
"kytrinyx",
"petemcfarlane"
"petemcfarlane",
"tomasnorre"
],
"files": {
"solution": [
Expand Down
39 changes: 35 additions & 4 deletions exercises/practice/nucleotide-count/NucleotideCountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public static function setUpBeforeClass(): void
require_once 'NucleotideCount.php';
}

/**
* uuid: 3e5c30a8-87e2-4845-a815-a49671ade970
*/
public function testEmptyDNASequence(): void
{
$this->assertSame([
Expand All @@ -41,17 +44,36 @@ public function testEmptyDNASequence(): void
], nucleotideCount(''));
}

/**
* uuid: a0ea42a6-06d9-4ac6-828c-7ccaccf98fec
*/
public function testDNASequenceSingleNucleotide(): void
{
$this->assertSame([
'a' => 0,
'c' => 0,
't' => 0,
'g' => 1,
], nucleotideCount('G'));
}

/**
* uuid: eca0d565-ed8c-43e7-9033-6cefbf5115b5
*/
public function testRepetitiveDNASequence(): void
{
$this->assertSame([
'a' => 9,
'a' => 0,
'c' => 0,
't' => 0,
'g' => 0,
], nucleotideCount('AAAAAAAAA'));
'g' => 7,
], nucleotideCount('GGGGGGG'));
}

public function testDNASequence(): void
/**
* uuid: 40a45eac-c83f-4740-901a-20b22d15a39f
*/
public function testDNASequenceWithMultipleNucleotides(): void
{
$this->assertSame([
'a' => 20,
Expand All @@ -60,4 +82,13 @@ public function testDNASequence(): void
'g' => 17,
], nucleotideCount('AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'));
}

/**
* uuid: b4c47851-ee9e-4b0a-be70-a86e343bd851
*/
public function testDNASequenceWithInvalidNucleotides(): void
{
$this->expectException(Exception::class);
nucleotideCount('AGXXACT');
}
}

0 comments on commit 06ad849

Please sign in to comment.