Sha256: fd5278f2fba900a5b5fedc5d2db400a812f21da817c185b53d195729918eda0e

Contents?: true

Size: 1.2 KB

Versions: 25

Compression:

Stored size: 1.2 KB

Contents

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

BEGIN {
  plan 11;
  eval-lives-ok %*ENV<EXERCISM>.so ?? 'use Example' !! 'use Anagram', 'Module loaded';
}

ok Anagram.can('match'), 'Class Anagram has match method';

is-deeply Anagram.match('diaper', ['hello', 'world', 'zombies', 'pants']), [], 'no matches';
is-deeply Anagram.match('ant', ['tan', 'stand', 'at']), ['tan'], 'detect simple anagram';
is-deeply Anagram.match('master', ['stream', 'pigeon', 'maters']), ['stream', 'maters'], 'multiple anagrams';
is-deeply Anagram.match('galea', ['eagle']), [], 'does not confuse different duplicates';
is-deeply Anagram.match('good', ['dog', 'goody']), [], 'eleminates anagram subsets';
is-deeply Anagram.match('listen', ['enlists', 'google', 'inlets', 'banana']), ['inlets'], 'detect anagram';
is-deeply Anagram.match('allergy', ['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading']), ['gallery', 'regally', 'largely'], 'multiple anagrams';
is-deeply Anagram.match('Orchestra', ['cashregister', 'Carthorse', 'radishes']), ['Carthorse'], 'anagrams are case-insensitive';
is-deeply Anagram.match('banana', ['banana', 'Banana']), [], 'same word is not an anagram, whatever the case';

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
trackler-2.0.5.16 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.15 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.14 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.13 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.12 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.11 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.10 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.9 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.8 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.7 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.6 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.5 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.4 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.3 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.2 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.1 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.5.0 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.4.0 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.3.9 tracks/perl6/exercises/anagram/anagram.t
trackler-2.0.3.8 tracks/perl6/exercises/anagram/anagram.t