summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/NumberFormat/prototype/resolvedOptions/roundingMode.js
blob: 10ab976f1cacd7fa15c3fc557ecbd8f0422ca70f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2021 the V8 project authors. All rights reserved.
// Copyright 2021 Apple Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.numberformat.prototype.resolvedoptions
description: roundingMode property for the object returned by resolvedOptions()
features: [Intl.NumberFormat-v3]
---*/

var options;

options = new Intl.NumberFormat([], {}).resolvedOptions();
assert.sameValue(options.roundingMode, 'halfExpand', 'default');

options = new Intl.NumberFormat([], {roundingMode: 'ceil'}).resolvedOptions();
assert.sameValue(options.roundingMode, 'ceil');

options = new Intl.NumberFormat([], {roundingMode: 'floor'}).resolvedOptions();
assert.sameValue(options.roundingMode, 'floor');

options = new Intl.NumberFormat([], {roundingMode: 'expand'}).resolvedOptions();
assert.sameValue(options.roundingMode, 'expand');

options = new Intl.NumberFormat([], {roundingMode: 'trunc'}).resolvedOptions();
assert.sameValue(options.roundingMode, 'trunc');

options = new Intl.NumberFormat([], {roundingMode: 'halfCeil'}).resolvedOptions();
assert.sameValue(options.roundingMode, 'halfCeil');

options = new Intl.NumberFormat([], {roundingMode: 'halfFloor'}).resolvedOptions();
assert.sameValue(options.roundingMode, 'halfFloor');

options = new Intl.NumberFormat([], {roundingMode: 'halfExpand'}).resolvedOptions();
assert.sameValue(options.roundingMode, 'halfExpand');

options = new Intl.NumberFormat([], {roundingMode: 'halfTrunc'}).resolvedOptions();
assert.sameValue(options.roundingMode, 'halfTrunc');

options = new Intl.NumberFormat([], {roundingMode: 'halfEven'}).resolvedOptions();
assert.sameValue(options.roundingMode, 'halfEven');

reportCompare(0, 0);