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

Unified Diff: packages/intl/test/fixnum_test.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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
Index: packages/intl/test/fixnum_test.dart
diff --git a/packages/intl/test/fixnum_test.dart b/packages/intl/test/fixnum_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..747a8bb0d2bd1351743399305847ce2ee20b5dfa
--- /dev/null
+++ b/packages/intl/test/fixnum_test.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library intl_test;
+
+import 'package:intl/intl.dart';
+import 'package:unittest/unittest.dart';
+import 'package:fixnum/fixnum.dart';
+
+var int64Values = {
+ new Int64(12345): ["USD12,345.00", "1,234,500%"],
+ new Int64(0x7FFFFFFFFFFFF): [
+ "USD2,251,799,813,685,247.00",
+ "225,179,981,368,524,700%"
+ ],
+ Int64.parseHex('7FFFFFFFFFFFFFF'): [
+ "USD576,460,752,303,423,487.00",
+ "57,646,075,230,342,348,700%"
+ ],
+ Int64.parseHex('8000000000000000'): [
+ "-USD9,223,372,036,854,775,808.00",
+ "-922,337,203,685,477,580,800%"
+ ]
+};
+
+var int32Values = {
+ new Int32(12345): ["USD12,345.00", "1,234,500%"],
+ new Int32(0x7FFFF): ["USD524,287.00", "52,428,700%"],
+ Int32.parseHex('7FFFFFF'): ["USD134,217,727.00", "13,421,772,700%"],
+ Int32.parseHex('80000000'): ["-USD2,147,483,648.00", "-214,748,364,800%"]
+};
+
+main() {
+ test('int64', () {
+ int64Values.forEach((number, expected) {
+ var currency = new NumberFormat.currencyPattern().format(number);
+ expect(currency, expected.first);
+ var percent = new NumberFormat.percentPattern().format(number);
+ expect(percent, expected[1]);
+ });
+ });
+
+ test('int32', () {
+ int32Values.forEach((number, expected) {
+ var currency = new NumberFormat.currencyPattern().format(number);
+ expect(currency, expected.first);
+ var percent = new NumberFormat.percentPattern().format(number);
+ expect(percent, expected[1]);
+ });
+ });
+}
« no previous file with comments | « packages/intl/test/find_default_locale_standalone_test.dart ('k') | packages/intl/test/intl_message_basic_example_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698