OLD | NEW |
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 // VMOptions=--optimization_counter_threshold=10 | 8 // VMOptions=--optimization_counter_threshold=10 |
9 | 9 |
10 library big_integer_test; | 10 library big_integer_test; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 m = 0; | 315 m = 0; |
316 Expect.equals(x, x.gcd(m)); | 316 Expect.equals(x, x.gcd(m)); |
317 x = 0; | 317 x = 0; |
318 m = -1000000001; | 318 m = -1000000001; |
319 Expect.equals(-m, x.gcd(m)); | 319 Expect.equals(-m, x.gcd(m)); |
320 x = -1000000001; | 320 x = -1000000001; |
321 m = 0; | 321 m = 0; |
322 Expect.equals(-x, x.gcd(m)); | 322 Expect.equals(-x, x.gcd(m)); |
323 x = 0; | 323 x = 0; |
324 m = 0; | 324 m = 0; |
325 Expect.throws(() => x.gcd(m), (e) => e is ArgumentError); | 325 Expect.equals(0, x.gcd(m)); |
326 x = 0; | 326 x = 0; |
327 m = 123456789012345678901234567890; | 327 m = 123456789012345678901234567890; |
328 Expect.equals(m, x.gcd(m)); | 328 Expect.equals(m, x.gcd(m)); |
329 x = 123456789012345678901234567890; | 329 x = 123456789012345678901234567890; |
330 m = 0; | 330 m = 0; |
331 Expect.equals(x, x.gcd(m)); | 331 Expect.equals(x, x.gcd(m)); |
332 x = 0; | 332 x = 0; |
333 m = -123456789012345678901234567890; | 333 m = -123456789012345678901234567890; |
334 Expect.equals(-m, x.gcd(m)); | 334 Expect.equals(-m, x.gcd(m)); |
335 x = -123456789012345678901234567890; | 335 x = -123456789012345678901234567890; |
336 m = 0; | 336 m = 0; |
337 Expect.equals(-x, x.gcd(m)); | 337 Expect.equals(-x, x.gcd(m)); |
338 x = 0; | |
339 m = 0; | |
340 Expect.throws(() => x.gcd(m), (e) => e is ArgumentError); | |
341 x = 1234567890; | 338 x = 1234567890; |
342 m = 19; | 339 m = 19; |
343 Expect.equals(1, x.gcd(m)); | 340 Expect.equals(1, x.gcd(m)); |
344 x = 1234567890; | 341 x = 1234567890; |
345 m = 1000000001; | 342 m = 1000000001; |
346 Expect.equals(1, x.gcd(m)); | 343 Expect.equals(1, x.gcd(m)); |
347 x = 19; | 344 x = 19; |
348 m = 1000000001; | 345 m = 1000000001; |
349 Expect.equals(19, x.gcd(m)); | 346 Expect.equals(19, x.gcd(m)); |
350 x = 19; | 347 x = 19; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 testBigintNegate(); /// negate: ok | 434 testBigintNegate(); /// negate: ok |
438 testShiftAmount(); /// shift: ok | 435 testShiftAmount(); /// shift: ok |
439 Expect.equals(12345678901234567890, (12345678901234567890).abs()); | 436 Expect.equals(12345678901234567890, (12345678901234567890).abs()); |
440 Expect.equals(12345678901234567890, (-12345678901234567890).abs()); | 437 Expect.equals(12345678901234567890, (-12345678901234567890).abs()); |
441 var a = 10000000000000000000; | 438 var a = 10000000000000000000; |
442 var b = 10000000000000000001; | 439 var b = 10000000000000000001; |
443 Expect.equals(false, a.hashCode == b.hashCode); | 440 Expect.equals(false, a.hashCode == b.hashCode); |
444 Expect.equals(true, a.hashCode == (b - 1).hashCode); | 441 Expect.equals(true, a.hashCode == (b - 1).hashCode); |
445 } | 442 } |
446 } | 443 } |
OLD | NEW |