blob: 1274a0daac770e613685c1ee65a6554461a43f71 [file] [log] [blame]
// Copyright 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-initializenumberformat
description: Rejects invalid values for roundingIncrement option.
features: [Intl.NumberFormat-v3]
---*/
assert.throws(RangeError, function() {
new Intl.NumberFormat([], {roundingIncrement: 0});
}, '0');
assert.throws(RangeError, function() {
new Intl.NumberFormat([], {roundingIncrement: 3});
}, '3');
assert.throws(RangeError, function() {
new Intl.NumberFormat([], {roundingIncrement: 4});
}, '4');
assert.throws(RangeError, function() {
new Intl.NumberFormat([], {roundingIncrement: 5000.1});
}, '5000.1');
assert.throws(RangeError, function() {
new Intl.NumberFormat([], {roundingIncrement: 5001});
}, '5001');
assert.throws(RangeError, function() {
new Intl.NumberFormat([], {roundingIncrement: 2, roundingPriority: 'morePrecision'});
}, '2, roundingType is "morePrecision"');
assert.throws(RangeError, function() {
new Intl.NumberFormat([], {roundingIncrement: 2, roundingPriority: 'lessPrecision'});
}, '2, roundingType is "lessPrecision"');
assert.throws(RangeError, function() {
new Intl.NumberFormat([], {roundingIncrement: 2, minimumSignificantDigits: 1});
}, '2, roundingType is "significantDigits"');