mirror of https://github.com/tc39/test262.git
Transform legacy format to harness assertions: test/built-ins/M*/**/*.js (#3150)
This commit is contained in:
parent
73dc6f3714
commit
69262f6743
test/built-ins/Math
abs
ceil
cos
exp
floor
log
max
min
round
sqrt
|
@ -9,7 +9,4 @@ description: Checking if Math.abs(-Infinity) equals to +Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = -Infinity;
|
||||
if (Math.abs(x) !== +Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x=-Infinity; Math.abs(x) !== +Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.abs(x), +Infinity, 'Math.abs(-Infinity) must return +Infinity');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.ceil(x) is +Infinity, where x is +Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = +Infinity;
|
||||
if (Math.ceil(x) !== +Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x = +Infinity; Math.ceil(x) !== +Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.ceil(x), +Infinity, 'Math.ceil(+Infinity) must return +Infinity');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.ceil(x) is -Infinity, where x is -Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = -Infinity;
|
||||
if (Math.ceil(x) !== -Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x = -Infinity; Math.ceil(x) !== -Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.ceil(x), -Infinity, 'Math.ceil(-Infinity) must return -Infinity');
|
||||
|
|
|
@ -13,8 +13,5 @@ description: >
|
|||
for (var i = -1000; i < 1000; i++)
|
||||
{
|
||||
var x = i / 10.0;
|
||||
if (Math.ceil(x) !== -Math.floor(-x))
|
||||
{
|
||||
throw new Test262Error("#1: 'x = " + x + "; Math.ceil(x) !== -Math.floor(-x)'");
|
||||
}
|
||||
assert.sameValue(Math.ceil(x), -Math.floor(-x), 'Math.ceil(i / 10.0) must return -Math.floor(-x)');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.cos(+0) is 1
|
|||
|
||||
// CHECK#1
|
||||
var x = +0;
|
||||
if (Math.cos(x) !== 1)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x = +0; Math.cos(x) !== 1'");
|
||||
}
|
||||
assert.sameValue(Math.cos(x), 1, 'Math.cos(+0) must return 1');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.cos(-0) is 1
|
|||
|
||||
// CHECK#1
|
||||
var x = -0;
|
||||
if (Math.cos(x) !== 1)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x = -0; Math.cos(x) !== 1'");
|
||||
}
|
||||
assert.sameValue(Math.cos(x), 1, 'Math.cos(-0) must return 1');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.exp(+0) is 1
|
|||
|
||||
// CHECK#1
|
||||
var x = +0;
|
||||
if (Math.exp(x) !== 1)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x = +0; Math.exp(x) !== 1'");
|
||||
}
|
||||
assert.sameValue(Math.exp(x), 1, 'Math.exp(+0) must return 1');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.exp(-0) is 1
|
|||
|
||||
// CHECK#1
|
||||
var x = -0;
|
||||
if (Math.exp(x) !== 1)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x = -0; Math.exp(x) !== 1'");
|
||||
}
|
||||
assert.sameValue(Math.exp(x), 1, 'Math.exp(-0) must return 1');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.exp(+Infinity) is +Ifinity
|
|||
|
||||
// CHECK#1
|
||||
var x = +Infinity;
|
||||
if (Math.exp(x) !== +Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x = +Infinity; Math.exp(x) !== +Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.exp(x), +Infinity, 'Math.exp(+Infinity) must return +Infinity');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.floor(x) is +Infinity, where x is +Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = +Infinity;
|
||||
if (Math.floor(x) !== +Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x = +Infinity; Math.floor(x) !== +Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.floor(x), +Infinity, 'Math.floor(+Infinity) must return +Infinity');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.floor(x) is -Infinity, where x is -Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = -Infinity;
|
||||
if (Math.floor(x) !== -Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x = -Infinity; Math.floor(x) !== -Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.floor(x), -Infinity, 'Math.floor(-Infinity) must return -Infinity');
|
||||
|
|
|
@ -13,8 +13,10 @@ description: >
|
|||
for (var i = -1000; i < 1000; i++)
|
||||
{
|
||||
var x = i / 10.0;
|
||||
if (-Math.ceil(-x) !== Math.floor(x))
|
||||
{
|
||||
throw new Test262Error("#1: 'x = " + x + "; Math.floor(x) !== -Math.ceil(-x)'");
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
-Math.ceil(-x),
|
||||
Math.floor(x),
|
||||
'The value of `-Math.ceil(-x)` must return the same value returned by Math.floor(x)'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,14 +9,8 @@ description: Checking if Math.log(+0) and Math.log(-0) equals to -Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = +0;
|
||||
if (Math.log(x) !== -Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x=+0; Math.log(x) !== -Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.log(x), -Infinity, 'Math.log(+0) must return -Infinity');
|
||||
|
||||
// CHECK#2
|
||||
var x = -0;
|
||||
if (Math.log(x) !== -Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x=-0; Math.log(x) !== -Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.log(x), -Infinity, 'Math.log(-0) must return -Infinity');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.log(+Infinity) equals to +Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = +Infinity;
|
||||
if (Math.log(x) !== +Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x=+Infinity; Math.log(x) !== +Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.log(x), +Infinity, 'Math.log(+Infinity) must return +Infinity');
|
||||
|
|
|
@ -6,9 +6,4 @@ info: If no arguments are given, Math.max() is -Infinity
|
|||
es5id: 15.8.2.11_A1
|
||||
description: Checking if Math.max() equals to -Infinity
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
if (Math.max() != -Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'Math.max() != -Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.max(), -Infinity, 'Math.max() must return -Infinity');
|
||||
|
|
|
@ -6,18 +6,6 @@ info: The length property of the Math.max method is 2
|
|||
es5id: 15.8.2.11_A4
|
||||
description: Checking if Math.max.length property is defined and equals to 2
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
if (typeof Math.max !== "function") {
|
||||
throw new Test262Error('#1: Math.max method is not defined');
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
if (typeof Math.max.length === "undefined") {
|
||||
throw new Test262Error('#2: length property of Math.max method is undefined');
|
||||
}
|
||||
|
||||
// CHECK#3
|
||||
if (Math.max.length !== 2) {
|
||||
throw new Test262Error('#3: The length property of the Math.max method is not 2');
|
||||
}
|
||||
assert.sameValue(typeof Math.max, "function", 'The value of `typeof Math.max` is expected to be "function"');
|
||||
assert.notSameValue(typeof Math.max.length, "undefined", 'The value of typeof Math.max.length is not "undefined"');
|
||||
assert.sameValue(Math.max.length, 2, 'The value of Math.max.length is expected to be 2');
|
||||
|
|
|
@ -6,9 +6,4 @@ info: If no arguments are given, Math.min() is +Infinity
|
|||
es5id: 15.8.2.12_A1
|
||||
description: Checking if Math.min() equals to +Infinity
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
if (Math.min() != +Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'Math.min() != +Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.min(), +Infinity, 'Math.min() must return +Infinity');
|
||||
|
|
|
@ -6,18 +6,6 @@ info: The length property of the Math.min method is 2
|
|||
es5id: 15.8.2.12_A4
|
||||
description: Checking if Math.min.length property is defined and equals to 2
|
||||
---*/
|
||||
|
||||
// CHECK#1
|
||||
if (typeof Math.min !== "function") {
|
||||
throw new Test262Error('#1: Math.min method is not defined');
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
if (typeof Math.min.length === "undefined") {
|
||||
throw new Test262Error('#2: length property of Math.min method is undefined');
|
||||
}
|
||||
|
||||
// CHECK#3
|
||||
if (Math.min.length !== 2) {
|
||||
throw new Test262Error('#3: The length property of the Math.min method is not 2');
|
||||
}
|
||||
assert.sameValue(typeof Math.min, "function", 'The value of `typeof Math.min` is expected to be "function"');
|
||||
assert.notSameValue(typeof Math.min.length, "undefined", 'The value of typeof Math.min.length is not "undefined"');
|
||||
assert.sameValue(Math.min.length, 2, 'The value of Math.min.length is expected to be 2');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.round(x) is +Infinity, where x is +Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = +Infinity;
|
||||
if (Math.round(x) !== +Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x=+Infinity; Math.round(x) !== +Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.round(x), +Infinity, 'Math.round(+Infinity) must return +Infinity');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.round(x) is -Infinity, where x is -Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = -Infinity;
|
||||
if (Math.round(x) !== -Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x=-Infinity; Math.round(x) !== -Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.round(x), -Infinity, 'Math.round(-Infinity) must return -Infinity');
|
||||
|
|
|
@ -16,10 +16,12 @@ description: >
|
|||
for (var i = 0; i <= 1000; i++)
|
||||
{
|
||||
var x = i / 10.0;
|
||||
if (Math.round(x) !== Math.floor(x + 0.5))
|
||||
{
|
||||
throw new Test262Error("#1: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'")
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
Math.round(x),
|
||||
Math.floor(x + 0.5),
|
||||
'Math.round(i / 10.0) must return the same value returned by Math.floor(x + 0.5)'
|
||||
);
|
||||
}
|
||||
|
||||
for (i = -5; i >= -1000; i--)
|
||||
|
@ -32,8 +34,9 @@ for (i = -5; i >= -1000; i--)
|
|||
x = i / 10.0;
|
||||
}
|
||||
|
||||
if (Math.round(x) !== Math.floor(x + 0.5))
|
||||
{
|
||||
throw new Test262Error("#2: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'")
|
||||
}
|
||||
assert.sameValue(
|
||||
Math.round(x),
|
||||
Math.floor(x + 0.5),
|
||||
'Math.round(i / 10.0) must return the same value returned by Math.floor(x + 0.5)'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -13,62 +13,46 @@ description: >
|
|||
2) for 0.5 - Number.EPSILON / 4
|
||||
3) for odd integers in [-(2 / Number.EPSILON - 1); -(1 / Number.EPSILON + 1)] or in [1 / Number.EPSILON + 1; 2 / Number.EPSILON - 1]
|
||||
---*/
|
||||
assert.sameValue(
|
||||
1 / Math.round(-0.5),
|
||||
1 / -0,
|
||||
'The result of evaluating (1 / Math.round(-0.5)) is expected to be 1 / -0'
|
||||
);
|
||||
|
||||
// CHECK#1
|
||||
if (1 / Math.round(-0.5) !== 1 / -0) {
|
||||
throw new Test262Error("#1: '1 / Math.round(-0.5) !== 1 / -0'");
|
||||
}
|
||||
assert.sameValue(
|
||||
1 / Math.round(-0.25),
|
||||
1 / -0,
|
||||
'The result of evaluating (1 / Math.round(-0.25)) is expected to be 1 / -0'
|
||||
);
|
||||
|
||||
// CHECK#2
|
||||
if (1 / Math.round(-0.25) !== 1 / -0) {
|
||||
throw new Test262Error("#2: '1 / Math.round(-0.25) !== 1 / -0'");
|
||||
}
|
||||
|
||||
// CHECK#3
|
||||
if (1 / Math.round(-0) !== 1 / -0) {
|
||||
throw new Test262Error("#3: '1 / Math.round(-0) !== 1 / -0'");
|
||||
}
|
||||
assert.sameValue(1 / Math.round(-0), 1 / -0, 'The result of evaluating (1 / Math.round(-0)) is expected to be 1 / -0');
|
||||
|
||||
var x = 0;
|
||||
|
||||
// CHECK#4
|
||||
x = 0.5 - Number.EPSILON / 4;
|
||||
if (1 / Math.round(x) !== 1 / 0) {
|
||||
throw new Test262Error("#4: '1 / Math.round(" + x + ") !== 1 / 0'");
|
||||
}
|
||||
assert.sameValue(1 / Math.round(x), 1 / 0, 'The result of evaluating (1 / Math.round(x)) is expected to be 1 / 0');
|
||||
|
||||
// CHECK#5
|
||||
x = -(2 / Number.EPSILON - 1);
|
||||
if (Math.round(x) !== x) {
|
||||
throw new Test262Error("#5: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
assert.sameValue(Math.round(x), x, 'Math.round(-(2 / Number.EPSILON - 1)) returns x');
|
||||
|
||||
// CHECK#6
|
||||
x = -(1.5 / Number.EPSILON - 1);
|
||||
if (Math.round(x) !== x) {
|
||||
throw new Test262Error("#6: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
assert.sameValue(Math.round(x), x, 'Math.round(-(1.5 / Number.EPSILON - 1)) returns x');
|
||||
|
||||
// CHECK#7
|
||||
x = -(1 / Number.EPSILON + 1);
|
||||
if (Math.round(x) !== x) {
|
||||
throw new Test262Error("#7: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
assert.sameValue(Math.round(x), x, 'Math.round(-(1 / Number.EPSILON + 1)) returns x');
|
||||
|
||||
// CHECK#8
|
||||
x = 1 / Number.EPSILON + 1;
|
||||
if (Math.round(x) !== x) {
|
||||
throw new Test262Error("#8: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
assert.sameValue(Math.round(x), x, 'Math.round(1 / Number.EPSILON + 1) returns x');
|
||||
|
||||
// CHECK#9
|
||||
x = 1.5 / Number.EPSILON - 1;
|
||||
if (Math.round(x) !== x) {
|
||||
throw new Test262Error("#9: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
assert.sameValue(Math.round(x), x, 'Math.round(1.5 / Number.EPSILON - 1) returns x');
|
||||
|
||||
// CHECK#10
|
||||
x = 2 / Number.EPSILON - 1;
|
||||
if (Math.round(x) !== x) {
|
||||
throw new Test262Error("#10: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
assert.sameValue(Math.round(x), x, 'Math.round(2 / Number.EPSILON - 1) returns x');
|
||||
|
|
|
@ -9,7 +9,4 @@ description: Checking if Math.sqrt(+Infinity) is +Infinity
|
|||
|
||||
// CHECK#1
|
||||
var x = +Infinity;
|
||||
if (Math.sqrt(x) !== +Infinity)
|
||||
{
|
||||
throw new Test262Error("#1: 'var x=+Infinity; Math.sqrt(x) !== +Infinity'");
|
||||
}
|
||||
assert.sameValue(Math.sqrt(x), +Infinity, 'Math.sqrt(+Infinity) must return +Infinity');
|
||||
|
|
Loading…
Reference in New Issue