summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Math/hypot
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Math/hypot')
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Infinity.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/Math.hypot_InfinityNaN.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NaN.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NegInfinity.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NoArgs.js12
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Success_2.js12
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Zero_2.js15
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/length.js31
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/prop-desc.js14
-rw-r--r--js/src/tests/test262/built-ins/Math/hypot/shell.js19
13 files changed, 218 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Infinity.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Infinity.js
new file mode 100644
index 0000000000..b1044692b2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Infinity.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Ryan Lewis. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.2.2.18
+author: Ryan Lewis
+description: >
+ Math.hypot should return Infinity if called with any argument that
+ is Infinity.
+---*/
+
+assert.sameValue(Math.hypot(3, Infinity), Infinity, 'Math.hypot(3, Infinity)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_InfinityNaN.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_InfinityNaN.js
new file mode 100644
index 0000000000..d06561cdd2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_InfinityNaN.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Ryan Lewis. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.2.2.18
+author: Ryan Lewis
+description: >
+ Math.hypot should return Infinity if called with any argument that
+ is Infinity.
+---*/
+
+assert.sameValue(Math.hypot(NaN, Infinity), Infinity, 'Math.hypot(NaN, Infinity)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NaN.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NaN.js
new file mode 100644
index 0000000000..36260e96f3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NaN.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Ryan Lewis. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.2.2.18
+author: Ryan Lewis
+description: >
+ Math.hypot should return NaN if called with any argument that is
+ NaN.
+---*/
+
+assert.sameValue(Math.hypot(NaN, 3), NaN);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NegInfinity.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NegInfinity.js
new file mode 100644
index 0000000000..5c4dd8566b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NegInfinity.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Ryan Lewis. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.2.2.18
+author: Ryan Lewis
+description: >
+ Math.hypot should return Infinity if called with any argument that
+ is -Infinity.
+---*/
+
+assert.sameValue(Math.hypot(3, -Infinity), Infinity, 'Math.hypot(3, -Infinity)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NoArgs.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NoArgs.js
new file mode 100644
index 0000000000..328fd8de43
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NoArgs.js
@@ -0,0 +1,12 @@
+// Copyright (c) 2014 Ryan Lewis. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.2.2.18
+author: Ryan Lewis
+description: Math.hypot should return 0 if called with no arguments.
+---*/
+
+assert.sameValue(Math.hypot(), 0, 'Math.hypot()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Success_2.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Success_2.js
new file mode 100644
index 0000000000..15fcca9749
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Success_2.js
@@ -0,0 +1,12 @@
+// Copyright (c) 2014 Ryan Lewis. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.2.2.18
+author: Ryan Lewis
+description: Math.hypot should return 5 if called with 3 and 4.
+---*/
+
+assert.sameValue(Math.hypot(3, 4), 5, 'Math.hypot(3,4)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Zero_2.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Zero_2.js
new file mode 100644
index 0000000000..7471d21e79
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Zero_2.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2014 Ryan Lewis. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.2.2.18
+author: Ryan Lewis
+description: Return 0 if all arguments being are 0 or -0.
+---*/
+
+assert.sameValue(Math.hypot(0, 0), 0, 'Math.hypot(0, 0)');
+assert.sameValue(Math.hypot(0, -0), 0, 'Math.hypot(0, -0)');
+assert.sameValue(Math.hypot(-0, 0), 0, 'Math.hypot(-0, 0)');
+assert.sameValue(Math.hypot(-0, -0), 0, 'Math.hypot(-0, -0)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/browser.js b/js/src/tests/test262/built-ins/Math/hypot/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/browser.js
diff --git a/js/src/tests/test262/built-ins/Math/hypot/length.js b/js/src/tests/test262/built-ins/Math/hypot/length.js
new file mode 100644
index 0000000000..9800debc1a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/length.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2014 Ryan Lewis. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.2.2.18
+author: Ryan Lewis
+description: Math.hypot.length should return 2.
+info: |
+ Math.hypot ( value1, value2, ...values )
+
+ 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.hypot.length, 2);
+
+verifyNotEnumerable(Math.hypot, "length");
+verifyNotWritable(Math.hypot, "length");
+verifyConfigurable(Math.hypot, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/name.js b/js/src/tests/test262/built-ins/Math/hypot/name.js
new file mode 100644
index 0000000000..46d395ca06
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/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.18
+description: >
+ Math.hypot.name is "hypot".
+info: |
+ Math.hypot ( value1 , value2 , …values )
+
+ 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.hypot.name, "hypot");
+
+verifyNotEnumerable(Math.hypot, "name");
+verifyNotWritable(Math.hypot, "name");
+verifyConfigurable(Math.hypot, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/hypot/not-a-constructor.js
new file mode 100644
index 0000000000..21ff4ba634
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/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.hypot 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.hypot), false, 'isConstructor(Math.hypot) must return false');
+
+assert.throws(TypeError, () => {
+ new Math.hypot();
+}, '`new Math.hypot()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/prop-desc.js b/js/src/tests/test262/built-ins/Math/hypot/prop-desc.js
new file mode 100644
index 0000000000..3161342511
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/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.hypot
+includes: [propertyHelper.js]
+es6id: 20.2.2.18
+---*/
+
+verifyNotEnumerable(Math, "hypot");
+verifyWritable(Math, "hypot");
+verifyConfigurable(Math, "hypot");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Math/hypot/shell.js b/js/src/tests/test262/built-ins/Math/hypot/shell.js
new file mode 100644
index 0000000000..54371b7789
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/hypot/shell.js
@@ -0,0 +1,19 @@
+// 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]
+---*/
+
+function isConstructor(f) {
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}