mirror of https://github.com/tc39/test262.git
chore: migrate $ERROR -> throw new Test262Error in test/built-ins/Math (#3088)
This commit is contained in:
parent
a101757ca1
commit
e4c53bef51
|
@ -11,5 +11,5 @@ description: Checking if Math.abs(-Infinity) equals to +Infinity
|
|||
var x = -Infinity;
|
||||
if (Math.abs(x) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x=-Infinity; Math.abs(x) !== +Infinity'");
|
||||
throw new Test262Error("#1: 'var x=-Infinity; Math.abs(x) !== +Infinity'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.ceil(x) is +Infinity, where x is +Infinity
|
|||
var x = +Infinity;
|
||||
if (Math.ceil(x) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x = +Infinity; Math.ceil(x) !== +Infinity'");
|
||||
throw new Test262Error("#1: 'var x = +Infinity; Math.ceil(x) !== +Infinity'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.ceil(x) is -Infinity, where x is -Infinity
|
|||
var x = -Infinity;
|
||||
if (Math.ceil(x) !== -Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x = -Infinity; Math.ceil(x) !== -Infinity'");
|
||||
throw new Test262Error("#1: 'var x = -Infinity; Math.ceil(x) !== -Infinity'");
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@ for (var i = -1000; i < 1000; i++)
|
|||
var x = i / 10.0;
|
||||
if (Math.ceil(x) !== -Math.floor(-x))
|
||||
{
|
||||
$ERROR("#1: 'x = " + x + "; Math.ceil(x) !== -Math.floor(-x)'");
|
||||
throw new Test262Error("#1: 'x = " + x + "; Math.ceil(x) !== -Math.floor(-x)'");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.cos(+0) is 1
|
|||
var x = +0;
|
||||
if (Math.cos(x) !== 1)
|
||||
{
|
||||
$ERROR("#1: 'var x = +0; Math.cos(x) !== 1'");
|
||||
throw new Test262Error("#1: 'var x = +0; Math.cos(x) !== 1'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.cos(-0) is 1
|
|||
var x = -0;
|
||||
if (Math.cos(x) !== 1)
|
||||
{
|
||||
$ERROR("#1: 'var x = -0; Math.cos(x) !== 1'");
|
||||
throw new Test262Error("#1: 'var x = -0; Math.cos(x) !== 1'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.exp(+0) is 1
|
|||
var x = +0;
|
||||
if (Math.exp(x) !== 1)
|
||||
{
|
||||
$ERROR("#1: 'var x = +0; Math.exp(x) !== 1'");
|
||||
throw new Test262Error("#1: 'var x = +0; Math.exp(x) !== 1'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.exp(-0) is 1
|
|||
var x = -0;
|
||||
if (Math.exp(x) !== 1)
|
||||
{
|
||||
$ERROR("#1: 'var x = -0; Math.exp(x) !== 1'");
|
||||
throw new Test262Error("#1: 'var x = -0; Math.exp(x) !== 1'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.exp(+Infinity) is +Ifinity
|
|||
var x = +Infinity;
|
||||
if (Math.exp(x) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x = +Infinity; Math.exp(x) !== +Infinity'");
|
||||
throw new Test262Error("#1: 'var x = +Infinity; Math.exp(x) !== +Infinity'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.floor(x) is +Infinity, where x is +Infinity
|
|||
var x = +Infinity;
|
||||
if (Math.floor(x) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x = +Infinity; Math.floor(x) !== +Infinity'");
|
||||
throw new Test262Error("#1: 'var x = +Infinity; Math.floor(x) !== +Infinity'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.floor(x) is -Infinity, where x is -Infinity
|
|||
var x = -Infinity;
|
||||
if (Math.floor(x) !== -Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x = -Infinity; Math.floor(x) !== -Infinity'");
|
||||
throw new Test262Error("#1: 'var x = -Infinity; Math.floor(x) !== -Infinity'");
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@ for (var i = -1000; i < 1000; i++)
|
|||
var x = i / 10.0;
|
||||
if (-Math.ceil(-x) !== Math.floor(x))
|
||||
{
|
||||
$ERROR("#1: 'x = " + x + "; Math.floor(x) !== -Math.ceil(-x)'");
|
||||
throw new Test262Error("#1: 'x = " + x + "; Math.floor(x) !== -Math.ceil(-x)'");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@ description: Checking if Math.log(+0) and Math.log(-0) equals to -Infinity
|
|||
var x = +0;
|
||||
if (Math.log(x) !== -Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x=+0; Math.log(x) !== -Infinity'");
|
||||
throw new Test262Error("#1: 'var x=+0; Math.log(x) !== -Infinity'");
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
var x = -0;
|
||||
if (Math.log(x) !== -Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x=-0; Math.log(x) !== -Infinity'");
|
||||
throw new Test262Error("#1: 'var x=-0; Math.log(x) !== -Infinity'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.log(+Infinity) equals to +Infinity
|
|||
var x = +Infinity;
|
||||
if (Math.log(x) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x=+Infinity; Math.log(x) !== +Infinity'");
|
||||
throw new Test262Error("#1: 'var x=+Infinity; Math.log(x) !== +Infinity'");
|
||||
}
|
||||
|
|
|
@ -10,5 +10,5 @@ description: Checking if Math.max() equals to -Infinity
|
|||
// CHECK#1
|
||||
if (Math.max() != -Infinity)
|
||||
{
|
||||
$ERROR("#1: 'Math.max() != -Infinity'");
|
||||
throw new Test262Error("#1: 'Math.max() != -Infinity'");
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ description: Checking if Math.max.length property is defined and equals to 2
|
|||
|
||||
// CHECK#1
|
||||
if (typeof Math.max !== "function") {
|
||||
$ERROR('#1: Math.max method is not defined');
|
||||
throw new Test262Error('#1: Math.max method is not defined');
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
if (typeof Math.max.length === "undefined") {
|
||||
$ERROR('#2: length property of Math.max method is undefined');
|
||||
throw new Test262Error('#2: length property of Math.max method is undefined');
|
||||
}
|
||||
|
||||
// CHECK#3
|
||||
if (Math.max.length !== 2) {
|
||||
$ERROR('#3: The length property of the Math.max method is not 2');
|
||||
throw new Test262Error('#3: The length property of the Math.max method is not 2');
|
||||
}
|
||||
|
|
|
@ -10,5 +10,5 @@ description: Checking if Math.min() equals to +Infinity
|
|||
// CHECK#1
|
||||
if (Math.min() != +Infinity)
|
||||
{
|
||||
$ERROR("#1: 'Math.min() != +Infinity'");
|
||||
throw new Test262Error("#1: 'Math.min() != +Infinity'");
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ description: Checking if Math.min.length property is defined and equals to 2
|
|||
|
||||
// CHECK#1
|
||||
if (typeof Math.min !== "function") {
|
||||
$ERROR('#1: Math.min method is not defined');
|
||||
throw new Test262Error('#1: Math.min method is not defined');
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
if (typeof Math.min.length === "undefined") {
|
||||
$ERROR('#2: length property of Math.min method is undefined');
|
||||
throw new Test262Error('#2: length property of Math.min method is undefined');
|
||||
}
|
||||
|
||||
// CHECK#3
|
||||
if (Math.min.length !== 2) {
|
||||
$ERROR('#3: The length property of the Math.min method is not 2');
|
||||
throw new Test262Error('#3: The length property of the Math.min method is not 2');
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ var basenum = 6;
|
|||
|
||||
for (var i = 0; i < basenum; i++) {
|
||||
if (Math.pow(base[i], exponent) !== +Infinity) {
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity");
|
||||
throw new Test262Error("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,6 @@ var exponentnum = 4;
|
|||
|
||||
for (var i = 0; i < exponentnum; i++) {
|
||||
if (Math.pow(base, exponent[i]) !== +Infinity) {
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,6 @@ var exponentnum = 3;
|
|||
|
||||
for (var i = 0; i < exponentnum; i++) {
|
||||
if (Math.pow(base, exponent[i]) !== -Infinity) {
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity");
|
||||
throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,6 @@ var exponentnum = 5;
|
|||
|
||||
for (var i = 0; i < exponentnum; i++) {
|
||||
if (Math.pow(base, exponent[i]) !== +Infinity) {
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,6 @@ var exponentnum = 4;
|
|||
|
||||
for (var i = 0; i < exponentnum; i++) {
|
||||
if (Math.pow(base, exponent[i]) !== +Infinity) {
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ var basenum = 9;
|
|||
|
||||
for (var i = 0; i < basenum; i++) {
|
||||
if (Math.pow(base[i], exponent) !== 1) {
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== 1");
|
||||
throw new Test262Error("#1: Math.pow(" + base[i] + ", " + exponent + ") !== 1");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,6 @@ var exponentnum = 3;
|
|||
|
||||
for (var i = 0; i < exponentnum; i++) {
|
||||
if (Math.pow(base, exponent[i]) !== -Infinity) {
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity");
|
||||
throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,6 @@ var exponentnum = 5;
|
|||
|
||||
for (var i = 0; i < exponentnum; i++) {
|
||||
if (Math.pow(base, exponent[i]) !== +Infinity) {
|
||||
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ var basenum = 9;
|
|||
|
||||
for (var i = 0; i < basenum; i++) {
|
||||
if (Math.pow(base[i], exponent) !== 1) {
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", -0) !== 1");
|
||||
throw new Test262Error("#1: Math.pow(" + base[i] + ", -0) !== 1");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ var basenum = 6;
|
|||
|
||||
for (var i = 0; i < basenum; i++) {
|
||||
if (Math.pow(base[i], exponent) !== +Infinity) {
|
||||
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity");
|
||||
throw new Test262Error("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,6 @@ for (var i = 0; i < 100; i++)
|
|||
|
||||
if (val < 0 || val >= 1)
|
||||
{
|
||||
$ERROR("#1: Math.random() = " + val);
|
||||
throw new Test262Error("#1: Math.random() = " + val);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.round(x) is +Infinity, where x is +Infinity
|
|||
var x = +Infinity;
|
||||
if (Math.round(x) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x=+Infinity; Math.round(x) !== +Infinity'");
|
||||
throw new Test262Error("#1: 'var x=+Infinity; Math.round(x) !== +Infinity'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.round(x) is -Infinity, where x is -Infinity
|
|||
var x = -Infinity;
|
||||
if (Math.round(x) !== -Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x=-Infinity; Math.round(x) !== -Infinity'");
|
||||
throw new Test262Error("#1: 'var x=-Infinity; Math.round(x) !== -Infinity'");
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ for (var i = 0; i <= 1000; i++)
|
|||
var x = i / 10.0;
|
||||
if (Math.round(x) !== Math.floor(x + 0.5))
|
||||
{
|
||||
$ERROR("#1: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'")
|
||||
throw new Test262Error("#1: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,6 @@ for (i = -5; i >= -1000; i--)
|
|||
|
||||
if (Math.round(x) !== Math.floor(x + 0.5))
|
||||
{
|
||||
$ERROR("#2: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'")
|
||||
throw new Test262Error("#2: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,17 +16,17 @@ description: >
|
|||
|
||||
// CHECK#1
|
||||
if (1 / Math.round(-0.5) !== 1 / -0) {
|
||||
$ERROR("#1: '1 / Math.round(-0.5) !== 1 / -0'");
|
||||
throw new Test262Error("#1: '1 / Math.round(-0.5) !== 1 / -0'");
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
if (1 / Math.round(-0.25) !== 1 / -0) {
|
||||
$ERROR("#2: '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) {
|
||||
$ERROR("#3: '1 / Math.round(-0) !== 1 / -0'");
|
||||
throw new Test262Error("#3: '1 / Math.round(-0) !== 1 / -0'");
|
||||
}
|
||||
|
||||
var x = 0;
|
||||
|
@ -34,41 +34,41 @@ var x = 0;
|
|||
// CHECK#4
|
||||
x = 0.5 - Number.EPSILON / 4;
|
||||
if (1 / Math.round(x) !== 1 / 0) {
|
||||
$ERROR("#4: '1 / Math.round(" + x + ") !== 1 / 0'");
|
||||
throw new Test262Error("#4: '1 / Math.round(" + x + ") !== 1 / 0'");
|
||||
}
|
||||
|
||||
// CHECK#5
|
||||
x = -(2 / Number.EPSILON - 1);
|
||||
if (Math.round(x) !== x) {
|
||||
$ERROR("#5: 'Math.round(" + x + ") !== " + x + "'");
|
||||
throw new Test262Error("#5: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
|
||||
// CHECK#6
|
||||
x = -(1.5 / Number.EPSILON - 1);
|
||||
if (Math.round(x) !== x) {
|
||||
$ERROR("#6: 'Math.round(" + x + ") !== " + x + "'");
|
||||
throw new Test262Error("#6: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
|
||||
// CHECK#7
|
||||
x = -(1 / Number.EPSILON + 1);
|
||||
if (Math.round(x) !== x) {
|
||||
$ERROR("#7: 'Math.round(" + x + ") !== " + x + "'");
|
||||
throw new Test262Error("#7: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
|
||||
// CHECK#8
|
||||
x = 1 / Number.EPSILON + 1;
|
||||
if (Math.round(x) !== x) {
|
||||
$ERROR("#8: 'Math.round(" + x + ") !== " + x + "'");
|
||||
throw new Test262Error("#8: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
|
||||
// CHECK#9
|
||||
x = 1.5 / Number.EPSILON - 1;
|
||||
if (Math.round(x) !== x) {
|
||||
$ERROR("#9: 'Math.round(" + x + ") !== " + x + "'");
|
||||
throw new Test262Error("#9: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
|
||||
// CHECK#10
|
||||
x = 2 / Number.EPSILON - 1;
|
||||
if (Math.round(x) !== x) {
|
||||
$ERROR("#10: 'Math.round(" + x + ") !== " + x + "'");
|
||||
throw new Test262Error("#10: 'Math.round(" + x + ") !== " + x + "'");
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ description: Checking if Math.sqrt(+Infinity) is +Infinity
|
|||
var x = +Infinity;
|
||||
if (Math.sqrt(x) !== +Infinity)
|
||||
{
|
||||
$ERROR("#1: 'var x=+Infinity; Math.sqrt(x) !== +Infinity'");
|
||||
throw new Test262Error("#1: 'var x=+Infinity; Math.sqrt(x) !== +Infinity'");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue