michael@0: // Copyright 2011-2012 Norbert Lindenberg. All rights reserved. michael@0: // Copyright 2012 Mozilla Corporation. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * @description Tests that the digits are determined correctly when specifying significant digits. michael@0: * @author Norbert Lindenberg michael@0: */ michael@0: michael@0: $INCLUDE("testIntl.js"); michael@0: michael@0: var locales = [ michael@0: new Intl.NumberFormat().resolvedOptions().locale, michael@0: "ar", "de", "th", "ja" michael@0: ]; michael@0: var numberingSystems = [ michael@0: "arab", michael@0: "latn", michael@0: "thai", michael@0: "hanidec" michael@0: ]; michael@0: var testData = { michael@0: "0": "0.00", michael@0: "-0": "0.00", michael@0: "123": "123", michael@0: "-123": "-123", michael@0: "12345": "12345", michael@0: "-12345": "-12345", michael@0: "123.45": "123.45", michael@0: "-123.45": "-123.45", michael@0: "123.44499": "123.44", michael@0: "-123.44499": "-123.44", michael@0: "123.44500": "123.45", michael@0: "-123.44500": "-123.45", michael@0: "123.44501": "123.45", michael@0: "-123.44501": "-123.45", michael@0: "0.001234": "0.001234", michael@0: "-0.001234": "-0.001234", michael@0: "0.00000000123": "0.00000000123", michael@0: "-0.00000000123": "-0.00000000123", michael@0: "0.00000000000000000000000000000123": "0.00000000000000000000000000000123", michael@0: "-0.00000000000000000000000000000123": "-0.00000000000000000000000000000123", michael@0: "1.2": "1.20", michael@0: "-1.2": "-1.20", michael@0: "0.0000000012344501": "0.0000000012345", michael@0: "-0.0000000012344501": "-0.0000000012345", michael@0: "123445.01": "123450", michael@0: "-123445.01": "-123450", michael@0: "12344501000000000000000000000000000": "12345000000000000000000000000000000", michael@0: "-12344501000000000000000000000000000": "-12345000000000000000000000000000000" michael@0: }; michael@0: michael@0: testNumberFormat(locales, numberingSystems, michael@0: {useGrouping: false, minimumSignificantDigits: 3, maximumSignificantDigits: 5}, michael@0: testData); michael@0: