Skip to content

Commit ee77445

Browse files
author
Geoffrey Broadwell
committed
Add rc-man-or-boy-test
1 parent 7cf00e5 commit ee77445

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

nqp/rc-man-or-boy-test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sub A ($k, $x1, $x2, $x3, $x4, $x5) {
2+
my $B := sub () { A(--$k, $B, $x1, $x2, $x3, $x4) };
3+
$k <= 0 ?? $x4() + $x5() !! $B();
4+
}
5+
6+
say(A(+@ARGS[1], sub(){1}, sub(){-1}, sub(){-1}, sub(){1}, sub(){0}));

perl5/rc-man-or-boy-test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sub A {
2+
my ($k, $x1, $x2, $x3, $x4, $x5) = @_;
3+
my($B);
4+
$B = sub { A(--$k, $B, $x1, $x2, $x3, $x4) };
5+
$k <= 0 ? &$x4 + &$x5 : &$B;
6+
}
7+
8+
say A($ARGV[0], sub{1}, sub{-1}, sub{-1}, sub{1}, sub{0});

perl6/rc-man-or-boy-test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sub A ($k is copy, $x1, $x2, $x3, $x4, $x5) {
2+
my $B = sub () { A(--$k, $B, $x1, $x2, $x3, $x4) };
3+
$k <= 0 ?? $x4() + $x5() !! $B();
4+
}
5+
6+
say A(+@*ARGS[0], sub{1}, sub{-1}, sub{-1}, sub{1}, sub{0});

timeall

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ my %TESTS = (
171171
perl6 => [qw( BENCH/perl6/rc-forest-fire 30 20 10 )],
172172
nqp => [qw( BENCH/nqp/rc-forest-fire 30 20 10 )],
173173
},
174+
{
175+
name => 'rc-man-or-boy-test',
176+
skip => [qw( )],
177+
perl5 => [qw( BENCH/perl5/rc-man-or-boy-test 10 )],
178+
perl6 => [qw( BENCH/perl6/rc-man-or-boy-test 10 )],
179+
nqp => [qw( BENCH/nqp/rc-man-or-boy-test 10 )],
180+
},
174181
],
175182
);
176183
my %FORMATTER = (

0 commit comments

Comments
 (0)