| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #library('int64test'); | 5 #library('int64test'); |
| 6 #import('../fixnum.dart'); | 6 #import('../fixnum.dart'); |
| 7 | 7 |
| 8 void main() { | 8 void main() { |
| 9 testAdditive(); | 9 testAdditive(); |
| 10 testBitOps(); | 10 testBitOps(); |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 new int64.fromInts(0x92345678, 0x9abcdef0).shiftRightUnsigned(36)); | 508 new int64.fromInts(0x92345678, 0x9abcdef0).shiftRightUnsigned(36)); |
| 509 Expect.equals(new int64.fromInts(0x00000000, 0x00923456), | 509 Expect.equals(new int64.fromInts(0x00000000, 0x00923456), |
| 510 new int64.fromInts(0x92345678, 0x9abcdef0).shiftRightUnsigned(40)); | 510 new int64.fromInts(0x92345678, 0x9abcdef0).shiftRightUnsigned(40)); |
| 511 Expect.equals(new int64.fromInts(0x00000000, 0x00092345), | 511 Expect.equals(new int64.fromInts(0x00000000, 0x00092345), |
| 512 new int64.fromInts(0x92345678, 0x9abcdef0).shiftRightUnsigned(44)); | 512 new int64.fromInts(0x92345678, 0x9abcdef0).shiftRightUnsigned(44)); |
| 513 Expect.equals(new int64.fromInts(0x00000000, 0x00009234), | 513 Expect.equals(new int64.fromInts(0x00000000, 0x00009234), |
| 514 new int64.fromInts(0x92345678, 0x9abcdef0).shiftRightUnsigned(48)); | 514 new int64.fromInts(0x92345678, 0x9abcdef0).shiftRightUnsigned(48)); |
| 515 | 515 |
| 516 try { | 516 try { |
| 517 new int64.fromInt(17) >> -1; | 517 new int64.fromInt(17) >> -1; |
| 518 Expect.fail("x >> -1 should throw IllegalArgumentException"); | 518 Expect.fail("x >> -1 should throw ArgumentError"); |
| 519 } on IllegalArgumentException catch (e) { | 519 } on ArgumentError catch (e) { |
| 520 } | 520 } |
| 521 | 521 |
| 522 try { | 522 try { |
| 523 new int64.fromInt(17) << -1; | 523 new int64.fromInt(17) << -1; |
| 524 Expect.fail("x >> -1 should throw IllegalArgumentException"); | 524 Expect.fail("x >> -1 should throw ArgumentError"); |
| 525 } on IllegalArgumentException catch (e) { | 525 } on ArgumentError catch (e) { |
| 526 } | 526 } |
| 527 | 527 |
| 528 try { | 528 try { |
| 529 new int64.fromInt(17).shiftRightUnsigned(-1); | 529 new int64.fromInt(17).shiftRightUnsigned(-1); |
| 530 Expect.fail("x >> -1 should throw IllegalArgumentException"); | 530 Expect.fail("x >> -1 should throw ArgumentError"); |
| 531 } on IllegalArgumentException catch (e) { | 531 } on ArgumentError catch (e) { |
| 532 } | 532 } |
| 533 | 533 |
| 534 } | 534 } |
| 535 | 535 |
| 536 void testToHexString() { | 536 void testToHexString() { |
| 537 int64 deadbeef12341234 = new int64.fromInts(0xDEADBEEF, 0x12341234); | 537 int64 deadbeef12341234 = new int64.fromInts(0xDEADBEEF, 0x12341234); |
| 538 Expect.equals("0", int64.ZERO.toHexString()); | 538 Expect.equals("0", int64.ZERO.toHexString()); |
| 539 Expect.equals("DEADBEEF12341234", deadbeef12341234.toHexString()); | 539 Expect.equals("DEADBEEF12341234", deadbeef12341234.toHexString()); |
| 540 } | 540 } |
| 541 | 541 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 Expect.equals("777777777777777777777", int64.MAX_VALUE.toRadixString(8)); | 597 Expect.equals("777777777777777777777", int64.MAX_VALUE.toRadixString(8)); |
| 598 Expect.equals("67404283172107811827", int64.MAX_VALUE.toRadixString(9)); | 598 Expect.equals("67404283172107811827", int64.MAX_VALUE.toRadixString(9)); |
| 599 Expect.equals("9223372036854775807", int64.MAX_VALUE.toRadixString(10)); | 599 Expect.equals("9223372036854775807", int64.MAX_VALUE.toRadixString(10)); |
| 600 Expect.equals("1728002635214590697", int64.MAX_VALUE.toRadixString(11)); | 600 Expect.equals("1728002635214590697", int64.MAX_VALUE.toRadixString(11)); |
| 601 Expect.equals("41A792678515120367", int64.MAX_VALUE.toRadixString(12)); | 601 Expect.equals("41A792678515120367", int64.MAX_VALUE.toRadixString(12)); |
| 602 Expect.equals("10B269549075433C37", int64.MAX_VALUE.toRadixString(13)); | 602 Expect.equals("10B269549075433C37", int64.MAX_VALUE.toRadixString(13)); |
| 603 Expect.equals("4340724C6C71DC7A7", int64.MAX_VALUE.toRadixString(14)); | 603 Expect.equals("4340724C6C71DC7A7", int64.MAX_VALUE.toRadixString(14)); |
| 604 Expect.equals("160E2AD3246366807", int64.MAX_VALUE.toRadixString(15)); | 604 Expect.equals("160E2AD3246366807", int64.MAX_VALUE.toRadixString(15)); |
| 605 Expect.equals("7FFFFFFFFFFFFFFF", int64.MAX_VALUE.toRadixString(16)); | 605 Expect.equals("7FFFFFFFFFFFFFFF", int64.MAX_VALUE.toRadixString(16)); |
| 606 } | 606 } |
| OLD | NEW |