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.139 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.138 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.137 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.136 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.135 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.134 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.133 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.132 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.131 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.130 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.129 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.128 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.127 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.126 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.125 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.124 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.123 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.122 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.121 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.2.1.120 tracks/perl5/exercises/rna-transcription/rna.t