Sha256: 7284604419d9977f77f1b8063de1fd7c00c10d35d3be3e093808c721d97988ec

Contents?: true

Size: 982 Bytes

Versions: 73

Compression:

Stored size: 982 Bytes

Contents

#!/usr/bin/env perl
use strict;
use warnings;

use Test::More;
use FindBin;
my $dir;
BEGIN { $dir = $FindBin::Bin . '/' };
use lib $dir;

my $module = 'DNA';

my @cases = (
   ['C', 'G',  'cytosine unchanged'],
   ['G', 'C',  'guanine unchanged'],
   ['T', 'A',  'adenine unchanged'],
   ['A', 'U',  'thymine to uracil'],
   ['ACGTGGTCTTAA', 'UGCACCAGAAUU', 'transcribes all occurences'],
);

plan tests => 3 + @cases;

ok -e "${dir}${module}.pm", "missing $module.pm"
    or BAIL_OUT("You need to create a module called $module.pm with a function called to_rna() that gets one parameter: a DNA sequence");

eval "use $module";
ok !$@, "Cannot load $module.pm"
    or BAIL_OUT("Does $module.pm compile?  Does it end with some true value?");

can_ok($module, 'to_rna') or BAIL_OUT("Missing package $module; or missing sub to_rna");

my $sub = $module . '::to_rna';

foreach my $c (@cases) {
    no strict 'refs';
    is $sub->($c->[0]), $c->[1], "$c->[2]: $c->[0]   => $c->[1]";
}


Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.179 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.178 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.177 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.176 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.175 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.174 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.173 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.172 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.171 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.170 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.169 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.167 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.166 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.165 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.164 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.163 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.162 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.161 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.160 tracks/perl5/exercises/rna-transcription/rna.t