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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 m = 609; | 303 m = 609; |
304 Expect.equals(21, x.gcd(m)); | 304 Expect.equals(21, x.gcd(m)); |
305 x = 693 << 40; | 305 x = 693 << 40; |
306 m = 609 << 40; | 306 m = 609 << 40; |
307 Expect.equals(21 << 40, x.gcd(m)); | 307 Expect.equals(21 << 40, x.gcd(m)); |
308 x = 609 << 40;; | 308 x = 609 << 40;; |
309 m = 693 << 40;; | 309 m = 693 << 40;; |
310 Expect.equals(21 <<40, x.gcd(m)); | 310 Expect.equals(21 <<40, x.gcd(m)); |
311 x = 0; | 311 x = 0; |
312 m = 1000000001; | 312 m = 1000000001; |
| 313 Expect.equals(m, x.gcd(m)); |
| 314 x = 1000000001; |
| 315 m = 0; |
| 316 Expect.equals(x, x.gcd(m)); |
| 317 x = 0; |
| 318 m = -1000000001; |
| 319 Expect.equals(-m, x.gcd(m)); |
| 320 x = -1000000001; |
| 321 m = 0; |
| 322 Expect.equals(-x, x.gcd(m)); |
| 323 x = 0; |
| 324 m = 0; |
313 Expect.throws(() => x.gcd(m), (e) => e is ArgumentError); | 325 Expect.throws(() => x.gcd(m), (e) => e is ArgumentError); |
314 x = 1000000001; | 326 x = 0; |
| 327 m = 123456789012345678901234567890; |
| 328 Expect.equals(m, x.gcd(m)); |
| 329 x = 123456789012345678901234567890; |
| 330 m = 0; |
| 331 Expect.equals(x, x.gcd(m)); |
| 332 x = 0; |
| 333 m = -123456789012345678901234567890; |
| 334 Expect.equals(-m, x.gcd(m)); |
| 335 x = -123456789012345678901234567890; |
| 336 m = 0; |
| 337 Expect.equals(-x, x.gcd(m)); |
| 338 x = 0; |
315 m = 0; | 339 m = 0; |
316 Expect.throws(() => x.gcd(m), (e) => e is ArgumentError); | 340 Expect.throws(() => x.gcd(m), (e) => e is ArgumentError); |
317 x = 1234567890; | 341 x = 1234567890; |
318 m = 19; | 342 m = 19; |
319 Expect.equals(1, x.gcd(m)); | 343 Expect.equals(1, x.gcd(m)); |
320 x = 1234567890; | 344 x = 1234567890; |
321 m = 1000000001; | 345 m = 1000000001; |
322 Expect.equals(1, x.gcd(m)); | 346 Expect.equals(1, x.gcd(m)); |
323 x = 19; | 347 x = 19; |
324 m = 1000000001; | 348 m = 1000000001; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 testBigintNegate(); /// negate: ok | 437 testBigintNegate(); /// negate: ok |
414 testShiftAmount(); /// shift: ok | 438 testShiftAmount(); /// shift: ok |
415 Expect.equals(12345678901234567890, (12345678901234567890).abs()); | 439 Expect.equals(12345678901234567890, (12345678901234567890).abs()); |
416 Expect.equals(12345678901234567890, (-12345678901234567890).abs()); | 440 Expect.equals(12345678901234567890, (-12345678901234567890).abs()); |
417 var a = 10000000000000000000; | 441 var a = 10000000000000000000; |
418 var b = 10000000000000000001; | 442 var b = 10000000000000000001; |
419 Expect.equals(false, a.hashCode == b.hashCode); | 443 Expect.equals(false, a.hashCode == b.hashCode); |
420 Expect.equals(true, a.hashCode == (b - 1).hashCode); | 444 Expect.equals(true, a.hashCode == (b - 1).hashCode); |
421 } | 445 } |
422 } | 446 } |
OLD | NEW |