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.139 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.138 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.137 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.136 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.135 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.134 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.133 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.132 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.131 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.130 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.129 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.128 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.127 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.126 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.125 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.124 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.123 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.122 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.121 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.120 tracks/perl5/exercises/secret-handshake/handshake.t