| 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 main() { | 7 main() { |
| 8 // Test that we accept radix 2 to 36 and that we use lower-case | 8 // Test that we accept radix 2 to 36 and that we use lower-case |
| 9 // letters. | 9 // letters. |
| 10 var expected = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', | 10 var expected = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 0x20000000000000, | 36 0x20000000000000, |
| 37 0x20000000000002, | 37 0x20000000000002, |
| 38 0x1000000000000000, | 38 0x1000000000000000, |
| 39 0x1000000000000100, | 39 0x1000000000000100, |
| 40 0x2000000000000000, | 40 0x2000000000000000, |
| 41 0x2000000000000200, | 41 0x2000000000000200, |
| 42 0x8000000000000000, | 42 0x8000000000000000, |
| 43 0x8000000000000800, | 43 0x8000000000000800, |
| 44 0x10000000000000000, | 44 0x10000000000000000, |
| 45 0x10000000000001000, | 45 0x10000000000001000, |
| 46 0x100000000000010000, |
| 47 0x1000000000000100000, |
| 48 0x10000000000001000000, |
| 49 0x100000000000010000000, |
| 50 0x1000000000000100000000, |
| 51 0x10000000000001000000000, |
| 46 ]; | 52 ]; |
| 47 for (var bignum in bignums) { | 53 for (var bignum in bignums) { |
| 48 for (int radix = 2; radix <= 36; radix++) { | 54 for (int radix = 2; radix <= 36; radix++) { |
| 49 String digits = bignum.toRadixString(radix); | 55 String digits = bignum.toRadixString(radix); |
| 50 int result = int.parse(digits, radix: radix); | 56 int result = int.parse(digits, radix: radix); |
| 51 Expect.equals(bignum, result, "$bignum -> $digits/$radix"); | 57 Expect.equals(bignum, result, |
| 58 "${bignum.toRadixString(16)} -> $digits/$radix"); |
| 52 } | 59 } |
| 53 } | 60 } |
| 54 } | 61 } |
| OLD | NEW |