Sha256: 3d7ac158778551f702ea5d0c94f394ce0d0f0f3314c2fe19c05550b1f9ef29d8

Contents?: true

Size: 1.08 KB

Versions: 25

Compression:

Stored size: 1.08 KB

Contents

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

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

ok Word_Counter.can('count_words'), 'Class Word_Counter has count_words method';

is-deeply Word_Counter.count_words('word'),                                {word =>  1},                    'one word';
is-deeply Word_Counter.count_words('one of each'),                         {one => 1, of => 1, each => 1},  'one of each';
is-deeply Word_Counter.count_words('one fish two fish red fish blue fish'), 
    {one => 1, fish => 4, two => 1, red => 1, blue => 1}, 
    'multiple occurences';
is-deeply Word_Counter.count_words('car : carpet as java : javascript!!&@$%^&'), 
    {car => 1, carpet => 1, as => 1, java => 1, javascript => 1},
    'ignore punctuation';
is-deeply Word_Counter.count_words('testing, 1, 2 testing'),               {testing => 2, 1 => 1, 2 => 1}, 'include numbers';
is-deeply Word_Counter.count_words('go Go GO'),                            {go => 3},                       'normalize case';


Version data entries

25 entries across 25 versions & 1 rubygems

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