Skip to content

Commit

Permalink
Sync rna-transcription (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
fejan-malek authored Jun 10, 2024
1 parent 9b5d319 commit bc04684
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 45 deletions.
2 changes: 1 addition & 1 deletion exercises/practice/rna-transcription/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
},
"blurb": "Given a DNA strand, return its RNA Complement Transcription.",
"source": "Hyperphysics",
"source_url": "https://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html"
"source_url": "https://web.archive.org/web/20220408112140/http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html"
}
22 changes: 0 additions & 22 deletions exercises/practice/rna-transcription/.meta/example.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
<?php

/*
* By adding type hints and enabling strict type checking, code can become
* easier to read, self-documenting and reduce the number of potential bugs.
* By default, type declarations are non-strict, which means they will attempt
* to change the original type to match the type specified by the
* type-declaration.
*
* In other words, if you pass a string to a function requiring a float,
* it will attempt to convert the string value to a float.
*
* To enable strict mode, a single declare directive must be placed at the top
* of the file.
* This means that the strictness of typing is configured on a per-file basis.
* This directive not only affects the type declarations of parameters, but also
* a function's return type.
*
* For more info review the Concept on strict type checking in the PHP track
* <link>.
*
* To disable strict typing, comment out the directive below.
*/

declare(strict_types=1);

function toRna($strand)
Expand Down
51 changes: 29 additions & 22 deletions exercises/practice/rna-transcription/RnaTranscriptionTest.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
<?php

/*
* By adding type hints and enabling strict type checking, code can become
* easier to read, self-documenting and reduce the number of potential bugs.
* By default, type declarations are non-strict, which means they will attempt
* to change the original type to match the type specified by the
* type-declaration.
*
* In other words, if you pass a string to a function requiring a float,
* it will attempt to convert the string value to a float.
*
* To enable strict mode, a single declare directive must be placed at the top
* of the file.
* This means that the strictness of typing is configured on a per-file basis.
* This directive not only affects the type declarations of parameters, but also
* a function's return type.
*
* For more info review the Concept on strict type checking in the PHP track
* <link>.
*
* To disable strict typing, comment out the directive below.
*/

declare(strict_types=1);

class RnaTranscriptionTest extends PHPUnit\Framework\TestCase
Expand All @@ -31,26 +9,55 @@ public static function setUpBeforeClass(): void
require_once 'RnaTranscription.php';
}

/**
* @testdox It handles an empty string
* uuid b4631f82-c98c-4a2f-90b3-c5c2b6c6f661
*/
public function testHandlesEmptyString(): void
{
$this->assertSame('', toRna(''));
}

/**
* @testdox It transcribes guanine to cytosine
* uuid a9558a3c-318c-4240-9256-5d5ed47005a6
*/
public function testTranscribesGuanineToCytosine(): void
{
$this->assertSame('G', toRna('C'));
}

/**
* @testdox It transcribes cytosine to guanine
* uuid 6eedbb5c-12cb-4c8b-9f51-f8320b4dc2e7
*/
public function testTranscribesCytosineToGuanine(): void
{
$this->assertSame('C', toRna('G'));
}

/**
* @testdox It transcribes thymine to adenine
* uuid 870bd3ec-8487-471d-8d9a-a25046488d3e
*/
public function testTranscribesThymineToAdenine(): void
{
$this->assertSame('A', toRna('T'));
}

/**
* @testdox It transcribes adenine to uracil
* uuid aade8964-02e1-4073-872f-42d3ffd74c5f
*/
public function testTranscribesAdenineToUracil(): void
{
$this->assertSame('U', toRna('A'));
}

/**
* @testdox RNA complement
* uuid 79ed2757-f018-4f47-a1d7-34a559392dbf
*/
public function testTranscribesAllOccurrencesOne(): void
{
$this->assertSame('UGCACCAGAAUU', toRna('ACGTGGTCTTAA'));
Expand Down

0 comments on commit bc04684

Please sign in to comment.