1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/intl402/ch11/11.3/11.3.2_TRP.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +// Copyright 2011-2012 Norbert Lindenberg. All rights reserved. 1.5 +// Copyright 2012 Mozilla Corporation. All rights reserved. 1.6 +// This code is governed by the BSD license found in the LICENSE file. 1.7 + 1.8 +/** 1.9 + * @description Tests that the digits are determined correctly when specifying significant digits. 1.10 + * @author Norbert Lindenberg 1.11 + */ 1.12 + 1.13 +$INCLUDE("testIntl.js"); 1.14 + 1.15 +var locales = [ 1.16 + new Intl.NumberFormat().resolvedOptions().locale, 1.17 + "ar", "de", "th", "ja" 1.18 +]; 1.19 +var numberingSystems = [ 1.20 + "arab", 1.21 + "latn", 1.22 + "thai", 1.23 + "hanidec" 1.24 +]; 1.25 +var testData = { 1.26 + "0": "0.00", 1.27 + "-0": "0.00", 1.28 + "123": "123", 1.29 + "-123": "-123", 1.30 + "12345": "12345", 1.31 + "-12345": "-12345", 1.32 + "123.45": "123.45", 1.33 + "-123.45": "-123.45", 1.34 + "123.44499": "123.44", 1.35 + "-123.44499": "-123.44", 1.36 + "123.44500": "123.45", 1.37 + "-123.44500": "-123.45", 1.38 + "123.44501": "123.45", 1.39 + "-123.44501": "-123.45", 1.40 + "0.001234": "0.001234", 1.41 + "-0.001234": "-0.001234", 1.42 + "0.00000000123": "0.00000000123", 1.43 + "-0.00000000123": "-0.00000000123", 1.44 + "0.00000000000000000000000000000123": "0.00000000000000000000000000000123", 1.45 + "-0.00000000000000000000000000000123": "-0.00000000000000000000000000000123", 1.46 + "1.2": "1.20", 1.47 + "-1.2": "-1.20", 1.48 + "0.0000000012344501": "0.0000000012345", 1.49 + "-0.0000000012344501": "-0.0000000012345", 1.50 + "123445.01": "123450", 1.51 + "-123445.01": "-123450", 1.52 + "12344501000000000000000000000000000": "12345000000000000000000000000000000", 1.53 + "-12344501000000000000000000000000000": "-12345000000000000000000000000000000" 1.54 +}; 1.55 + 1.56 +testNumberFormat(locales, numberingSystems, 1.57 + {useGrouping: false, minimumSignificantDigits: 3, maximumSignificantDigits: 5}, 1.58 + testData); 1.59 +