Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: pkg/fixnum/test/int_64_test.dart

Issue 34223002: Throw FormatException when Int32/Int64.parseRadix() encounters bad digit (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Formatting fix Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/fixnum/test/int_32_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'package:fixnum/fixnum.dart'; 6 import 'package:fixnum/fixnum.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 8
9 void main() { 9 void main() {
10 group("is-tests", () { 10 group("is-tests", () {
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 checkInt(12345678); 651 checkInt(12345678);
652 checkInt(-12345678); 652 checkInt(-12345678);
653 checkInt(2147483647); 653 checkInt(2147483647);
654 checkInt(2147483648); 654 checkInt(2147483648);
655 checkInt(-2147483647); 655 checkInt(-2147483647);
656 checkInt(-2147483648); 656 checkInt(-2147483648);
657 checkInt(4294967295); 657 checkInt(4294967295);
658 checkInt(4294967296); 658 checkInt(4294967296);
659 checkInt(-4294967295); 659 checkInt(-4294967295);
660 checkInt(-4294967296); 660 checkInt(-4294967296);
661 expect(() => Int64.parseRadix('xyzzy', -1), throwsArgumentError);
662 expect(() => Int64.parseRadix('plugh', 10),
663 throwsA(new isInstanceOf<FormatException>()));
661 }); 664 });
662 665
663 test("parseRadix", () { 666 test("parseRadix", () {
664 check(String s, int r, String x) { 667 check(String s, int r, String x) {
665 expect(Int64.parseRadix(s, r).toString(), x); 668 expect(Int64.parseRadix(s, r).toString(), x);
666 } 669 }
667 check('ghoul', 36, '27699213'); 670 check('ghoul', 36, '27699213');
668 check('ghoul', 35, '24769346'); 671 check('ghoul', 35, '24769346');
669 // Min and max value. 672 // Min and max value.
670 check("-9223372036854775808", 10, "-9223372036854775808"); 673 check("-9223372036854775808", 10, "-9223372036854775808");
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 expect(Int64.MAX_VALUE.toRadixString(10), "9223372036854775807"); 745 expect(Int64.MAX_VALUE.toRadixString(10), "9223372036854775807");
743 expect(Int64.MAX_VALUE.toRadixString(11), "1728002635214590697"); 746 expect(Int64.MAX_VALUE.toRadixString(11), "1728002635214590697");
744 expect(Int64.MAX_VALUE.toRadixString(12), "41a792678515120367"); 747 expect(Int64.MAX_VALUE.toRadixString(12), "41a792678515120367");
745 expect(Int64.MAX_VALUE.toRadixString(13), "10b269549075433c37"); 748 expect(Int64.MAX_VALUE.toRadixString(13), "10b269549075433c37");
746 expect(Int64.MAX_VALUE.toRadixString(14), "4340724c6c71dc7a7"); 749 expect(Int64.MAX_VALUE.toRadixString(14), "4340724c6c71dc7a7");
747 expect(Int64.MAX_VALUE.toRadixString(15), "160e2ad3246366807"); 750 expect(Int64.MAX_VALUE.toRadixString(15), "160e2ad3246366807");
748 expect(Int64.MAX_VALUE.toRadixString(16), "7fffffffffffffff"); 751 expect(Int64.MAX_VALUE.toRadixString(16), "7fffffffffffffff");
749 }); 752 });
750 }); 753 });
751 } 754 }
OLDNEW
« no previous file with comments | « pkg/fixnum/test/int_32_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698