Sha256: fc0e6336525d8a96afe8c3cdb41730d45e9e85e05e03d5cc7c12cfaea07e45c1

Contents?: true

Size: 1.04 KB

Versions: 19

Compression:

Stored size: 1.04 KB

Contents

use v6;
use Test;
use lib './';

plan 8;

BEGIN { EVAL('use Example') }; pass 'Load module';
ok Accumulate.can('accumulate'), 'Accumulate class has accumulate() method';

is-deeply Accumulate.accumulate([ ], sub {}),
          [ ],
          'test empty';

is-deeply Accumulate.accumulate([1, 2, 3, 4, 5], sub { @_[0] * @_[0] }),
          [1, 4, 9, 16, 25],
          'raise to 2';

is-deeply Accumulate.accumulate([10, 17, 23], sub { [ (@_[0] / 7).truncate, (@_[0] % 7).truncate ] }),
          [[1, 3], [2, 3], [3, 2] ],
          'divmod';

is-deeply Accumulate.accumulate(['hello', 'exercism'], sub { @_[0].uc }),
          ['HELLO', 'EXERCISM'],
          'capitalize';

is-deeply Accumulate.accumulate(['a', 'b', 'c' ], sub ($inp) { [ Accumulate.accumulate( [1, 2, 3], sub ($inp2) { $inp ~ $inp2 } )]}),
          [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3'], ['c1', 'c2', 'c3']],
          'recursive';

is-deeply Accumulate.accumulate(['the', 'quick', 'brown', 'fox'], sub { @_[0].flip }),
          ['eht', 'kciuq', 'nworb', 'xof'],
          'reverse strings';

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
trackler-2.0.0.8 tracks/perl6/accumulate/accumulate.t
trackler-2.0.0.7 tracks/perl6/accumulate/accumulate.t
trackler-2.0.0.6 tracks/perl6/accumulate/accumulate.t
trackler-2.0.0.5 tracks/perl6/accumulate/accumulate.t
trackler-2.0.0.4 tracks/perl6/accumulate/accumulate.t
trackler-2.0.0.3 tracks/perl6/accumulate/accumulate.t
trackler-2.0.0.2 tracks/perl6/accumulate/accumulate.t
trackler-2.0.0.1 tracks/perl6/accumulate/accumulate.t
trackler-2.0.0.0 tracks/perl6/accumulate/accumulate.t
trackler-1.0.4.1 tracks/perl6/accumulate/accumulate.t
trackler-1.0.4.0 tracks/perl6/accumulate/accumulate.t
trackler-1.0.3.0 tracks/perl6/accumulate/accumulate.t
trackler-1.0.2.1 tracks/perl6/accumulate/accumulate.t
trackler-1.0.2.0 tracks/perl6/accumulate/accumulate.t
trackler-1.0.1.2 tracks/perl6/accumulate/accumulate.t
trackler-1.0.1.1 tracks/perl6/accumulate/accumulate.t
trackler-1.0.1.0 tracks/perl6/accumulate/accumulate.t
trackler-1.0.0.1 tracks/perl6/accumulate/accumulate.t
trackler-1.0.0 tracks/perl6/accumulate/accumulate.t