Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for RT#125466 | [MATH] bitwise shift is inconsistent on int #344

Merged
merged 3 commits into from
Oct 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion S03-operators/bit.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Test;

# Mostly copied from Perl 5.8.4 s t/op/bop.t

plan 40;
plan 54;

# test the bit operators '&', '|', '^', '+<', and '+>'

Expand Down Expand Up @@ -135,6 +135,31 @@ plan 40;
#if ("ok \xFF\x{FF}\n" ~& "ok 41\n" eq "ok 41\n") { say "ok 19" } else { say "not ok 19" }
#if ("ok \x{FF}\xFF\n" ~& "ok 42\n" eq "ok 42\n") { say "ok 20" } else { say "not ok 20" }

# RT#125466 - bitwise shift consistency on int
{
my int $int_min = -9223372036854775808; # int.Range.min for 64bit
my int $int_max = 9223372036854775807; # int.Range.max for 64bit

is($int_min +> 16, -140737488355328);
is($int_min +> 32, -2147483648);
is($int_min +> 63, -1);
#?rakudo todo "Clarification needed RT#125466"
is($int_min +> 64, -1);
is($int_min +> -32, -39614081257132168796771975168);
is($int_min +> -64, -170141183460469231731687303715884105728);

is($int_max +> 16, 140737488355327);
is($int_max +> 32, 2147483647);
is($int_max +> 63, 0);
#?rakudo todo "Clarification needed RT#125466"
is($int_max +> 64, 0);
is($int_max +> -2, 36893488147419103228);
is($int_max +> -32, 39614081257132168792477007872);
#?rakudo todo "Clarification needed RT#125466"
is($int_max +< 2, 36893488147419103228);
is($int_max +< -2, 2305843009213693951);
}

# RT#126942
# RT#131278
subtest '+> bit shift' => {
Expand Down