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.159 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.158 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.157 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.156 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.155 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.154 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.153 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.152 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.151 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.150 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.149 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.148 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.147 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.146 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.145 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.144 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.143 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.142 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.141 tracks/perl5/exercises/secret-handshake/handshake.t
trackler-2.2.1.140 tracks/perl5/exercises/secret-handshake/handshake.t