Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Unified Diff: tests/corelib/big_integer_vm_test.dart

Issue 23455014: Remove limit on bigint multiplication - fixes issue 12833. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/bigint_operations.cc ('K') | « runtime/vm/bigint_operations.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/big_integer_vm_test.dart
diff --git a/tests/corelib/big_integer_vm_test.dart b/tests/corelib/big_integer_vm_test.dart
index 12be55e94888f828b096df61cc42d4ce772813d4..e57b3be754cc1ada315376ec7538213dd38592cc 100644
--- a/tests/corelib/big_integer_vm_test.dart
+++ b/tests/corelib/big_integer_vm_test.dart
@@ -73,6 +73,17 @@ class BigIntegerTest {
Expect.equals(20000000000000.0, b * a);
}
+ static testBigintHugeMul() {
+ var block = 28 * 256; // 28 bit chunks with 8 bit 'carry' in a DoubleChunk.
+ var bits = block * 32; // plenty of blocks in longest column sum;
+ var a = 1 << bits;
+ var a1 = a - 1; // all 1's
+ var p1 = a1 * a1;
+ var p2 = a * a - a - a + 1;
+ // Use isTrue instead of equals to avoid trying to print such big numbers.
+ Expect.isTrue(p1 == p2, 'products do not match');
+ }
+
static testBigintTruncDiv() {
var a = 12345678901234567890;
var b = 10;
@@ -160,6 +171,7 @@ class BigIntegerTest {
testBigintAdd();
testBigintSub();
testBigintMul();
+ testBigintHugeMul();
testBigintModulo();
testBigintTruncDiv();
testBigintDiv();
« runtime/vm/bigint_operations.cc ('K') | « runtime/vm/bigint_operations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698