Skip to content

Commit 06ad849

Browse files
authored
Adjust tests for Nucleotide Count exercise to match problem-specifications (#612)
* Adjust tests to match problem-specifications * Add uuid to docblocks, and added to contributors
1 parent 23dbcd1 commit 06ad849

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

exercises/practice/nucleotide-count/.meta/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"contributors": [
66
"arueckauer",
77
"kytrinyx",
8-
"petemcfarlane"
8+
"petemcfarlane",
9+
"tomasnorre"
910
],
1011
"files": {
1112
"solution": [

exercises/practice/nucleotide-count/NucleotideCountTest.php

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public static function setUpBeforeClass(): void
3131
require_once 'NucleotideCount.php';
3232
}
3333

34+
/**
35+
* uuid: 3e5c30a8-87e2-4845-a815-a49671ade970
36+
*/
3437
public function testEmptyDNASequence(): void
3538
{
3639
$this->assertSame([
@@ -41,17 +44,36 @@ public function testEmptyDNASequence(): void
4144
], nucleotideCount(''));
4245
}
4346

47+
/**
48+
* uuid: a0ea42a6-06d9-4ac6-828c-7ccaccf98fec
49+
*/
50+
public function testDNASequenceSingleNucleotide(): void
51+
{
52+
$this->assertSame([
53+
'a' => 0,
54+
'c' => 0,
55+
't' => 0,
56+
'g' => 1,
57+
], nucleotideCount('G'));
58+
}
59+
60+
/**
61+
* uuid: eca0d565-ed8c-43e7-9033-6cefbf5115b5
62+
*/
4463
public function testRepetitiveDNASequence(): void
4564
{
4665
$this->assertSame([
47-
'a' => 9,
66+
'a' => 0,
4867
'c' => 0,
4968
't' => 0,
50-
'g' => 0,
51-
], nucleotideCount('AAAAAAAAA'));
69+
'g' => 7,
70+
], nucleotideCount('GGGGGGG'));
5271
}
5372

54-
public function testDNASequence(): void
73+
/**
74+
* uuid: 40a45eac-c83f-4740-901a-20b22d15a39f
75+
*/
76+
public function testDNASequenceWithMultipleNucleotides(): void
5577
{
5678
$this->assertSame([
5779
'a' => 20,
@@ -60,4 +82,13 @@ public function testDNASequence(): void
6082
'g' => 17,
6183
], nucleotideCount('AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'));
6284
}
85+
86+
/**
87+
* uuid: b4c47851-ee9e-4b0a-be70-a86e343bd851
88+
*/
89+
public function testDNASequenceWithInvalidNucleotides(): void
90+
{
91+
$this->expectException(Exception::class);
92+
nucleotideCount('AGXXACT');
93+
}
6394
}

0 commit comments

Comments
 (0)