summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Math/sign
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Math/sign')
-rw-r--r--js/src/tests/test262/built-ins/Math/sign/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Math/sign/length.js27
-rw-r--r--js/src/tests/test262/built-ins/Math/sign/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Math/sign/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Math/sign/prop-desc.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/sign/shell.js24
-rw-r--r--js/src/tests/test262/built-ins/Math/sign/sign-specialVals.js22
7 files changed, 146 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Math/sign/browser.js b/js/src/tests/test262/built-ins/Math/sign/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/sign/browser.js
diff --git a/js/src/tests/test262/built-ins/Math/sign/length.js b/js/src/tests/test262/built-ins/Math/sign/length.js
new file mode 100644
index 0000000000..2d172bfaaa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/sign/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.sign
+es6id: 20.2.2.29
+info: |
+ Math.sign ( 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.sign.length, 1);
+
+verifyNotEnumerable(Math.sign, "length");
+verifyNotWritable(Math.sign, "length");
+verifyConfigurable(Math.sign, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/sign/name.js b/js/src/tests/test262/built-ins/Math/sign/name.js
new file mode 100644
index 0000000000..f706d18562
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/sign/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.29
+description: >
+ Math.sign.name is "sign".
+info: |
+ Math.sign ( 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.sign.name, "sign");
+
+verifyNotEnumerable(Math.sign, "name");
+verifyNotWritable(Math.sign, "name");
+verifyConfigurable(Math.sign, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/sign/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/sign/not-a-constructor.js
new file mode 100644
index 0000000000..73a8f9f7d9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/sign/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.sign 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.sign), false, 'isConstructor(Math.sign) must return false');
+
+assert.throws(TypeError, () => {
+ new Math.sign();
+}, '`new Math.sign()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/sign/prop-desc.js b/js/src/tests/test262/built-ins/Math/sign/prop-desc.js
new file mode 100644
index 0000000000..4314141924
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/sign/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.sign
+includes: [propertyHelper.js]
+es6id: 20.2.2.29
+---*/
+
+verifyNotEnumerable(Math, "sign");
+verifyWritable(Math, "sign");
+verifyConfigurable(Math, "sign");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/sign/shell.js b/js/src/tests/test262/built-ins/Math/sign/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/sign/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/sign/sign-specialVals.js b/js/src/tests/test262/built-ins/Math/sign/sign-specialVals.js
new file mode 100644
index 0000000000..aec756e173
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/sign/sign-specialVals.js
@@ -0,0 +1,22 @@
+// Copyright 2015 Microsoft Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+description: >
+ Returns the sign of the x, indicating whether x is positive, negative or zero.
+es6id: 20.2.2.29
+---*/
+
+assert.sameValue(Math.sign(NaN), NaN, "NaN");
+assert.sameValue(Math.sign(-0), -0, "-0");
+assert.sameValue(Math.sign(0), 0, "0");
+
+assert.sameValue(Math.sign(-0.000001), -1, "-0.000001");
+assert.sameValue(Math.sign(-1), -1, "-1");
+assert.sameValue(Math.sign(-Infinity), -1, "-Infinity");
+
+assert.sameValue(Math.sign(0.000001), 1, "0.000001");
+assert.sameValue(Math.sign(1), 1, "1");
+assert.sameValue(Math.sign(Infinity), 1, "Infinity");
+
+reportCompare(0, 0);