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

Unified Diff: packages/charted/test.disabled/locale/number_format_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/charted/test.disabled/locale/number_format_test.dart
diff --git a/packages/charted/test.disabled/locale/number_format_test.dart b/packages/charted/test.disabled/locale/number_format_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cbaad9283c8299abeea16ec363d5e9d465e68595
--- /dev/null
+++ b/packages/charted/test.disabled/locale/number_format_test.dart
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014 Google Inc. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style
+ * license that can be found in the LICENSE file or at
+ * https://developers.google.com/open-source/licenses/bsd
+ */
+
+part of charted.test.locale;
+
+testNumberFormat() {
+ EnUsLocale locale = new EnUsLocale();
+ NumberFormat formatter = new NumberFormat(locale);
+
+ group('NumberFormat.format returns a format function that', () {
+ test('performs correctly with [[fill]align]', () {
+ FormatFunction format1 = formatter.format('d<6');
+ expect(format1(123), equals('123ddd'));
+ FormatFunction format2 = formatter.format('d>6');
+ expect(format2(123), equals('ddd123'));
+ FormatFunction format3 = formatter.format('d^6');
+ expect(format3(123), equals('dd123d'));
+ FormatFunction format4 = formatter.format('d=+6');
+ expect(format4(123), equals('+dd123'));
+ FormatFunction format5 = formatter.format('06');
+ expect(format5(123), equals('000123'));
+ });
+ test('performs correctly with [sign]', () {
+ FormatFunction format1 = formatter.format('+');
+ expect(format1(123), equals('+123'));
+ expect(format1(0), equals('+0'));
+ expect(format1(-123), equals('-123'));
+ FormatFunction format2 = formatter.format('-');
+ expect(format2(123), equals('-123'));
+ expect(format2(0), equals('-0'));
+ expect(format2(-123), equals('-123'));
+ FormatFunction format3 = formatter.format('');
+ expect(format3(123), equals('123'));
+ expect(format3(0), equals('0'));
+ expect(format3(-123), equals('-123'));
+ FormatFunction format4 = formatter.format(' ');
+ expect(format4(123), equals(' 123'));
+ expect(format4(0), equals(' 0'));
+ expect(format4(-123), equals('-123'));
+ });
+ test('performs correctly with [#]', () {
+ FormatFunction format1 = formatter.format('#b');
+ expect(format1(123), equals('0b1111011'));
+ FormatFunction format2 = formatter.format('#o');
+ expect(format2(123), equals('0o173'));
+ FormatFunction format3 = formatter.format('#x');
+ expect(format3(123), equals('0x7b'));
+ });
+ test('performs correctly with [,]', () {
+ FormatFunction format1 = formatter.format(',');
+ expect(format1(123), equals('123'));
+ expect(format1(12345), equals('12,345'));
+ });
+ test('performs correctly with [.precision]', () {
+ FormatFunction format1 = formatter.format('.2f');
+ expect(format1(123.4), equals('123.40'));
+ expect(format1(123.45), equals('123.45'));
+ expect(format1(123.4567), equals('123.46'));
+ });
+ test('performs correctly with other values of [type]', () {
+ FormatFunction format1 = formatter.format('d');
+ expect(format1(123), equals('123'));
+ FormatFunction format2 = formatter.format('e');
+ expect(format2(123), equals('1e+2'));
+ FormatFunction format4 = formatter.format('g');
+ expect(format4(123), equals('1e+2'));
+ FormatFunction format5 = formatter.format('c');
+ expect(format5(49), equals('1'));
+ });
+ });
+}
« no previous file with comments | « packages/charted/test.disabled/locale/locale_test.dart ('k') | packages/charted/test.disabled/locale/time_format_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698