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

Side by Side Diff: pkg/intl/test/fixnum_test.dart

Issue 778293002: Make number formatting in Intl able to work with Int64 or other types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Increment version, update CHANGELOG Created 6 years 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
« no previous file with comments | « pkg/intl/pubspec.yaml ('k') | pkg/intl/test/number_closure_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library intl_test;
6
7 import 'package:intl/intl.dart';
8 import 'package:unittest/unittest.dart';
9 import 'package:fixnum/fixnum.dart';
10
11 var int64Values = {
12 new Int64(12345) :
13 ["USD12,345.00", "1,234,500%"],
14 new Int64(0x7FFFFFFFFFFFF) :
15 ["USD2,251,799,813,685,247.00", "225,179,981,368,524,700%"],
16 Int64.parseHex('7FFFFFFFFFFFFFF') :
17 ["USD576,460,752,303,423,487.00", "57,646,075,230,342,348,700%"],
18 Int64.parseHex('8000000000000000') :
19 ["-USD9,223,372,036,854,775,808.00", "-922,337,203,685,477,580,800%"]
20 };
21
22 var int32Values = {
23 new Int32(12345) : ["USD12,345.00", "1,234,500%"],
24 new Int32(0x7FFFF) : ["USD524,287.00", "52,428,700%"],
25 Int32.parseHex('7FFFFFF') : ["USD134,217,727.00", "13,421,772,700%"],
26 Int32.parseHex('80000000') : ["-USD2,147,483,648.00", "-214,748,364,800%"]
27 };
28
29 main() {
30 test('int64', () {
31 int64Values.forEach((number, expected) {
32 var currency = new NumberFormat.currencyPattern().format(number);
33 expect(currency, expected.first);
34 var percent = new NumberFormat.percentPattern().format(number);
35 expect(percent, expected[1]);
36 });
37 });
38
39 test('int32', () {
40 int32Values.forEach((number, expected) {
41 var currency = new NumberFormat.currencyPattern().format(number);
42 expect(currency, expected.first);
43 var percent = new NumberFormat.percentPattern().format(number);
44 expect(percent, expected[1]);
45 });
46 });
47 }
OLDNEW
« no previous file with comments | « pkg/intl/pubspec.yaml ('k') | pkg/intl/test/number_closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698