Sha256: 6b5e53cb362518810bd9838e0cb1254484709745de510e0866698d700ff7bd4c

Contents?: true

Size: 936 Bytes

Versions: 20

Compression:

Stored size: 936 Bytes

Contents

use strict;
use warnings;

use Test::More;
use JSON qw(from_json);

my $module = $ENV{EXERCISM} ? 'Example' : 'DNA'; 

my $cases_file = 'cases.json';
my $cases;
if (open my $fh, '<', $cases_file) {
    local $/ = undef;
    $cases = from_json scalar <$fh>;
} else {
    die "Could not open '$cases_file' $!";
}

plan tests => 4 + @$cases;

ok -e "$module.pm", "missing $module.pm"
    or BAIL_OUT("You need to create a class called $module.pm with a constructor called new.");

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

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

missing sub hamming_distance()");

foreach my $c (@$cases) {
   is $module->new($c->{strand})->hamming_distance($c->{input}),
      $c->{expected},
      $c->{name};
}

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
trackler-2.0.0.9 tracks/perl5/point-mutations/dna.t
trackler-2.0.0.8 tracks/perl5/point-mutations/dna.t
trackler-2.0.0.7 tracks/perl5/point-mutations/dna.t
trackler-2.0.0.6 tracks/perl5/point-mutations/dna.t
trackler-2.0.0.5 tracks/perl5/point-mutations/dna.t
trackler-2.0.0.4 tracks/perl5/point-mutations/dna.t
trackler-2.0.0.3 tracks/perl5/point-mutations/dna.t
trackler-2.0.0.2 tracks/perl5/point-mutations/dna.t
trackler-2.0.0.1 tracks/perl5/point-mutations/dna.t
trackler-2.0.0.0 tracks/perl5/point-mutations/dna.t
trackler-1.0.4.1 tracks/perl5/point-mutations/dna.t
trackler-1.0.4.0 tracks/perl5/point-mutations/dna.t
trackler-1.0.3.0 tracks/perl5/point-mutations/dna.t
trackler-1.0.2.1 tracks/perl5/point-mutations/dna.t
trackler-1.0.2.0 tracks/perl5/point-mutations/dna.t
trackler-1.0.1.2 tracks/perl5/point-mutations/dna.t
trackler-1.0.1.1 tracks/perl5/point-mutations/dna.t
trackler-1.0.1.0 tracks/perl5/point-mutations/dna.t
trackler-1.0.0.1 tracks/perl5/point-mutations/dna.t
trackler-1.0.0 tracks/perl5/point-mutations/dna.t