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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style
5 * license that can be found in the LICENSE file or at
6 * https://developers.google.com/open-source/licenses/bsd
7 */
8
9 library charted.test.format;
10
11 import 'package:charted/core/utils.dart';
12 import 'package:charted/locale/format.dart';
13 import 'package:unittest/unittest.dart';
14
15 formatTests() {
16 List mockValues = [
17 [0.0000000000000000000001, 'y', 100],
18 [0.000000000000000000231, 'z', 231],
19 [0.00000000000000004231, 'a', 42.31],
20 [0.0000000000000031, 'f', 3.1],
21 [0.0000000000675, 'p', 67.5],
22 [0.00000045, 'n', 450],
23 [0.0007532, 'ยต', 753.2],
24 [0.2234, 'm', 223.4],
25 [167.5, '', 167.5],
26 [334167.5, 'k', 334.1675],
27 [234555167.5, 'M', 234.5551675],
28 [565677879167.5, 'G', 565.6778791675],
29 [234324365676167.5, 'T', 234.3243656761675],
30 [6566786767957617.5, 'P', 6.566786767957618],
31 [234324235364564576575, 'E', 234.32423536456457],
32 [3454675678587685754647.5, 'Z', 3.4546756785876855],
33 [3453543264567867855446543545167.5, 'Y', 3453543.264567868],
34 ];
35
36 test('FormatPrefix computes right SI format prefix for a given value', () {
37 mockValues.forEach((d) {
38 FormatPrefix prefix = new FormatPrefix(d[0]);
39 expect(prefix.symbol, equals(d[1]));
40 expect(prefix.scale(d[0]), closeTo(d[2], EPSILON));
41 });
42 mockValues.forEach((d) {
43 FormatPrefix prefix = new FormatPrefix(d[0], 2);
44 expect(prefix.symbol, equals(d[1]));
45 expect(prefix.scale(-d[0]), closeTo(-d[2], EPSILON));
46 });
47 });
48
49 }
OLDNEW
« 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