Chromium Code Reviews| 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 // Testing Bigints. | 4 // Testing Bigints. |
| 5 | 5 |
| 6 library big_integer_test; | 6 library big_integer_test; |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 | 8 |
| 9 foo() => 1234567890123456789; | 9 foo() => 1234567890123456789; |
| 10 bar() => 12345678901234567890; | 10 bar() => 12345678901234567890; |
| (...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1625 "0x1234567890123456789012345678901234567890123456789012345678901234567890" | 1625 "0x1234567890123456789012345678901234567890123456789012345678901234567890" |
| 1626 "123456789012345678901234567890123456789012345678901234567890123456789012" | 1626 "123456789012345678901234567890123456789012345678901234567890123456789012" |
| 1627 "345678901234567890123456789012345678901234567890123456789012345678901234" | 1627 "345678901234567890123456789012345678901234567890123456789012345678901234" |
| 1628 "567890123456789012345678901234567890123456789012345678901234567890123456" | 1628 "567890123456789012345678901234567890123456789012345678901234567890123456" |
| 1629 "789012345678901234567890123456789012345678901234567890123456789012345678" | 1629 "789012345678901234567890123456789012345678901234567890123456789012345678" |
| 1630 "90123456789012345678901234567890", | 1630 "90123456789012345678901234567890", |
| 1631 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF" | 1631 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF" |
| 1632 "01234567890ABCDEE"); | 1632 "01234567890ABCDEE"); |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 main() { | 1635 main() { |
|
Ivan Posva
2014/10/06 07:25:29
We should split this large test into sub pieces to
regis
2014/10/06 09:57:51
Done.
| |
| 1636 Expect.equals(1234567890123456789, foo()); | 1636 Expect.equals(1234567890123456789, foo()); |
| 1637 Expect.equals(12345678901234567890, bar()); | 1637 Expect.equals(12345678901234567890, bar()); |
| 1638 testSmiOverflow(); | 1638 testSmiOverflow(); |
| 1639 testBigintAdd(); | 1639 testBigintAdd(); |
| 1640 testBigintSub(); | 1640 testBigintSub(); |
| 1641 testBigintMul(); | 1641 testBigintMul(); |
| 1642 testBigintHugeMul(); | 1642 testBigintHugeMul(); |
| 1643 testBigintModulo(); | 1643 testBigintModulo(); |
| 1644 testBigintTruncDiv(); | 1644 testBigintTruncDiv(); |
| 1645 testBigintDiv(); | 1645 testBigintDiv(); |
| 1646 testBigintNegate(); | 1646 testBigintNegate(); |
| 1647 testShiftAmount(); | 1647 testShiftAmount(); |
| 1648 testBigintAddSub(); | 1648 testBigintAddSub(); |
| 1649 testBigintLeftShift(); | 1649 testBigintLeftShift(); |
| 1650 testBigintRightShift(); | 1650 testBigintRightShift(); |
| 1651 testBigintBitAnd(); | 1651 testBigintBitAnd(); |
| 1652 testBigintBitOr(); | 1652 testBigintBitOr(); |
| 1653 testBigintBitXor(); | 1653 testBigintBitXor(); |
| 1654 testBigintBitNot(); | 1654 testBigintBitNot(); |
| 1655 testBigintMultiplyDivide(); | 1655 testBigintMultiplyDivide(); |
| 1656 testBigintDivideRemainder(); | 1656 testBigintDivideRemainder(); |
| 1657 Expect.equals(12345678901234567890, (12345678901234567890).abs()); | 1657 Expect.equals(12345678901234567890, (12345678901234567890).abs()); |
| 1658 Expect.equals(12345678901234567890, (-12345678901234567890).abs()); | 1658 Expect.equals(12345678901234567890, (-12345678901234567890).abs()); |
| 1659 var a = 10000000000000000000; | 1659 var a = 10000000000000000000; |
| 1660 var b = 10000000000000000001; | 1660 var b = 10000000000000000001; |
| 1661 Expect.equals(false, a.hashCode == b.hashCode); | 1661 Expect.equals(false, a.hashCode == b.hashCode); |
| 1662 Expect.equals(true, a.hashCode == (b - 1).hashCode); | 1662 Expect.equals(true, a.hashCode == (b - 1).hashCode); |
| 1663 // TODO(regis): Add a test for modPow once it is public. | |
| 1663 } | 1664 } |
| OLD | NEW |