Skip to content

Commit

Permalink
Add tests for Supply.comb(Str,limit)
Browse files Browse the repository at this point in the history
And get some diversity in messages.
  • Loading branch information
lizmat committed Jan 16, 2020
1 parent cd7d5b6 commit 3b516c7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions S17-supply/comb.t
Expand Up @@ -6,15 +6,15 @@ use Test::Tap;
my @source = <old dog jumpso>;
my @schedulers = ThreadPoolScheduler.new, CurrentThreadScheduler;

plan @schedulers * 11;
plan @schedulers * 13;

for @schedulers -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.raku}";

for \(), \(1), \(0), \(-1) -> \c {
tap-ok Supply.from-list(@source).comb(|c),
[<o l d d o g j u m p s o>],
"comb a simple list of words for characters";
"comb a simple list of words with {c.raku.substr(1)}";
}

tap-ok Supply.from-list(@source).comb(2),
Expand All @@ -23,21 +23,23 @@ for @schedulers -> $*SCHEDULER {

tap-ok Supply.from-list(@source).comb(2,2),
[<ol dd>],
"comb a simple list of words for 2 chars at a time exactly for a max of 2";
"comb a simple list of words with (2,2)";

for \(5), \(5,10) -> \c {
tap-ok Supply.from-list(@source).comb(|c),
[<olddo gjump so>],
"comb a simple list of words for 2 chars at a time with leftover";
"comb a simple list of words with {c.raku.substr(1)}";
}

tap-ok Supply.from-list(@source).comb(20),
['olddogjumpso'],
"comb a simple list of words for 20 chars at a time";

tap-ok Supply.from-list(@source).comb('o'),
[<o o o>],
"comb a simple list of words for a Str needle";
for \("o"), \("o",Inf), \("o",*) -> \c {
tap-ok Supply.from-list(@source).comb(|c),
[<o o o>],
"comb a simple list of words with {c.raku.substr(1)}";
}

tap-ok Supply.from-list(@source).comb('z'),
[],
Expand Down

0 comments on commit 3b516c7

Please sign in to comment.