Skip to content

Commit

Permalink
Add more +> tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed May 10, 2017
1 parent 02d1f9d commit 2b0c189
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions S03-operators/bit.t
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,21 @@ plan 39;

# RT#126942
# RT#131278
subtest '+> bit shift of negative numbers' => {
subtest '+> bit shift' => {
my @p = 1, 2, 4, 10, 30, 31, 32, 33, 40, 60, 63, 64, 65, 100, 500, 1000;
my @n = 1, 3, 4, 10, 15, 50, 75, 100, 500, 751, 1000;
plan 2 + @p*@n;
plan 4 + 2*@p*@n;

cmp-ok -0x8000000000000000 +> 32, '===', -2147483648,
'-0x8000000000000000 shifted by 32';
cmp-ok 0x8000000000000000 +> 32, '===', 2147483648,
'0x8000000000000000 shifted by 32';
cmp-ok -12 +> 32, '===', -1, '-12 shifted by 32';
cmp-ok 12 +> 32, '===', 0, '12 shifted by 32';
for @p -> $p {
for @n -> $n {
cmp-ok -15**$n +> $p, '===', -15**$n div 2**$p, "-15**$n +> $p"
cmp-ok -15**$n +> $p, '===', -15**$n div 2**$p, "-15**$n +> $p";
cmp-ok 15**$n +> $p, '===', 15**$n div 2**$p, "15**$n +> $p"
}
}
}
Expand Down

0 comments on commit 2b0c189

Please sign in to comment.