Sha256: b8496287465922835130750f25f0ff98927b19d0a0bf6091c998f1696bdd6b88

Contents?: true

Size: 1.8 KB

Versions: 73

Compression:

Stored size: 1.8 KB

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 = 'SecretHandshake';

plan tests => 12;

ok -e "${dir}${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

73 entries across 73 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.179 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.178 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.177 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.176 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.175 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.174 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.173 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.172 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.171 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.170 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.169 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.167 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.166 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.165 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.164 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.163 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.162 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.161 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.160 tracks/perl5/exercises/secret-handshake/handshake.t