summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Math/atanh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/Math/atanh
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Math/atanh')
-rw-r--r--js/src/tests/test262/built-ins/Math/atanh/atanh-specialVals.js33
-rw-r--r--js/src/tests/test262/built-ins/Math/atanh/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Math/atanh/length.js30
-rw-r--r--js/src/tests/test262/built-ins/Math/atanh/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Math/atanh/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Math/atanh/prop-desc.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/atanh/shell.js24
7 files changed, 160 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Math/atanh/atanh-specialVals.js b/js/src/tests/test262/built-ins/Math/atanh/atanh-specialVals.js
new file mode 100644
index 0000000000..2dc767ff6c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/atanh/atanh-specialVals.js
@@ -0,0 +1,33 @@
+// Copyright 2015 Microsoft Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+description: Math.atanh with special values
+es6id: 20.2.2.7
+---*/
+
+assert.sameValue(Math.atanh(-1.9), Number.NaN,
+ "Math.atanh produces incorrect output for -1.9");
+assert.sameValue(Math.atanh(NaN), Number.NaN,
+ "Math.atanh produces incorrect output for NaN");
+assert.sameValue(Math.atanh(-10), Number.NaN,
+ "Math.atanh produces incorrect output for -10");
+assert.sameValue(Math.atanh(-Infinity), Number.NaN,
+ "Math.atanh produces incorrect output for -Infinity");
+assert.sameValue(Math.atanh(1.9), Number.NaN,
+ "Math.atanh produces incorrect output for 1.9");
+assert.sameValue(Math.atanh(10), Number.NaN,
+ "Math.atanh produces incorrect output for 10");
+assert.sameValue(Math.atanh(Number.POSITIVE_INFINITY), Number.NaN,
+ "Math.atanh produces incorrect output for Number.POSITIVE_INFINITY");
+
+assert.sameValue(Math.atanh(-1), Number.NEGATIVE_INFINITY,
+ "Math.atanh should produce negative infinity for -1");
+assert.sameValue(Math.atanh(+1), Number.POSITIVE_INFINITY,
+ "Math.atanh should produce positive infinity for +1");
+assert.sameValue(1 / Math.atanh(-0), Number.NEGATIVE_INFINITY,
+ "Math.atanh should produce -0 for -0");
+assert.sameValue(1 / Math.atanh(0), Number.POSITIVE_INFINITY,
+ "Math.atanh should produce +0 for +0");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/atanh/browser.js b/js/src/tests/test262/built-ins/Math/atanh/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/atanh/browser.js
diff --git a/js/src/tests/test262/built-ins/Math/atanh/length.js b/js/src/tests/test262/built-ins/Math/atanh/length.js
new file mode 100644
index 0000000000..7836a19735
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/atanh/length.js
@@ -0,0 +1,30 @@
+// Copyright 2015 Microsoft Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+description: length property of Math.atanh
+es6id: 20.2.2.7
+info: |
+ Math.atanh ( x )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Math.atanh.length, 1);
+
+verifyNotEnumerable(Math.atanh, "length");
+verifyNotWritable(Math.atanh, "length");
+verifyConfigurable(Math.atanh, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/atanh/name.js b/js/src/tests/test262/built-ins/Math/atanh/name.js
new file mode 100644
index 0000000000..f62a0884df
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/atanh/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.7
+description: >
+ Math.atanh.name is "atanh".
+info: |
+ Math.atanh ( 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.atanh.name, "atanh");
+
+verifyNotEnumerable(Math.atanh, "name");
+verifyNotWritable(Math.atanh, "name");
+verifyConfigurable(Math.atanh, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/atanh/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/atanh/not-a-constructor.js
new file mode 100644
index 0000000000..1dd566de55
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/atanh/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.atanh 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.atanh), false, 'isConstructor(Math.atanh) must return false');
+
+assert.throws(TypeError, () => {
+ new Math.atanh();
+}, '`new Math.atanh()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/atanh/prop-desc.js b/js/src/tests/test262/built-ins/Math/atanh/prop-desc.js
new file mode 100644
index 0000000000..e9335830bf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/atanh/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.atanh
+includes: [propertyHelper.js]
+es6id: 20.2.2.7
+---*/
+
+verifyNotEnumerable(Math, "atanh");
+verifyWritable(Math, "atanh");
+verifyConfigurable(Math, "atanh");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/atanh/shell.js b/js/src/tests/test262/built-ins/Math/atanh/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/atanh/shell.js
@@ -0,0 +1,24 @@
+// 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]
+features: [Reflect.construct]
+---*/
+
+function isConstructor(f) {
+ if (typeof f !== "function") {
+ throw new Test262Error("isConstructor invoked with a non-function value");
+ }
+
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}