diff --git a/test/built-ins/Math/abs/S15.8.2.1_A3.js b/test/built-ins/Math/abs/S15.8.2.1_A3.js index e726ceb8d7..59eebf6543 100644 --- a/test/built-ins/Math/abs/S15.8.2.1_A3.js +++ b/test/built-ins/Math/abs/S15.8.2.1_A3.js @@ -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'); diff --git a/test/built-ins/Math/ceil/S15.8.2.6_A4.js b/test/built-ins/Math/ceil/S15.8.2.6_A4.js index 697db99d0a..036ff0b936 100644 --- a/test/built-ins/Math/ceil/S15.8.2.6_A4.js +++ b/test/built-ins/Math/ceil/S15.8.2.6_A4.js @@ -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'); diff --git a/test/built-ins/Math/ceil/S15.8.2.6_A5.js b/test/built-ins/Math/ceil/S15.8.2.6_A5.js index 3e99ec0601..7e6f2a0d80 100644 --- a/test/built-ins/Math/ceil/S15.8.2.6_A5.js +++ b/test/built-ins/Math/ceil/S15.8.2.6_A5.js @@ -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'); diff --git a/test/built-ins/Math/ceil/S15.8.2.6_A7.js b/test/built-ins/Math/ceil/S15.8.2.6_A7.js index d8f7c7a348..efb5e265cb 100644 --- a/test/built-ins/Math/ceil/S15.8.2.6_A7.js +++ b/test/built-ins/Math/ceil/S15.8.2.6_A7.js @@ -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)'); } diff --git a/test/built-ins/Math/cos/S15.8.2.7_A2.js b/test/built-ins/Math/cos/S15.8.2.7_A2.js index 01c9382d8f..9dbdeca4ac 100644 --- a/test/built-ins/Math/cos/S15.8.2.7_A2.js +++ b/test/built-ins/Math/cos/S15.8.2.7_A2.js @@ -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'); diff --git a/test/built-ins/Math/cos/S15.8.2.7_A3.js b/test/built-ins/Math/cos/S15.8.2.7_A3.js index fda964e414..388b541dbb 100644 --- a/test/built-ins/Math/cos/S15.8.2.7_A3.js +++ b/test/built-ins/Math/cos/S15.8.2.7_A3.js @@ -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'); diff --git a/test/built-ins/Math/exp/S15.8.2.8_A2.js b/test/built-ins/Math/exp/S15.8.2.8_A2.js index e029015d49..c560fddc97 100644 --- a/test/built-ins/Math/exp/S15.8.2.8_A2.js +++ b/test/built-ins/Math/exp/S15.8.2.8_A2.js @@ -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'); diff --git a/test/built-ins/Math/exp/S15.8.2.8_A3.js b/test/built-ins/Math/exp/S15.8.2.8_A3.js index f321f12e32..dabd4236c0 100644 --- a/test/built-ins/Math/exp/S15.8.2.8_A3.js +++ b/test/built-ins/Math/exp/S15.8.2.8_A3.js @@ -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'); diff --git a/test/built-ins/Math/exp/S15.8.2.8_A4.js b/test/built-ins/Math/exp/S15.8.2.8_A4.js index dc11e752bc..5894a19589 100644 --- a/test/built-ins/Math/exp/S15.8.2.8_A4.js +++ b/test/built-ins/Math/exp/S15.8.2.8_A4.js @@ -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'); diff --git a/test/built-ins/Math/floor/S15.8.2.9_A4.js b/test/built-ins/Math/floor/S15.8.2.9_A4.js index 7fb6639207..50a8c211bc 100644 --- a/test/built-ins/Math/floor/S15.8.2.9_A4.js +++ b/test/built-ins/Math/floor/S15.8.2.9_A4.js @@ -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'); diff --git a/test/built-ins/Math/floor/S15.8.2.9_A5.js b/test/built-ins/Math/floor/S15.8.2.9_A5.js index 1aaa8725f8..6451fdc039 100644 --- a/test/built-ins/Math/floor/S15.8.2.9_A5.js +++ b/test/built-ins/Math/floor/S15.8.2.9_A5.js @@ -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'); diff --git a/test/built-ins/Math/floor/S15.8.2.9_A7.js b/test/built-ins/Math/floor/S15.8.2.9_A7.js index e1d6a30a36..dae8e5a7b6 100644 --- a/test/built-ins/Math/floor/S15.8.2.9_A7.js +++ b/test/built-ins/Math/floor/S15.8.2.9_A7.js @@ -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)' + ); } diff --git a/test/built-ins/Math/log/S15.8.2.10_A3.js b/test/built-ins/Math/log/S15.8.2.10_A3.js index acd08dd61a..5151cc8783 100644 --- a/test/built-ins/Math/log/S15.8.2.10_A3.js +++ b/test/built-ins/Math/log/S15.8.2.10_A3.js @@ -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'); diff --git a/test/built-ins/Math/log/S15.8.2.10_A5.js b/test/built-ins/Math/log/S15.8.2.10_A5.js index db6debc73c..f8b5b00b41 100644 --- a/test/built-ins/Math/log/S15.8.2.10_A5.js +++ b/test/built-ins/Math/log/S15.8.2.10_A5.js @@ -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'); diff --git a/test/built-ins/Math/max/S15.8.2.11_A1.js b/test/built-ins/Math/max/S15.8.2.11_A1.js index daa6ed6421..b34c8a5e16 100644 --- a/test/built-ins/Math/max/S15.8.2.11_A1.js +++ b/test/built-ins/Math/max/S15.8.2.11_A1.js @@ -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'); diff --git a/test/built-ins/Math/max/S15.8.2.11_A4.js b/test/built-ins/Math/max/S15.8.2.11_A4.js index a777283f6f..6f393c97b3 100644 --- a/test/built-ins/Math/max/S15.8.2.11_A4.js +++ b/test/built-ins/Math/max/S15.8.2.11_A4.js @@ -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'); diff --git a/test/built-ins/Math/min/S15.8.2.12_A1.js b/test/built-ins/Math/min/S15.8.2.12_A1.js index 2551934700..41e4fb2cf3 100644 --- a/test/built-ins/Math/min/S15.8.2.12_A1.js +++ b/test/built-ins/Math/min/S15.8.2.12_A1.js @@ -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'); diff --git a/test/built-ins/Math/min/S15.8.2.12_A4.js b/test/built-ins/Math/min/S15.8.2.12_A4.js index 8d8ee272ee..7807a30c70 100644 --- a/test/built-ins/Math/min/S15.8.2.12_A4.js +++ b/test/built-ins/Math/min/S15.8.2.12_A4.js @@ -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'); diff --git a/test/built-ins/Math/round/S15.8.2.15_A4.js b/test/built-ins/Math/round/S15.8.2.15_A4.js index 5cea0f4424..a1544e737b 100644 --- a/test/built-ins/Math/round/S15.8.2.15_A4.js +++ b/test/built-ins/Math/round/S15.8.2.15_A4.js @@ -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'); diff --git a/test/built-ins/Math/round/S15.8.2.15_A5.js b/test/built-ins/Math/round/S15.8.2.15_A5.js index 7b5577db4f..58009ee8f7 100644 --- a/test/built-ins/Math/round/S15.8.2.15_A5.js +++ b/test/built-ins/Math/round/S15.8.2.15_A5.js @@ -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'); diff --git a/test/built-ins/Math/round/S15.8.2.15_A6.js b/test/built-ins/Math/round/S15.8.2.15_A6.js index bde1582d4e..5a3bd6a3af 100644 --- a/test/built-ins/Math/round/S15.8.2.15_A6.js +++ b/test/built-ins/Math/round/S15.8.2.15_A6.js @@ -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)' + ); } diff --git a/test/built-ins/Math/round/S15.8.2.15_A7.js b/test/built-ins/Math/round/S15.8.2.15_A7.js index 6530f0c85f..c96adb89fb 100644 --- a/test/built-ins/Math/round/S15.8.2.15_A7.js +++ b/test/built-ins/Math/round/S15.8.2.15_A7.js @@ -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'); diff --git a/test/built-ins/Math/sqrt/S15.8.2.17_A5.js b/test/built-ins/Math/sqrt/S15.8.2.17_A5.js index 6da33bd395..7c224ee30e 100644 --- a/test/built-ins/Math/sqrt/S15.8.2.17_A5.js +++ b/test/built-ins/Math/sqrt/S15.8.2.17_A5.js @@ -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');