Skip to content

Commit 4babccd

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
Fix non-web integer literals in corelib_2/bigint_test
Change-Id: I9cb66de2db293a033073ced7e6b9e3d19a1f3fb4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108204 Commit-Queue: Stephen Adams <[email protected]> Reviewed-by: Leaf Petersen <[email protected]>
1 parent 738d9f9 commit 4babccd

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/corelib_2/bigint_test.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,13 @@ testShiftAmount() {
771771
Expect.equals(BigInt.zero, BigInt.zero >> 1234567890);
772772
Expect.equals(BigInt.two.pow(999), BigInt.one << 999);
773773
Expect.equals(BigInt.one, BigInt.two.pow(999) >> 999);
774-
Expect.equals(BigInt.zero, new BigInt.from(12) >> 0x7FFFFFFFFFFFFFFF);
775-
Expect.equals(-BigInt.one, -new BigInt.from(12) >> 0x7FFFFFFFFFFFFFFF);
774+
// 0x7FFFFFFFFFFFFFFF on VM, slightly rounded up on web platform.
775+
const int maxInt64 = 0x7FFFFFFFFFFFF000 + 0xFFF;
776+
Expect.equals(BigInt.zero, new BigInt.from(12) >> maxInt64);
777+
Expect.equals(-BigInt.one, -new BigInt.from(12) >> maxInt64);
776778
bool exceptionCaught = false;
777779
try {
778-
var a = BigInt.one << 0x7FFFFFFFFFFFFFFF;
780+
var a = BigInt.one << maxInt64;
779781
} on OutOfMemoryError catch (e) {
780782
exceptionCaught = true;
781783
} catch (e) {

tests/corelib_2/corelib_2.status

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ num_sign_test: Crash, Pass # Issue 31768
1616

1717
[ $compiler == dart2js ]
1818
bigint_from_test: RuntimeError # Issue 32589
19-
bigint_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
2019
bit_twiddling_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
2120
compare_to2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
2221
core_runtime_types_test: RuntimeError # Issue 34147
@@ -297,7 +296,8 @@ regexp/stack-overflow_test: RuntimeError, OK # Smaller limit with irregex interp
297296

298297
[ $compiler == dartdevc || $compiler == dartdevk ]
299298
bigint_from_test: RuntimeError # Issue 32589
300-
bigint_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
299+
bigint_test/03: SkipSlow # modPow is very slow
300+
bigint_test/15: SkipSlow # modPow is very slow
301301
bit_twiddling_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
302302
compare_to2_test: RuntimeError # Issue 30170
303303
compare_to2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351

0 commit comments

Comments
 (0)