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

Unified Diff: packages/charted/test.disabled/format/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/format/format_test.dart
diff --git a/packages/charted/test.disabled/format/format_test.dart b/packages/charted/test.disabled/format/format_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2548fbc590b0a098deed428d9461ba89dedd2c1b
--- /dev/null
+++ b/packages/charted/test.disabled/format/format_test.dart
@@ -0,0 +1,49 @@
+/*
+ * 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
+ */
+
+library charted.test.format;
+
+import 'package:charted/core/utils.dart';
+import 'package:charted/locale/format.dart';
+import 'package:unittest/unittest.dart';
+
+formatTests() {
+ List mockValues = [
+ [0.0000000000000000000001, 'y', 100],
+ [0.000000000000000000231, 'z', 231],
+ [0.00000000000000004231, 'a', 42.31],
+ [0.0000000000000031, 'f', 3.1],
+ [0.0000000000675, 'p', 67.5],
+ [0.00000045, 'n', 450],
+ [0.0007532, 'ยต', 753.2],
+ [0.2234, 'm', 223.4],
+ [167.5, '', 167.5],
+ [334167.5, 'k', 334.1675],
+ [234555167.5, 'M', 234.5551675],
+ [565677879167.5, 'G', 565.6778791675],
+ [234324365676167.5, 'T', 234.3243656761675],
+ [6566786767957617.5, 'P', 6.566786767957618],
+ [234324235364564576575, 'E', 234.32423536456457],
+ [3454675678587685754647.5, 'Z', 3.4546756785876855],
+ [3453543264567867855446543545167.5, 'Y', 3453543.264567868],
+ ];
+
+ test('FormatPrefix computes right SI format prefix for a given value', () {
+ mockValues.forEach((d) {
+ FormatPrefix prefix = new FormatPrefix(d[0]);
+ expect(prefix.symbol, equals(d[1]));
+ expect(prefix.scale(d[0]), closeTo(d[2], EPSILON));
+ });
+ mockValues.forEach((d) {
+ FormatPrefix prefix = new FormatPrefix(d[0], 2);
+ expect(prefix.symbol, equals(d[1]));
+ expect(prefix.scale(-d[0]), closeTo(-d[2], EPSILON));
+ });
+ });
+
+}
« no previous file with comments | « packages/charted/test.disabled/event/timer_test.dart ('k') | packages/charted/test.disabled/interpolators/easing_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698