diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Math/pow')
30 files changed, 732 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A1.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A1.js new file mode 100644 index 0000000000..2aa4d453fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If exponent is NaN, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = NaN; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -0.000000000000001; +base[3] = -0; +base[4] = +0 +base[5] = 0.000000000000001; +base[6] = 1.7976931348623157E308; //largest finite number +base[7] = +Infinity; +base[8] = NaN; +var basenum = 9; + +for (var i = 0; i < basenum; i++) { + assert.sameValue( + Math.pow(base[i], exponent), + NaN, + base[i] + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A10.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A10.js new file mode 100644 index 0000000000..b074244a36 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A10.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) < 1 and exponent is −∞, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = -Infinity; +var base = new Array(); +base[0] = 0.999999999999999; +base[1] = 0.5; +base[2] = +0; +base[3] = -0; +base[4] = -0.5; +base[5] = -0.999999999999999; +var basenum = 6; + +for (var i = 0; i < basenum; i++) { + if (Math.pow(base[i], exponent) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A11.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A11.js new file mode 100644 index 0000000000..c5a06914f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A11.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is +∞ and exponent > 0, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = +Infinity; +var exponent = new Array(); +exponent[3] = Infinity; +exponent[2] = 1.7976931348623157E308; //largest (by module) finite number +exponent[1] = 1; +exponent[0] = 0.000000000000001; +var exponentnum = 4; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A12.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A12.js new file mode 100644 index 0000000000..d8ff1d28a4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A12.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is +∞ and exponent < 0, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = +Infinity; +var exponent = new Array(); +exponent[0] = -Infinity; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[2] = -1; +exponent[3] = -0.000000000000001; +var exponentnum = 4; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A13.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A13.js new file mode 100644 index 0000000000..648e70f315 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A13.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. + +/*--- +description: If base is −∞ and exponent > 0 and exponent is an odd integer, the result is −∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -Infinity; +var exponent = new Array(); +exponent[0] = 1; +exponent[1] = 111; +exponent[2] = 111111; +var exponentnum = 3; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== -Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A14.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A14.js new file mode 100644 index 0000000000..240dc2d5c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_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. + +/*--- +description: If base is −∞ and exponent > 0 and exponent is not an odd integer, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -Infinity; +var exponent = new Array(); +exponent[0] = 0.000000000000001; +exponent[1] = 2; +exponent[2] = Math.PI; +exponent[3] = 1.7976931348623157E308; //largest finite number +exponent[4] = +Infinity; +var exponentnum = 5; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A15.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A15.js new file mode 100644 index 0000000000..6847e897d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A15.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is −∞ and exponent < 0 and exponent is an odd integer, the result is −0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -Infinity; +var exponent = new Array(); +exponent[2] = -1; +exponent[1] = -111; +exponent[0] = -111111; +var exponentnum = 3; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), -0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A16.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A16.js new file mode 100644 index 0000000000..a12153e1c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A16.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. + +/*--- +description: If base is −∞ and exponent < 0 and exponent is not an odd integer, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -Infinity; +var exponent = new Array(); +exponent[4] = -0.000000000000001; +exponent[3] = -2; +exponent[2] = -Math.PI; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[0] = -Infinity; +var exponentnum = 5; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A17.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A17.js new file mode 100644 index 0000000000..cbf1926898 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A17.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is +0 and exponent > 0, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = +0; +var exponent = new Array(); +exponent[3] = Infinity; +exponent[2] = 1.7976931348623157E308; //largest finite number +exponent[1] = 1; +exponent[0] = 0.000000000000001; +var exponentnum = 4; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A18.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A18.js new file mode 100644 index 0000000000..49dc14fe83 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A18.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is +0 and exponent < 0, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = +0; +var exponent = new Array(); +exponent[0] = -Infinity; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[2] = -1; +exponent[3] = -0.000000000000001; +var exponentnum = 4; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A19.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A19.js new file mode 100644 index 0000000000..0fe1c46bc2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A19.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is −0 and exponent > 0 and exponent is an odd integer, the result is −0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -0; +var exponent = new Array(); +exponent[0] = 1; +exponent[1] = 111; +exponent[2] = 111111; +var exponentnum = 3; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), -0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A2.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A2.js new file mode 100644 index 0000000000..99bac1d4e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A2.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. + +/*--- +description: If exponent is +0, the result is 1, even if base is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = +0; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -0.000000000000001; +base[3] = -0; +base[4] = +0 +base[5] = 0.000000000000001; +base[6] = 1.7976931348623157E308; //largest finite number +base[7] = +Infinity; +base[8] = NaN; +var basenum = 9; + +for (var i = 0; i < basenum; i++) { + if (Math.pow(base[i], exponent) !== 1) { + throw new Test262Error("#1: Math.pow(" + base[i] + ", " + exponent + ") !== 1"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A20.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A20.js new file mode 100644 index 0000000000..dc51e7312b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A20.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. + +/*--- +description: If base is −0 and exponent > 0 and exponent is not an odd integer, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -0; +var exponent = new Array(); +exponent[0] = 0.000000000000001; +exponent[1] = 2; +exponent[2] = Math.PI; +exponent[3] = 1.7976931348623157E308; //largest finite number +exponent[4] = +Infinity; +var exponentnum = 5; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A21.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A21.js new file mode 100644 index 0000000000..de7557f51d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A21.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. + +/*--- +description: If base is −0 and exponent < 0 and exponent is an odd integer, the result is −∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -0; +var exponent = new Array(); +exponent[2] = -1; +exponent[1] = -111; +exponent[0] = -111111; +var exponentnum = 3; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== -Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A22.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A22.js new file mode 100644 index 0000000000..021a756690 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A22.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. + +/*--- +description: If base is −0 and exponent < 0 and exponent is not an odd integer, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -0; +var exponent = new Array(); +exponent[4] = -0.000000000000001; +exponent[3] = -2; +exponent[2] = -Math.PI; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[0] = -Infinity; +var exponentnum = 5; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A23.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A23.js new file mode 100644 index 0000000000..6f389c524a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A23.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. + +/*--- +description: If base < 0 and base is finite and exponent is finite and exponent is not an integer, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = new Array(); +var base = new Array(); +base[0] = -1.7976931348623157E308; //largest (by module) finite number +base[1] = -Math.PI; +base[2] = -1; +base[3] = -0.000000000000001; +var basenum = 4; + +exponent[0] = -Math.PI; +exponent[1] = -Math.E; +exponent[2] = -1.000000000000001; +exponent[3] = -0.000000000000001; +exponent[4] = 0.000000000000001; +exponent[5] = 1.000000000000001; +exponent[6] = Math.E; +exponent[7] = Math.PI; + +var exponentnum = 8; + +for (var i = 0; i < basenum; i++) { + for (var j = 0; j < exponentnum; j++) { + assert.sameValue( + Math.pow(base[i], exponent[j]), + NaN, + "(" + base[i] + ", " + exponent[j] + ")" + ); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A3.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A3.js new file mode 100644 index 0000000000..c61fed40d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A3.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. + +/*--- +description: If exponent is −0, the result is 1, even if base is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = -0; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -0.000000000000001; +base[3] = -0; +base[4] = +0 +base[5] = 0.000000000000001; +base[6] = 1.7976931348623157E308; //largest finite number +base[7] = +Infinity; +base[8] = NaN; +var basenum = 9; + +for (var i = 0; i < basenum; i++) { + if (Math.pow(base[i], exponent) !== 1) { + throw new Test262Error("#1: Math.pow(" + base[i] + ", -0) !== 1"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A4.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A4.js new file mode 100644 index 0000000000..d1426b6e50 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A4.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. + +/*--- +description: If base is NaN and exponent is nonzero, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var base = NaN; +var exponent = new Array(); +exponent[0] = -Infinity; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[2] = -0.000000000000001; +exponent[3] = 0.000000000000001; +exponent[4] = 1.7976931348623157E308; //largest finite number +exponent[5] = +Infinity; +exponent[6] = NaN; +var exponentnum = 7; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue( + Math.pow(base, exponent[i]), + NaN, + "(" + base + ", " + exponent[i] + ")" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A5.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A5.js new file mode 100644 index 0000000000..a827298cac --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A5.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) > 1 and exponent is +∞, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = +Infinity; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -1.000000000000001; +base[3] = 1.000000000000001; +base[4] = 1.7976931348623157E308; //largest finite number +base[5] = +Infinity; +var basenum = 6; + +for (var i = 0; i < basenum; i++) { + if (Math.pow(base[i], exponent) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A6.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A6.js new file mode 100644 index 0000000000..419d321dc8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A6.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) > 1 and exponent is −∞, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = -Infinity; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -1.000000000000001; +base[3] = 1.000000000000001; +base[4] = 1.7976931348623157E308; //largest finite number +base[5] = +Infinity; +var basenum = 6; + +for (var i = 0; i < basenum; i++) { + assert.sameValue(Math.pow(base[i], exponent), 0, base[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A7.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A7.js new file mode 100644 index 0000000000..c741bdbe60 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A7.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) is 1 and exponent is +∞, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = +Infinity; +var base = new Array(); +base[0] = -1; +base[1] = 1 +var basenum = 2; + +for (var i = 0; i < basenum; i++) { + assert.sameValue( + Math.pow(base[i], exponent), + NaN, + "(" + base[i] + ", " + exponent + ")" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A8.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A8.js new file mode 100644 index 0000000000..64c11f9dfa --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A8.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) is 1 and exponent is −∞, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = -Infinity; +var base = new Array(); +base[0] = -1; +base[1] = 1 +var basenum = 2; + +for (var i = 0; i < basenum; i++) { + assert.sameValue( + Math.pow(base[i], exponent), + NaN, + "(" + base[i] + ", " + exponent + ")" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A9.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A9.js new file mode 100644 index 0000000000..d46eaa49fa --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A9.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) < 1 and exponent is +∞, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = +Infinity; +var base = new Array(); +base[0] = 0.999999999999999; +base[1] = 0.5; +base[2] = +0; +base[3] = -0; +base[4] = -0.5; +base[5] = -0.999999999999999; +var basenum = 6; + +for (var i = 0; i < basenum; i++) { + assert.sameValue(Math.pow(base[i], exponent), 0, exponent); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/browser.js b/js/src/tests/test262/built-ins/Math/pow/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/browser.js diff --git a/js/src/tests/test262/built-ins/Math/pow/int32_min-exponent.js b/js/src/tests/test262/built-ins/Math/pow/int32_min-exponent.js new file mode 100644 index 0000000000..bf71518987 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/int32_min-exponent.js @@ -0,0 +1,19 @@ +// Copyright (C) 2018 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: > + Using -(2**31) as exponent with Math.pow should behave as expected. +---*/ + +const INT32_MIN = -2147483648; + +assert.sameValue(Math.pow(2, INT32_MIN), +0.0, + "Math.pow(2, -(gonzo huge exponent > 1074)) should be +0 " + + "because 2**-1074 is the smallest positive IEEE-754 number"); + +assert.sameValue(Math.pow(1, INT32_MIN), 1, + "1**-(gonzo huge exponent > 1074) should be 1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/length.js b/js/src/tests/test262/built-ins/Math/pow/length.js new file mode 100644 index 0000000000..0ac918c8fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/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. + +/*--- +esid: sec-math.pow +description: > + Math.pow.length is 2. +info: | + Math.pow ( x, y ) + + 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.pow.length, 2); + +verifyNotEnumerable(Math.pow, "length"); +verifyNotWritable(Math.pow, "length"); +verifyConfigurable(Math.pow, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/name.js b/js/src/tests/test262/built-ins/Math/pow/name.js new file mode 100644 index 0000000000..c0caa2c9ad --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/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. + +/*--- +esid: sec-math.pow +description: > + Math.pow.name is "pow". +info: | + Math.pow ( x, y ) + + 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.pow.name, "pow"); + +verifyNotEnumerable(Math.pow, "name"); +verifyNotWritable(Math.pow, "name"); +verifyConfigurable(Math.pow, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/pow/not-a-constructor.js new file mode 100644 index 0000000000..00ba4261fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/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.pow 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.pow), false, 'isConstructor(Math.pow) must return false'); + +assert.throws(TypeError, () => { + new Math.pow(); +}, '`new Math.pow()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/prop-desc.js b/js/src/tests/test262/built-ins/Math/pow/prop-desc.js new file mode 100644 index 0000000000..9ab2090f52 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.pow +description: > + Math.pow ( base, exponent ) +info: | + 17 ECMAScript Standard Built-in Objects: + 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, "pow"); +verifyWritable(Math, "pow"); +verifyConfigurable(Math, "pow"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/shell.js b/js/src/tests/test262/built-ins/Math/pow/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/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; +} |