|
1 // Copyright 2011-2012 Norbert Lindenberg. All rights reserved. |
|
2 // Copyright 2012 Mozilla Corporation. All rights reserved. |
|
3 // This code is governed by the BSD license found in the LICENSE file. |
|
4 |
|
5 /** |
|
6 * @description Tests that the digits are determined correctly when specifying pre/post decimal digits. |
|
7 * @author Norbert Lindenberg |
|
8 */ |
|
9 |
|
10 $INCLUDE("testIntl.js"); |
|
11 |
|
12 var locales = [ |
|
13 new Intl.NumberFormat().resolvedOptions().locale, |
|
14 "ar", "de", "th", "ja" |
|
15 ]; |
|
16 var numberingSystems = [ |
|
17 "arab", |
|
18 "latn", |
|
19 "thai", |
|
20 "hanidec" |
|
21 ]; |
|
22 var testData = { |
|
23 "0": "000.0", |
|
24 "-0": "000.0", |
|
25 "123": "123.0", |
|
26 "-123": "-123.0", |
|
27 "12345": "12345.0", |
|
28 "-12345": "-12345.0", |
|
29 "123.45": "123.45", |
|
30 "-123.45": "-123.45", |
|
31 "123.444499": "123.444", |
|
32 "-123.444499": "-123.444", |
|
33 "123.444500": "123.445", |
|
34 "-123.444500": "-123.445", |
|
35 "123.44501": "123.445", |
|
36 "-123.44501": "-123.445", |
|
37 "0.001234": "000.001", |
|
38 "-0.001234": "-000.001", |
|
39 "0.00000000123": "000.0", |
|
40 "-0.00000000123": "-000.0", |
|
41 "0.00000000000000000000000000000123": "000.0", |
|
42 "-0.00000000000000000000000000000123": "-000.0", |
|
43 "1.2": "001.2", |
|
44 "-1.2": "-001.2", |
|
45 "0.0000000012344501": "000.0", |
|
46 "-0.0000000012344501": "-000.0", |
|
47 "123445.01": "123445.01", |
|
48 "-123445.01": "-123445.01", |
|
49 "12344501000000000000000000000000000": "12344501000000000000000000000000000.0", |
|
50 "-12344501000000000000000000000000000": "-12344501000000000000000000000000000.0" |
|
51 }; |
|
52 |
|
53 testNumberFormat(locales, numberingSystems, |
|
54 {useGrouping: false, minimumIntegerDigits: 3, minimumFractionDigits: 1, maximumFractionDigits: 3}, |
|
55 testData); |
|
56 |