diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Math/atan2')
13 files changed, 294 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A1.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A1.js new file mode 100644 index 0000000000..af55dbb0de --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If either x or y is NaN, Math(x,y) is NaN +es5id: 15.8.2.5_A1 +description: > + Checking if Math.atan2(NaN,y) and Math.atan2(x,NaN) is NaN for + different x and y values +---*/ + +// CHECK#1 + +var vals = new Array(); +vals[0] = -Infinity; +vals[1] = -0.000000000000001; +vals[2] = -0; +vals[3] = +0 +vals[4] = 0.000000000000001; +vals[5] = +Infinity; +vals[6] = NaN; +var valnum = 7; + +var args = new Array(); +for (var i = 0; i < 2; i++) +{ + args[i] = NaN; + for (var j = 0; j < valnum; j++) + { + args[1 - i] = vals[j]; + assert.sameValue( + Math.atan2(args[0], args[1]), + NaN, + "(" + args[0] + ", " + args[1] + ")" + ); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A14.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A14.js new file mode 100644 index 0000000000..34ad7202c3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A14.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y>0 and y is finite and x is equal to +Infinity, Math.atan2(y,x) is +0 +es5id: 15.8.2.5_A14 +description: > + Checking if Math.atan2(y,x) equals to +0, where y>0 and y is + finite and x is equal to +Infinity +---*/ + +// CHECK#1 +var x = +Infinity; +var y = new Array(); +y[0] = 0.000000000000001; +y[1] = 1; +y[2] = 1.7976931348623157E308; //largest finite number +var ynum = 3; + +for (var i = 0; i < ynum; i++) +{ + assert.sameValue(Math.atan2(y[i], x), 0, y[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A16.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A16.js new file mode 100644 index 0000000000..ab59d87d44 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A16.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y<0 and y is finite and x is equal to +Infinity, Math.atan2(y,x) is -0 +es5id: 15.8.2.5_A16 +description: > + Checking if Math.atan2(y,x) is -0, where y<0 and y is finite and x + is equal to +Infinity +---*/ + +// CHECK#1 +var x = +Infinity; +var y = new Array(); +y[0] = -0.000000000000001; +y[1] = -1; +y[2] = -1.7976931348623157E308; //largest by abs() finite number +var ynum = 3; + +for (var i = 0; i < ynum; i++) +{ + assert.sameValue( + Math.atan2(y[i], x), + -0, + "(" + y[i] + ", Infinity)" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A4.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A4.js new file mode 100644 index 0000000000..cb1c29c127 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A4.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is +0 and x>0, Math.atan2(y,x) is +0 +es5id: 15.8.2.5_A4 +description: Checking if Math.atan2(y,x) equals to +0, where y is +0 and x>0 +---*/ + +// CHECK#1 +var y = +0; +var x = new Array(); +x[0] = 0.000000000000001; +x[2] = +Infinity; +x[1] = 1; +var xnum = 3; + +for (var i = 0; i < xnum; i++) +{ + assert.sameValue(Math.atan2(y, x[i]), 0, x[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A5.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A5.js new file mode 100644 index 0000000000..50ef5c0a87 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A5.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is +0 and x is +0, Math.atan2(y,x) is +0 +es5id: 15.8.2.5_A5 +description: Checking if Math.atan2(y,x) is +0, where y is +0 and x is +0 +---*/ + +assert.sameValue(Math.atan2(0, 0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A8.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A8.js new file mode 100644 index 0000000000..ff48e85564 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A8.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is equal to -0 and x>0, Math.atan2(y,x) is -0 +es5id: 15.8.2.5_A8 +description: Checking if Math.atan2(y,x) is -0, where y is equal to -0 and x>0 +---*/ + +// CHECK#1 +var y = -0; +var x = new Array(); +x[0] = 0.000000000000001; +x[2] = +Infinity; +x[1] = 1; +var xnum = 3; + +for (var i = 0; i < xnum; i++) +{ + assert.sameValue( + Math.atan2(y, x[i]), + -0, + "(-0, " + x[i] + ")" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A9.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A9.js new file mode 100644 index 0000000000..8977e1a516 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A9.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is -0 and x is +0, Math.atan2(y,x) is -0 +es5id: 15.8.2.5_A9 +description: Checking if Math.atan2(y,x) is -0, where y is -0 and x is +0 +---*/ + +assert.sameValue(Math.atan2(-0, 0), -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/browser.js b/js/src/tests/test262/built-ins/Math/atan2/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/browser.js diff --git a/js/src/tests/test262/built-ins/Math/atan2/length.js b/js/src/tests/test262/built-ins/Math/atan2/length.js new file mode 100644 index 0000000000..8255c76783 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/length.js @@ -0,0 +1,31 @@ +// 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.8 +description: > + Math.atan2.length is 2. +info: | + Math.atan2 ( y, 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.atan2.length, 2); + +verifyNotEnumerable(Math.atan2, "length"); +verifyNotWritable(Math.atan2, "length"); +verifyConfigurable(Math.atan2, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/name.js b/js/src/tests/test262/built-ins/Math/atan2/name.js new file mode 100644 index 0000000000..fef201b98d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/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.8 +description: > + Math.atan2.name is "atan2". +info: | + Math.atan2 ( y, 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.atan2.name, "atan2"); + +verifyNotEnumerable(Math.atan2, "name"); +verifyNotWritable(Math.atan2, "name"); +verifyConfigurable(Math.atan2, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/atan2/not-a-constructor.js new file mode 100644 index 0000000000..3b8989dd32 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/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.atan2 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.atan2), false, 'isConstructor(Math.atan2) must return false'); + +assert.throws(TypeError, () => { + new Math.atan2(); +}, '`new Math.atan2()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/prop-desc.js b/js/src/tests/test262/built-ins/Math/atan2/prop-desc.js new file mode 100644 index 0000000000..4a97d06011 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-math.atan2 +description: > + "atan2" property of Math +info: | + Section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Math, "atan2"); +verifyWritable(Math, "atan2"); +verifyConfigurable(Math, "atan2"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/shell.js b/js/src/tests/test262/built-ins/Math/atan2/shell.js new file mode 100644 index 0000000000..54371b7789 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/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; +} |