summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Math/cbrt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Math/cbrt
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Math/cbrt')
-rw-r--r--js/src/tests/test262/built-ins/Math/cbrt/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Math/cbrt/cbrt-specialValues.js20
-rw-r--r--js/src/tests/test262/built-ins/Math/cbrt/length.js30
-rw-r--r--js/src/tests/test262/built-ins/Math/cbrt/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Math/cbrt/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Math/cbrt/prop-desc.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/cbrt/shell.js24
7 files changed, 147 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Math/cbrt/browser.js b/js/src/tests/test262/built-ins/Math/cbrt/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/cbrt/browser.js
diff --git a/js/src/tests/test262/built-ins/Math/cbrt/cbrt-specialValues.js b/js/src/tests/test262/built-ins/Math/cbrt/cbrt-specialValues.js
new file mode 100644
index 0000000000..c31dc1a2a2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/cbrt/cbrt-specialValues.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.cbrt with special values
+es6id: 20.2.2.9
+---*/
+
+assert.sameValue(Math.cbrt(NaN), Number.NaN,
+ "Math.cbrt produces incorrect output for NaN");
+assert.sameValue(Math.cbrt(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY,
+ "Math.cbrt should produce negative infinity for Number.NEGATIVE_INFINITY");
+assert.sameValue(Math.cbrt(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
+ "Math.cbrt should produce positive infinity for Number.POSITIVE_INFINITY");
+assert.sameValue(1 / Math.cbrt(-0), Number.NEGATIVE_INFINITY,
+ "Math.cbrt should produce -0 for -0");
+assert.sameValue(1 / Math.cbrt(0), Number.POSITIVE_INFINITY,
+ "Math.cbrt should produce +0 for +0");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/cbrt/length.js b/js/src/tests/test262/built-ins/Math/cbrt/length.js
new file mode 100644
index 0000000000..254fc702d8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/cbrt/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.cbrt
+es6id: 20.2.2.9
+info: |
+ Math.cbrt ( 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.cbrt.length, 1);
+
+verifyNotEnumerable(Math.cbrt, "length");
+verifyNotWritable(Math.cbrt, "length");
+verifyConfigurable(Math.cbrt, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/cbrt/name.js b/js/src/tests/test262/built-ins/Math/cbrt/name.js
new file mode 100644
index 0000000000..d6262036b4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/cbrt/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.9
+description: >
+ Math.cbrt.name is "cbrt".
+info: |
+ Math.cbrt ( 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.cbrt.name, "cbrt");
+
+verifyNotEnumerable(Math.cbrt, "name");
+verifyNotWritable(Math.cbrt, "name");
+verifyConfigurable(Math.cbrt, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/cbrt/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/cbrt/not-a-constructor.js
new file mode 100644
index 0000000000..39b62b8f1c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/cbrt/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.cbrt 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.cbrt), false, 'isConstructor(Math.cbrt) must return false');
+
+assert.throws(TypeError, () => {
+ new Math.cbrt();
+}, '`new Math.cbrt()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/cbrt/prop-desc.js b/js/src/tests/test262/built-ins/Math/cbrt/prop-desc.js
new file mode 100644
index 0000000000..a1848425b0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/cbrt/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.cbrt
+includes: [propertyHelper.js]
+es6id: 20.2.2.9
+---*/
+
+verifyNotEnumerable(Math, "cbrt");
+verifyWritable(Math, "cbrt");
+verifyConfigurable(Math, "cbrt");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/cbrt/shell.js b/js/src/tests/test262/built-ins/Math/cbrt/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/cbrt/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;
+}