diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/built-ins/Math/cosh | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Math/cosh')
7 files changed, 137 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Math/cosh/browser.js b/js/src/tests/test262/built-ins/Math/cosh/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/browser.js diff --git a/js/src/tests/test262/built-ins/Math/cosh/cosh-specialVals.js b/js/src/tests/test262/built-ins/Math/cosh/cosh-specialVals.js new file mode 100644 index 0000000000..1c78047259 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/cosh-specialVals.js @@ -0,0 +1,18 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.cosh with special values +es6id: 20.2.2.13 +---*/ + +assert.sameValue(Math.cosh(NaN), Number.NaN, + "Math.cosh produces incorrect output for NaN"); +assert.sameValue(Math.cosh(0), 1, "Math.cosh should produce 1 for input = 0"); +assert.sameValue(Math.cosh(-0), 1, "Math.cosh should produce 1 for input = -0"); +assert.sameValue(Math.cosh(Number.NEGATIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.cosh should produce Number.POSITIVE_INFINITY for Number.NEGATIVE_INFINITY"); +assert.sameValue(Math.cosh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.cosh should produce Number.POSITIVE_INFINITY for Number.POSITIVE_INFINITY"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/length.js b/js/src/tests/test262/built-ins/Math/cosh/length.js new file mode 100644 index 0000000000..6c64935887 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/length.js @@ -0,0 +1,27 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es6id: 20.2.2.13 +description: Length property of Math.cosh is 1 +info: | + Math.cosh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.cosh.length, 1); + +verifyNotEnumerable(Math.cosh, "length"); +verifyNotWritable(Math.cosh, "length"); +verifyConfigurable(Math.cosh, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/name.js b/js/src/tests/test262/built-ins/Math/cosh/name.js new file mode 100644 index 0000000000..161ed02e3a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.13 +description: > + Math.cosh.name is "cosh". +info: | + Math.cosh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.cosh.name, "cosh"); + +verifyNotEnumerable(Math.cosh, "name"); +verifyNotWritable(Math.cosh, "name"); +verifyConfigurable(Math.cosh, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/cosh/not-a-constructor.js new file mode 100644 index 0000000000..8cda77d866 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. 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.cosh does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.cosh), false, 'isConstructor(Math.cosh) must return false'); + +assert.throws(TypeError, () => { + new Math.cosh(); +}, '`new Math.cosh()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/prop-desc.js b/js/src/tests/test262/built-ins/Math/cosh/prop-desc.js new file mode 100644 index 0000000000..babc6f8380 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.cosh +includes: [propertyHelper.js] +es6id: 20.2.2.13 +---*/ + +verifyNotEnumerable(Math, "cosh"); +verifyWritable(Math, "cosh"); +verifyConfigurable(Math, "cosh"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/shell.js b/js/src/tests/test262/built-ins/Math/cosh/shell.js new file mode 100644 index 0000000000..54371b7789 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/shell.js @@ -0,0 +1,19 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +---*/ + +function isConstructor(f) { + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} |