Skip to content

Commit a393f41

Browse files
committed
Add tests for all broken examples in RT #127452
1 parent bba5083 commit a393f41

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

S07-hyperrace/hyper.t

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22
use Test;
33

4-
plan 13;
4+
plan 33;
55

66
{
77
my @result = <a b c d e f g>.hyper.map({ $_.uc });
@@ -102,3 +102,33 @@ plan 13;
102102
my @res = ^1000 .hyper.map: *+0;
103103
is-deeply @res, [@res.sort], '.hyper preserves order';
104104
}
105+
106+
# RT #127452
107+
{
108+
for ^5 -> $i {
109+
my @x = ^10;
110+
my @y = @x.hyper(:3batch, :5degree).map: { sleep rand / 100; $_ + 1 };
111+
is @y, [1..10], ".hyper(:3batch, :5degree) with sleepy mapper works (try $i)";
112+
}
113+
}
114+
{
115+
for ^5 -> $i {
116+
my @x = (^10).hyper(:1batch).map: { sleep rand / 20; $_ };
117+
is @x, [^10], ".hyper(:1batch) with sleepy mapper works (try $i)";
118+
}
119+
}
120+
{
121+
my @a = 1, 3, 2, 9, 0, |( 1 .. 100 );
122+
for ^5 -> $i {
123+
my $a = @a.hyper.map: * + 1;
124+
is $a.list, (2, 4, 3, 10, 1, |( 2 .. 101 )),
125+
"Correct result of .hyper.map(*+1).list (try $i)";
126+
}
127+
}
128+
{
129+
my $b = Blob.new((^128).pick xx 1000);
130+
for ^5 {
131+
is $b[8..906].hyper.map({.fmt("%20x")}).list, $b[8..906].map({.fmt("%20x")}).list,
132+
'.hyper.map({.fmt(...)}) on a Buf slice works';
133+
}
134+
}

S07-hyperrace/race.t

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22
use Test;
33

4-
plan 12;
4+
plan 22;
55

66
{
77
my @result = <a b c d e f g>.race.map({ $_.uc });
@@ -96,3 +96,18 @@ plan 12;
9696
}
9797
}
9898
}
99+
100+
# RT #127452
101+
{
102+
for ^5 -> $i {
103+
my @x = ^10;
104+
my @y = @x.race(:3batch, :5degree).map: { sleep rand / 100; $_ + 1 };
105+
is @y.sort, [1..10], ".race(:3batch, :5degree) with sleepy mapper works (try $i)";
106+
}
107+
}
108+
{
109+
for ^5 -> $i {
110+
my @x = (^10).race(:1batch).map: { sleep rand / 20; $_ };
111+
is @x.sort, [^10], ".race(:1batch) with sleepy mapper works (try $i)";
112+
}
113+
}

0 commit comments

Comments
 (0)