Skip to content

Commit

Permalink
Add inlining tests for integer comparators
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jan 25, 2021
1 parent d94d07e commit 0536d03
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 10 deletions.
15 changes: 5 additions & 10 deletions t/09-moar/12-inline-arithmetic.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@ else {
my $a = 42;
my $b = 666;
for ^100000 {
my $c := $a + $b;
}
for ^100000 {
my $c := $a - $b;
}
for ^100000 {
my $c := $a * $b;
}
for ^100000 {
my $c := $a / $b;
my $c;
$c := $a + $b;
$c := $a - $b;
$c := $a * $b;
$c := $a / $b;
}
}

Expand Down
34 changes: 34 additions & 0 deletions t/09-moar/13-inline-comparators-int.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
use Test;
use MoarVM::SIL;

# running the tests after the code has run
if SIL() -> $SIL {
my @names =
'infix:<==>', 'infix:<!=>', 'infix:«>»', 'infix:«>=»',
'infix:«<»', 'infix:«<=»', 'infix:«<=>»',
;

plan +@names;

for @names {
ok $SIL.inlined-by-name($_), "Was $_ inlined?";
}
}

# running the code
else {
my $a = 42;
my $b = 666;
for ^100000 {
my $c;
$c := $a == $b;
$c := $a != $b;
$c := $a > $b;
$c := $a >= $b;
$c := $a < $b;
$c := $a <= $b;
$c := $a <=> $b;
}
}

# vim: expandtab shiftwidth=4

0 comments on commit 0536d03

Please sign in to comment.