OLD | NEW |
(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): ["USD12,345.00", "1,234,500%"], |
| 13 new Int64(0x7FFFFFFFFFFFF): [ |
| 14 "USD2,251,799,813,685,247.00", |
| 15 "225,179,981,368,524,700%" |
| 16 ], |
| 17 Int64.parseHex('7FFFFFFFFFFFFFF'): [ |
| 18 "USD576,460,752,303,423,487.00", |
| 19 "57,646,075,230,342,348,700%" |
| 20 ], |
| 21 Int64.parseHex('8000000000000000'): [ |
| 22 "-USD9,223,372,036,854,775,808.00", |
| 23 "-922,337,203,685,477,580,800%" |
| 24 ] |
| 25 }; |
| 26 |
| 27 var int32Values = { |
| 28 new Int32(12345): ["USD12,345.00", "1,234,500%"], |
| 29 new Int32(0x7FFFF): ["USD524,287.00", "52,428,700%"], |
| 30 Int32.parseHex('7FFFFFF'): ["USD134,217,727.00", "13,421,772,700%"], |
| 31 Int32.parseHex('80000000'): ["-USD2,147,483,648.00", "-214,748,364,800%"] |
| 32 }; |
| 33 |
| 34 main() { |
| 35 test('int64', () { |
| 36 int64Values.forEach((number, expected) { |
| 37 var currency = new NumberFormat.currencyPattern().format(number); |
| 38 expect(currency, expected.first); |
| 39 var percent = new NumberFormat.percentPattern().format(number); |
| 40 expect(percent, expected[1]); |
| 41 }); |
| 42 }); |
| 43 |
| 44 test('int32', () { |
| 45 int32Values.forEach((number, expected) { |
| 46 var currency = new NumberFormat.currencyPattern().format(number); |
| 47 expect(currency, expected.first); |
| 48 var percent = new NumberFormat.percentPattern().format(number); |
| 49 expect(percent, expected[1]); |
| 50 }); |
| 51 }); |
| 52 } |
OLD | NEW |