Debian Codegraph @

js/src/tests/non262/Intl/PluralRules/rounding.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
2
3 // The rounding mode defaults to half-up for both NumberFormat and PluralRules.
4
5 var locale = "en";
6 var options = {maximumFractionDigits: 0};
7
8 assertEq(new Intl.NumberFormat(locale, options).format(0), "0");
9 assertEq(new Intl.NumberFormat(locale, options).format(0.5), "1");
10 assertEq(new Intl.NumberFormat(locale, options).format(1), "1");
11
12 assertEq(new Intl.PluralRules(locale, options).select(0), "other");
13 assertEq(new Intl.PluralRules(locale, options).select(0.5), "one");
14 assertEq(new Intl.PluralRules(locale, options).select(1), "one");
15
16 if (typeof reportCompare === "function")
17 reportCompare(0, 0, 'ok');