Sha256: 1bc0f2f8694d6a94af852b66c742ec91766f9a457b78ae65d8aaa2102ce0341e

Contents?: true

Size: 1.04 KB

Versions: 75

Compression:

Stored size: 1.04 KB

Contents

#!/usr/bin/env perl6
use v6;
use Test;
use lib IO::Path.new($?FILE).parent.path;

plan 23;
my $module = %*ENV<EXERCISM> ?? 'Example' !! 'Raindrops';
use-ok $module;
require ::($module) <Raindrops>;

ok Raindrops.can('convert'), 'Class Raindrops has convert method';

my @ints = 1, 8, 52;
my @plings = 3, 6, 9, 27;
my @plangs = 5, 10, 25, 3125;
my @plongs = 7, 14, 49;

for @ints {
  is Raindrops.convert($_), $_, "$_ is not a factor of 3, 5 or 7";
  isa-ok Raindrops.convert($_), Str, "$_ gives a string";
}
is Raindrops.convert($_), 'Pling', "$_ is a factor of 3, not 5 or 7" for @plings;
is Raindrops.convert($_), 'Plang', "$_ is a factor of 5, not 3 or 7" for @plangs;
is Raindrops.convert($_), 'Plong', "$_ is a factor of 7, not 3 or 5" for @plongs;
is Raindrops.convert(15), 'PlingPlang', '15 is a factor of 3 and 5, not 7';
is Raindrops.convert(21), 'PlingPlong', '21 is a factor of 3 and 7, not 5';
is Raindrops.convert(35), 'PlangPlong', '35 is a factor of 5 and 7, not 3';
is Raindrops.convert(105), 'PlingPlangPlong', '105 is a factor of 3, 5 and 7';

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
trackler-2.0.6.32 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.31 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.30 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.29 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.28 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.27 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.26 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.25 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.24 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.23 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.22 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.21 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.20 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.19 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.18 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.17 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.16 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.15 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.14 tracks/perl6/exercises/raindrops/raindrops.t
trackler-2.0.6.13 tracks/perl6/exercises/raindrops/raindrops.t