Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright 2011-2012 Norbert Lindenberg. All rights reserved. |
michael@0 | 2 | // Copyright 2012 Mozilla Corporation. All rights reserved. |
michael@0 | 3 | // This code is governed by the BSD license found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | /** |
michael@0 | 6 | * @description Tests that the digits are determined correctly when specifying significant digits. |
michael@0 | 7 | * @author Norbert Lindenberg |
michael@0 | 8 | */ |
michael@0 | 9 | |
michael@0 | 10 | $INCLUDE("testIntl.js"); |
michael@0 | 11 | |
michael@0 | 12 | var locales = [ |
michael@0 | 13 | new Intl.NumberFormat().resolvedOptions().locale, |
michael@0 | 14 | "ar", "de", "th", "ja" |
michael@0 | 15 | ]; |
michael@0 | 16 | var numberingSystems = [ |
michael@0 | 17 | "arab", |
michael@0 | 18 | "latn", |
michael@0 | 19 | "thai", |
michael@0 | 20 | "hanidec" |
michael@0 | 21 | ]; |
michael@0 | 22 | var testData = { |
michael@0 | 23 | "0": "0.00", |
michael@0 | 24 | "-0": "0.00", |
michael@0 | 25 | "123": "123", |
michael@0 | 26 | "-123": "-123", |
michael@0 | 27 | "12345": "12345", |
michael@0 | 28 | "-12345": "-12345", |
michael@0 | 29 | "123.45": "123.45", |
michael@0 | 30 | "-123.45": "-123.45", |
michael@0 | 31 | "123.44499": "123.44", |
michael@0 | 32 | "-123.44499": "-123.44", |
michael@0 | 33 | "123.44500": "123.45", |
michael@0 | 34 | "-123.44500": "-123.45", |
michael@0 | 35 | "123.44501": "123.45", |
michael@0 | 36 | "-123.44501": "-123.45", |
michael@0 | 37 | "0.001234": "0.001234", |
michael@0 | 38 | "-0.001234": "-0.001234", |
michael@0 | 39 | "0.00000000123": "0.00000000123", |
michael@0 | 40 | "-0.00000000123": "-0.00000000123", |
michael@0 | 41 | "0.00000000000000000000000000000123": "0.00000000000000000000000000000123", |
michael@0 | 42 | "-0.00000000000000000000000000000123": "-0.00000000000000000000000000000123", |
michael@0 | 43 | "1.2": "1.20", |
michael@0 | 44 | "-1.2": "-1.20", |
michael@0 | 45 | "0.0000000012344501": "0.0000000012345", |
michael@0 | 46 | "-0.0000000012344501": "-0.0000000012345", |
michael@0 | 47 | "123445.01": "123450", |
michael@0 | 48 | "-123445.01": "-123450", |
michael@0 | 49 | "12344501000000000000000000000000000": "12345000000000000000000000000000000", |
michael@0 | 50 | "-12344501000000000000000000000000000": "-12345000000000000000000000000000000" |
michael@0 | 51 | }; |
michael@0 | 52 | |
michael@0 | 53 | testNumberFormat(locales, numberingSystems, |
michael@0 | 54 | {useGrouping: false, minimumSignificantDigits: 3, maximumSignificantDigits: 5}, |
michael@0 | 55 | testData); |
michael@0 | 56 |