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

Side by Side Diff: third_party/pkg/angular/test/formatter/number_spec.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 library number_spec;
2
3 import '../_specs.dart';
4 import 'package:intl/intl.dart';
5
6 void main() {
7 describe('number', () {
8 var number;
9
10 beforeEach((FormatterMap map, Injector injector) {
11 number = injector.get(map[new Formatter(name: 'number')]);
12 });
13
14
15 it('should do basic formatter', () {
16 expect(number(0, 0)).toEqual('0');
17 expect(number(-999)).toEqual('-999');
18 expect(number(123)).toEqual('123');
19 expect(number(1234567)).toEqual('1,234,567');
20 expect(number(1234)).toEqual('1,234');
21 expect(number(1234.5678)).toEqual('1,234.568');
22 expect(number(double.NAN)).toEqual('');
23 expect(number("1234.5678")).toEqual('1,234.568');
24 expect(number(1/0)).toEqual("∞");
25 expect(number(1, 2)).toEqual("1.00");
26 expect(number(.1, 2)).toEqual("0.10");
27 expect(number(.01, 2)).toEqual("0.01");
28 expect(number(.001, 3)).toEqual("0.001");
29 expect(number(.0001, 3)).toEqual("0.000");
30 expect(number(9, 2)).toEqual("9.00");
31 expect(number(.9, 2)).toEqual("0.90");
32 expect(number(.99, 2)).toEqual("0.99");
33 expect(number(.999, 3)).toEqual("0.999");
34 expect(number(.9999, 3)).toEqual("1.000");
35 expect(number(1234.567, 0)).toEqual("1,235");
36 expect(number(1234.567, 1)).toEqual("1,234.6");
37 expect(number(1234.567, 2)).toEqual("1,234.57");
38 });
39
40 it('should formatter exponentially small numbers', () {
41 expect(number(1e-50, 0)).toEqual('0');
42 expect(number(1e-6, 6)).toEqual('0.000001');
43 expect(number(1e-7, 6)).toEqual('0.000000');
44
45 expect(number(-1e-50, 0)).toEqual('-0');
46 expect(number(-1e-6, 6)).toEqual('-0.000001');
47 expect(number(-1e-7, 6)).toEqual('-0.000000');
48 });
49
50 it('should accept various locales', () {
51 expect(Intl.withLocale('de', () => number(1234.567, 2))).toEqual('1.234,57 ');
52 });
53 });
54 }
OLDNEW
« no previous file with comments | « third_party/pkg/angular/test/formatter/lowercase_spec.dart ('k') | third_party/pkg/angular/test/formatter/order_by_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698