summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Math/expm1
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Math/expm1')
-rw-r--r--js/src/tests/test262/built-ins/Math/expm1/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Math/expm1/expm1-specialVals.js20
-rw-r--r--js/src/tests/test262/built-ins/Math/expm1/length.js30
-rw-r--r--js/src/tests/test262/built-ins/Math/expm1/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Math/expm1/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Math/expm1/prop-desc.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/expm1/shell.js24
7 files changed, 147 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Math/expm1/browser.js b/js/src/tests/test262/built-ins/Math/expm1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/expm1/browser.js
diff --git a/js/src/tests/test262/built-ins/Math/expm1/expm1-specialVals.js b/js/src/tests/test262/built-ins/Math/expm1/expm1-specialVals.js
new file mode 100644
index 0000000000..10c9329a59
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/expm1/expm1-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.expm1 with sample values.
+es6id: 20.2.2.15
+---*/
+
+assert.sameValue(Math.expm1(NaN), Number.NaN,
+ "Math.expm1 produces incorrect output for NaN");
+assert.sameValue(Math.expm1(Number.NEGATIVE_INFINITY), -1,
+ "Math.expm1 should produce -1 for Number.NEGATIVE_INFINITY");
+assert.sameValue(Math.expm1(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
+ "Math.expm1 should produce POSITIVE infinity for Number.POSITIVE_INFINITY");
+assert.sameValue(1 / Math.expm1(-0), Number.NEGATIVE_INFINITY,
+ "Math.expm1 should produce -0 for -0");
+assert.sameValue(1 / Math.expm1(0), Number.POSITIVE_INFINITY,
+ "Math.expm1 should produce +0 for +0");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/expm1/length.js b/js/src/tests/test262/built-ins/Math/expm1/length.js
new file mode 100644
index 0000000000..ead3c57638
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/expm1/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.expm1
+es6id: 20.2.2.15
+info: |
+ Math.expm1 ( 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.expm1.length, 1);
+
+verifyNotEnumerable(Math.expm1, "length");
+verifyNotWritable(Math.expm1, "length");
+verifyConfigurable(Math.expm1, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/expm1/name.js b/js/src/tests/test262/built-ins/Math/expm1/name.js
new file mode 100644
index 0000000000..698bdc19c0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/expm1/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.15
+description: >
+ Math.expm1.name is "expm1".
+info: |
+ Math.expm1 ( 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.expm1.name, "expm1");
+
+verifyNotEnumerable(Math.expm1, "name");
+verifyNotWritable(Math.expm1, "name");
+verifyConfigurable(Math.expm1, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/expm1/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/expm1/not-a-constructor.js
new file mode 100644
index 0000000000..d0b9a18935
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/expm1/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.expm1 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.expm1), false, 'isConstructor(Math.expm1) must return false');
+
+assert.throws(TypeError, () => {
+ new Math.expm1();
+}, '`new Math.expm1()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/expm1/prop-desc.js b/js/src/tests/test262/built-ins/Math/expm1/prop-desc.js
new file mode 100644
index 0000000000..cf0a3bd6b3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/expm1/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.expm1
+includes: [propertyHelper.js]
+es6id: 20.2.2.15
+---*/
+
+verifyNotEnumerable(Math, "expm1");
+verifyWritable(Math, "expm1");
+verifyConfigurable(Math, "expm1");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/expm1/shell.js b/js/src/tests/test262/built-ins/Math/expm1/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/expm1/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;
+}