tracks/perl6/exercises/hamming/hamming.t in trackler-2.2.1.95 vs tracks/perl6/exercises/hamming/hamming.t in trackler-2.2.1.96
- old
+ new
@@ -1,28 +1,21 @@
#!/usr/bin/env perl6
use v6;
use Test;
-use lib my $dir = $?FILE.IO.dirname;
use JSON::Fast;
+use lib $?FILE.IO.dirname;
+use Hamming;
+plan 15;
-my Str:D $exercise := 'Hamming';
-my Version:D $version = v2;
-my Str $module //= $exercise;
-plan 17;
+my Version:D $version = v3;
-use-ok $module or bail-out;
-require ::($module);
-
-if ::($exercise).^ver !~~ $version {
+if Hamming.^ver !~~ $version {
warn "\nExercise version mismatch. Further tests may fail!"
- ~ "\n$exercise is $(::($exercise).^ver.gist). "
- ~ "Test is $($version.gist).\n";
- bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
+ ~ "\nHamming is {Hamming.^ver.gist}. "
+ ~ "Test is {$version.gist}.\n";
}
-require ::($module) <&hamming-distance>;
-
my $c-data = from-json $=pod.pop.contents;
for $c-data<cases>.values {
if .<expected><error> {
throws-like {hamming-distance(|.<strand1 strand2>)}, Exception, .<description>;
} else {
@@ -156,20 +149,5 @@
}
]
}
=end code
-
-unless %*ENV<EXERCISM> {
- skip-rest 'exercism tests';
- exit;
-}
-
-subtest 'canonical-data' => {
- (my $c-data-file = "$dir/../../problem-specifications/exercises/{
- $dir.IO.resolve.basename
- }/canonical-data.json".IO.resolve) ~~ :f ??
- is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
- flunk 'problem-specifications file not found';
-}
-
-INIT { $module = 'Example' if %*ENV<EXERCISM> }