Skip to content

Commit 37543ad

Browse files
committed
Add testcase for div_i in JIT
Apparently has a negative number bug
1 parent 358931c commit 37543ad

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

t/moar/51-jit-div_i.t

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env nqp-m
2+
3+
nqp::say("plan 1..1");
4+
sub foo(int $i, int $j) {
5+
my int $x := nqp::div_i($i, $j);
6+
}
7+
8+
sub test-div() {
9+
my int $i := 0;
10+
while ($i < 200) {
11+
my int $y := foo(-1, 10);
12+
if ($y != -1) {
13+
return 0;
14+
}
15+
$i := $i + 1;
16+
}
17+
}
18+
19+
if (test-div()) {
20+
nqp::say("ok div_i");
21+
} else {
22+
my int $result := foo(-1,10);
23+
nqp::say("not ok div_i $result");
24+
}

0 commit comments

Comments
 (0)