Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add :elems/:overlap tests for Supply.buffering
Timed buffering is a bit trickier to test, more on that later
  • Loading branch information
lizmat committed Apr 20, 2014
1 parent 77fbcff commit 162bbf4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion S17-concurrency/supply.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 182;
plan 194;

sub tap_ok ( $s, $expected, $text ) {
ok $s ~~ Supply, "{$s.^name} appears to be doing Supply";
Expand Down Expand Up @@ -289,4 +289,12 @@ for (ThreadPoolScheduler, CurrentThreadScheduler) {
ok $done, "the merged supply was really done";
is_deeply @res.sort, [1..15], "merging 3 supplies works";
}

tap_ok Supply.for(1..14).buffering(:elems(5)),
[[1..5],[6..10],[11..14]],
"we can buffer by number of elements";

tap_ok Supply.for(1..5).buffering(:elems(2), :overlap(1)),
[[1,2],[2,3],[3,4],[4,5],[5]],
"we can buffer by number of elements and overlap";
}

0 comments on commit 162bbf4

Please sign in to comment.