tests for Math.f16round

This commit is contained in:
Kevin Gibbons 2024-03-12 11:34:59 -07:00 committed by Philip Chimento
parent c1d09be840
commit 435dcc9f6e
6 changed files with 94 additions and 0 deletions

View File

@ -113,6 +113,10 @@ set-methods
# https://github.com/tc39/proposal-explicit-resource-management
explicit-resource-management
# Float16Array + Math.f16round
# https://github.com/tc39/proposal-float16array
Float16Array
## Standard language features
#
# Language features that have been included in a published version of the

View File

@ -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
});

View File

@ -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
});

View File

@ -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();
});

View File

@ -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");

View File

@ -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
);
});