Sha256: 1df11915d76c9548686fb369ad396744f6cfb725f53ba9f808d72e95f90183a1

Contents?: true

Size: 1.73 KB

Versions: 20

Compression:

Stored size: 1.73 KB

Contents

use strict;
use warnings;

use Test::More;

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

plan tests => 12;

ok -e "$module.pm", "Missing $module.pm" or BAIL_OUT "You need to create file: $module.pm";
eval "use $module";
ok !$@, "Cannot load $module" or BAIL_OUT "Cannot load $module. Does it compile? Does it end with 1;?";

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

is_deeply $module->new(1)->commands, ["wink"], "handshake '1' is wink"
                        or diag explain $module->new(1)->commands;
is_deeply $module->new(2)->commands, ["double blink"], "handshake '2' is double blink"
                        or diag explain $module->new(2)->commands;
is_deeply $module->new(4)->commands, ["close your eyes"], "handshake '4' is close your eyes"
                        or diag explain $module->new(4)->commands;
is_deeply $module->new(8)->commands, ["jump"], "handshake '8' is jump"
                        or diag explain $module->new(8)->commands;
is_deeply $module->new(3)->commands, ["wink","double blink"], "handshake '11' is wink, double blink"
                        or diag explain $module->new(3)->commands;
is_deeply $module->new(19)->commands, ["double blink","wink"], "reverse order of handshake commands"
                        or diag explain $module->new(19)->commands;
is_deeply $module->new(31)->commands, ["jump","close your eyes","double blink","wink"], "all handshake commands in reverse"
                        or diag explain $module->new(31)->commands;
is_deeply $module->new('piggies')->commands, [], "invalid input"
                        or diag explain $module->new('piggies');

Version data entries

20 entries across 20 versions & 1 rubygems

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