aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite/intl402/ch11/11.3/11.3.2_TRF.js
blob: 32ee5cd9aab4066f520ce4132941cde617ed913a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2011-2012 Norbert Lindenberg. All rights reserved.
// Copyright 2012 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * @description Tests that the digits are determined correctly when specifying pre/post decimal digits.
 * @author Norbert Lindenberg
 */

$INCLUDE("testIntl.js");

var locales = [
    new Intl.NumberFormat().resolvedOptions().locale,
    "ar", "de", "th", "ja"
];
var numberingSystems = [
    "arab",
    "latn",
    "thai",
    "hanidec"
];
var testData = {
    "0": "000.0",
    "-0": "000.0",
    "123": "123.0",
    "-123": "-123.0",
    "12345": "12345.0",
    "-12345": "-12345.0",
    "123.45": "123.45",
    "-123.45": "-123.45",
    "123.44501": "123.445",
    "-123.44501": "-123.445",
    "0.001234": "000.001",
    "-0.001234": "-000.001",
    "0.00000000123": "000.0",
    "-0.00000000123": "-000.0",
    "0.00000000000000000000000000000123": "000.0",
    "-0.00000000000000000000000000000123": "-000.0",
    "1.2": "001.2",
    "-1.2": "-001.2",
    "0.0000000012344501": "000.0",
    "-0.0000000012344501": "-000.0",
    "123445.01": "123445.01",
    "-123445.01": "-123445.01",
    "12344501000000000000000000000000000": "12344501000000000000000000000000000.0",
    "-12344501000000000000000000000000000": "-12344501000000000000000000000000000.0"
};

testNumberFormat(locales, numberingSystems,
    {useGrouping: false, minimumIntegerDigits: 3, minimumFractionDigits: 1, maximumFractionDigits: 3},
    testData);