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

Unified Diff: pkg/i18n/test/number_format_test.dart

Issue 10834318: First iteration on number formatting (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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/i18n/number_format.dart ('K') | « pkg/i18n/number_symbols_data.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/i18n/test/number_format_test.dart
===================================================================
--- pkg/i18n/test/number_format_test.dart (revision 0)
+++ pkg/i18n/test/number_format_test.dart (revision 0)
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2012, 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.
+ */
+
+#import('../../../pkg/unittest/unittest.dart');
+#import('../number_format.dart');
+#import('../intl.dart');
+
+/**
+ * Tests the Numeric formatting library in dart.
+ */
+var testNumbers = const {
+ "0.001": 0.001,
+ "0.01": 0.01,
+ "0.1": 0.1,
+ "1": 1,
+ "2": 2.0,
+ "10": 10,
+ "100": 100,
+ "1,000": 1000,
+ "2,000,000,000,000": 2000000000000,
+ "10,000,000,000,000,000,000,000,000,000,000":
+ 10000000000000000000000000000000,
+ "0.123": 0.123,
+ "1,234": 1234.0,
+ "1.234": 1.234,
+ "1.23": 1.230,
+ "NaN": 0/0,
+ "∞": 1/0,
+ "-∞": -1/0};
+
+main() {
+ test('Basic number printing', () {
+ var number = new NumberFormat();
+ expect(number.format(3.14),"3.14");
+ });
+
+ test('Simple set of numbers', () {
+ var number = new NumberFormat();
+ for (var x in testNumbers.getKeys()) {
+ var formatted = number.format(testNumbers[x]);
+ expect(formatted, x);
+ }
+ });
+}
« pkg/i18n/number_format.dart ('K') | « pkg/i18n/number_symbols_data.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698