Sha256: 90ea9e987ed316674b32f4743e7bdcb0ff938902fe22e01fee5a8ac8b81d1b65

Contents?: true

Size: 1017 Bytes

Versions: 10

Compression:

Stored size: 1017 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 = $ENV{EXERCISM} ? 'Example' : 'DNA';

my @cases = (
   ['C', 'G',  'cytidine unchanged'],
   ['G', 'C',  'guanosine unchanged'],
   ['T', 'A',  'adenosine unchanged'],
   ['A', 'U',  'thymidine 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

10 entries across 10 versions & 1 rubygems

Version Path
trackler-2.0.3.4 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.0.3.3 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.0.3.2 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.0.3.1 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.0.3.0 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.0.2.0 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.0.1.2 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.0.1.1 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.0.1.0 tracks/perl5/exercises/rna-transcription/rna.t
trackler-2.0.0.10 tracks/perl5/exercises/rna-transcription/rna.t