mirror of https://github.com/tc39/test262.git
tests for Math.f16round
This commit is contained in:
parent
c1d09be840
commit
435dcc9f6e
|
@ -113,6 +113,10 @@ set-methods
|
||||||
# https://github.com/tc39/proposal-explicit-resource-management
|
# https://github.com/tc39/proposal-explicit-resource-management
|
||||||
explicit-resource-management
|
explicit-resource-management
|
||||||
|
|
||||||
|
# Float16Array + Math.f16round
|
||||||
|
# https://github.com/tc39/proposal-float16array
|
||||||
|
Float16Array
|
||||||
|
|
||||||
## Standard language features
|
## Standard language features
|
||||||
#
|
#
|
||||||
# Language features that have been included in a published version of the
|
# Language features that have been included in a published version of the
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2024 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-math.f16round
|
||||||
|
description: >
|
||||||
|
Math.f16round.length is 1
|
||||||
|
features: [Float16Array]
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
verifyProperty(Math.f16round, 'length', {
|
||||||
|
value: 1,
|
||||||
|
enumerable: false,
|
||||||
|
writable: false,
|
||||||
|
configurable: true
|
||||||
|
});
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2024 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-math.f16round
|
||||||
|
description: >
|
||||||
|
Math.f16round.name is "f16round"
|
||||||
|
features: [Float16Array]
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
verifyProperty(Math.f16round, 'name', {
|
||||||
|
value: 'f16round',
|
||||||
|
enumerable: false,
|
||||||
|
writable: false,
|
||||||
|
configurable: true
|
||||||
|
});
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2024 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-ecmascript-standard-built-in-objects
|
||||||
|
description: >
|
||||||
|
Math.f16round does not implement [[Construct]], is not new-able
|
||||||
|
features: [Float16Array]
|
||||||
|
includes: [isConstructor.js]
|
||||||
|
features: [Reflect.construct]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert(!isConstructor(Math.f16round), "Math.f16round is not a constructor");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function () {
|
||||||
|
new Math.fround();
|
||||||
|
});
|
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright (C) 2024 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-math.f16round
|
||||||
|
description: >
|
||||||
|
"f16round" property of Math
|
||||||
|
features: [Float16Array]
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
verifyNotEnumerable(Math, "f16round");
|
||||||
|
verifyWritable(Math, "f16round");
|
||||||
|
verifyConfigurable(Math, "f16round");
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright (C) 2024 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-math.f16round
|
||||||
|
description: >
|
||||||
|
Convert to binary16 format and than to binary64 format
|
||||||
|
features: [Float16Array]
|
||||||
|
includes: [byteConversionValues.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var values = byteConversionValues.values;
|
||||||
|
var expectedValues = byteConversionValues.expected.Float16;
|
||||||
|
|
||||||
|
values.forEach(function(value, i) {
|
||||||
|
var expected = expectedValues[i];
|
||||||
|
|
||||||
|
var result = Math.f16round(value);
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
result,
|
||||||
|
expected,
|
||||||
|
"value: " + value
|
||||||
|
);
|
||||||
|
});
|
Loading…
Reference in New Issue