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

Side by Side Diff: tests/corelib/big_integer_arith_vm_test.dart

Issue 1177063002: Detect zero receiver of modInverse (may not converge and time out (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « sdk/lib/core/int.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Testing Bigints with and without intrinsics. 5 // Testing Bigints with and without intrinsics.
6 // VMOptions= 6 // VMOptions=
7 // VMOptions=--no_intrinsify 7 // VMOptions=--no_intrinsify
8 8
9 library big_integer_test; 9 library big_integer_test;
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 Expect.equals(true, m.isEven); 228 Expect.equals(true, m.isEven);
229 try { 229 try {
230 x.modInverse(m); 230 x.modInverse(m);
231 Expect.fail("Did not throw UnimplementedError"); 231 Expect.fail("Did not throw UnimplementedError");
232 } on UnimplementedError catch (e) { 232 } on UnimplementedError catch (e) {
233 } 233 }
234 } 234 }
235 235
236 testBigintModInverse() { 236 testBigintModInverse() {
237 var x, m; 237 var x, m;
238 x = 0;
239 m = 1000000001;
240 Expect.equals(0, x.modInverse(m)); // Not coprime.
238 x = 1234567890; 241 x = 1234567890;
239 m = 19; 242 m = 19;
240 Expect.equals(11, x.modInverse(m)); 243 Expect.equals(11, x.modInverse(m));
241 x = 1234567890; 244 x = 1234567890;
242 m = 1000000001; 245 m = 1000000001;
243 Expect.equals(189108911, x.modInverse(m)); 246 Expect.equals(189108911, x.modInverse(m));
244 x = 19; 247 x = 19;
245 m = 1000000001; 248 m = 1000000001;
246 Expect.equals(0, x.modInverse(m)); // Not coprime. 249 Expect.equals(0, x.modInverse(m)); // Not coprime.
247 x = 19; 250 x = 19;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 testBigintModInverse(); 334 testBigintModInverse();
332 testBigintNegate(); 335 testBigintNegate();
333 testShiftAmount(); 336 testShiftAmount();
334 Expect.equals(12345678901234567890, (12345678901234567890).abs()); 337 Expect.equals(12345678901234567890, (12345678901234567890).abs());
335 Expect.equals(12345678901234567890, (-12345678901234567890).abs()); 338 Expect.equals(12345678901234567890, (-12345678901234567890).abs());
336 var a = 10000000000000000000; 339 var a = 10000000000000000000;
337 var b = 10000000000000000001; 340 var b = 10000000000000000001;
338 Expect.equals(false, a.hashCode == b.hashCode); 341 Expect.equals(false, a.hashCode == b.hashCode);
339 Expect.equals(true, a.hashCode == (b - 1).hashCode); 342 Expect.equals(true, a.hashCode == (b - 1).hashCode);
340 } 343 }
OLDNEW
« no previous file with comments | « sdk/lib/core/int.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698