summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Math/tanh
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Math/tanh')
-rw-r--r--js/src/tests/test262/built-ins/Math/tanh/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Math/tanh/length.js27
-rw-r--r--js/src/tests/test262/built-ins/Math/tanh/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Math/tanh/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Math/tanh/prop-desc.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/tanh/shell.js24
-rw-r--r--js/src/tests/test262/built-ins/Math/tanh/tanh-specialVals.js20
7 files changed, 144 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Math/tanh/browser.js b/js/src/tests/test262/built-ins/Math/tanh/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/tanh/browser.js
diff --git a/js/src/tests/test262/built-ins/Math/tanh/length.js b/js/src/tests/test262/built-ins/Math/tanh/length.js
new file mode 100644
index 0000000000..7af2c89df5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/tanh/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.
+
+/*---
+description: length property of Math.tanh
+es6id: 20.2.2.34
+info: |
+ Math.tanh ( 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.tanh.length, 1);
+
+verifyNotEnumerable(Math.tanh, "length");
+verifyNotWritable(Math.tanh, "length");
+verifyConfigurable(Math.tanh, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/tanh/name.js b/js/src/tests/test262/built-ins/Math/tanh/name.js
new file mode 100644
index 0000000000..af77bcfae0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/tanh/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.34
+description: >
+ Math.tanh.name is "tanh".
+info: |
+ Math.tanh ( 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.tanh.name, "tanh");
+
+verifyNotEnumerable(Math.tanh, "name");
+verifyNotWritable(Math.tanh, "name");
+verifyConfigurable(Math.tanh, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/tanh/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/tanh/not-a-constructor.js
new file mode 100644
index 0000000000..7f4914d650
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/tanh/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.tanh 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.tanh), false, 'isConstructor(Math.tanh) must return false');
+
+assert.throws(TypeError, () => {
+ new Math.tanh();
+}, '`new Math.tanh()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/tanh/prop-desc.js b/js/src/tests/test262/built-ins/Math/tanh/prop-desc.js
new file mode 100644
index 0000000000..da5b65ed1f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/tanh/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.tanh
+includes: [propertyHelper.js]
+es6id: 20.2.2.34
+---*/
+
+verifyNotEnumerable(Math, "tanh");
+verifyWritable(Math, "tanh");
+verifyConfigurable(Math, "tanh");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/tanh/shell.js b/js/src/tests/test262/built-ins/Math/tanh/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/tanh/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;
+}
diff --git a/js/src/tests/test262/built-ins/Math/tanh/tanh-specialVals.js b/js/src/tests/test262/built-ins/Math/tanh/tanh-specialVals.js
new file mode 100644
index 0000000000..3145214035
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/tanh/tanh-specialVals.js
@@ -0,0 +1,20 @@
+// Copyright 2015 Microsoft Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+description: Math.tanh with special values
+es6id: 20.2.2.34
+---*/
+
+assert.sameValue(Math.tanh(NaN), Number.NaN,
+ "Math.tanh produces incorrect output for NaN");
+assert.sameValue(Math.tanh(Number.NEGATIVE_INFINITY), -1,
+ "Math.tanh should produce -1 for Number.NEGATIVE_INFINITY");
+assert.sameValue(Math.tanh(Number.POSITIVE_INFINITY), 1,
+ "Math.tanh should produce 1 for Number.POSITIVE_INFINITY");
+assert.sameValue(1 / Math.tanh(-0), Number.NEGATIVE_INFINITY,
+ "Math.tanh should produce -0 for -0");
+assert.sameValue(1 / Math.tanh(0), Number.POSITIVE_INFINITY,
+ "Math.tanh should produce +0 for +0");
+
+reportCompare(0, 0);