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

Unified Diff: pkg/fixnum/test/int_64_test.dart

Issue 23441004: More efficient Int64 parsing and printing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« pkg/fixnum/lib/src/int64.dart ('K') | « pkg/fixnum/lib/src/int64.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/fixnum/test/int_64_test.dart
diff --git a/pkg/fixnum/test/int_64_test.dart b/pkg/fixnum/test/int_64_test.dart
index 545de3c53f2c49aace3fbe8842a144fd35f1ae58..e4e311d11d24150eb260f6b2d5ebe7f22f9b9de2 100644
--- a/pkg/fixnum/test/int_64_test.dart
+++ b/pkg/fixnum/test/int_64_test.dart
@@ -529,6 +529,19 @@ void main() {
expect(-(Int64.MIN_VALUE + new Int64.fromInt(1)), Int64.MAX_VALUE);
});
+ group("parse", () {
+ test("parseRadix10", () {
+ checkInt(int x) {
+ expect(Int64.parseRadix('$x', 10), new Int64.fromInt(x));
+ }
+ expect(Int64.parseRadix('1000', 10), new Int64.fromInt(1000));
+ checkInt(0);
+ checkInt(1);
+ checkInt(12345678);
+ checkInt(-12345678);
+ });
+ });
+
group("string representation", () {
test("toString", () {
expect(new Int64.fromInt(0).toString(), "0");
@@ -571,10 +584,10 @@ void main() {
expect(Int64.MIN_VALUE.toRadixString(9), "-67404283172107811828");
expect(Int64.MIN_VALUE.toRadixString(10), "-9223372036854775808");
expect(Int64.MIN_VALUE.toRadixString(11), "-1728002635214590698");
- expect(Int64.MIN_VALUE.toRadixString(12), "-41A792678515120368");
- expect(Int64.MIN_VALUE.toRadixString(13), "-10B269549075433C38");
- expect(Int64.MIN_VALUE.toRadixString(14), "-4340724C6C71DC7A8");
- expect(Int64.MIN_VALUE.toRadixString(15), "-160E2AD3246366808");
+ expect(Int64.MIN_VALUE.toRadixString(12), "-41a792678515120368");
+ expect(Int64.MIN_VALUE.toRadixString(13), "-10b269549075433c38");
+ expect(Int64.MIN_VALUE.toRadixString(14), "-4340724c6c71dc7a8");
+ expect(Int64.MIN_VALUE.toRadixString(15), "-160e2ad3246366808");
expect(Int64.MIN_VALUE.toRadixString(16), "-8000000000000000");
expect(Int64.MAX_VALUE.toRadixString(2),
"111111111111111111111111111111111111111111111111111111111111111");
@@ -589,11 +602,11 @@ void main() {
expect(Int64.MAX_VALUE.toRadixString(9), "67404283172107811827");
expect(Int64.MAX_VALUE.toRadixString(10), "9223372036854775807");
expect(Int64.MAX_VALUE.toRadixString(11), "1728002635214590697");
- expect(Int64.MAX_VALUE.toRadixString(12), "41A792678515120367");
- expect(Int64.MAX_VALUE.toRadixString(13), "10B269549075433C37");
- expect(Int64.MAX_VALUE.toRadixString(14), "4340724C6C71DC7A7");
- expect(Int64.MAX_VALUE.toRadixString(15), "160E2AD3246366807");
- expect(Int64.MAX_VALUE.toRadixString(16), "7FFFFFFFFFFFFFFF");
+ expect(Int64.MAX_VALUE.toRadixString(12), "41a792678515120367");
+ expect(Int64.MAX_VALUE.toRadixString(13), "10b269549075433c37");
+ expect(Int64.MAX_VALUE.toRadixString(14), "4340724c6c71dc7a7");
+ expect(Int64.MAX_VALUE.toRadixString(15), "160e2ad3246366807");
+ expect(Int64.MAX_VALUE.toRadixString(16), "7fffffffffffffff");
});
});
}
« pkg/fixnum/lib/src/int64.dart ('K') | « pkg/fixnum/lib/src/int64.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698