From 33a7e03a768bd2480fda976700eae804310dddaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 6 Aug 2015 18:26:07 +0200 Subject: [PATCH] Replace runTestCase with assert helpers [test/built-ins/Math] --- test/built-ins/Math/clz32/Math.clz32.js | 8 +------- test/built-ins/Math/clz32/Math.clz32_1.js | 8 +------- test/built-ins/Math/clz32/Math.clz32_2.js | 8 +------- test/built-ins/Math/fround/Math.fround_Infinity.js | 8 +------- test/built-ins/Math/fround/Math.fround_NaN.js | 8 +------- test/built-ins/Math/fround/Math.fround_Zero.js | 8 +------- test/built-ins/Math/hypot/Math.hypot_Infinity.js | 8 +------- test/built-ins/Math/hypot/Math.hypot_InfinityNaN.js | 8 +------- test/built-ins/Math/hypot/Math.hypot_NaN.js | 8 +------- test/built-ins/Math/hypot/Math.hypot_NegInfinity.js | 8 +------- test/built-ins/Math/hypot/Math.hypot_NoArgs.js | 8 +------- test/built-ins/Math/hypot/Math.hypot_Success.js | 8 +------- test/built-ins/Math/hypot/Math.hypot_Success_2.js | 8 +------- test/built-ins/Math/hypot/Math.hypot_Zero_2.js | 8 +------- test/built-ins/Math/hypot/Math.hypot_lengthProp.js | 8 +------- test/built-ins/Math/trunc/Math.trunc_Infinity.js | 8 +------- test/built-ins/Math/trunc/Math.trunc_NaN.js | 8 +------- test/built-ins/Math/trunc/Math.trunc_NegDecimal.js | 10 ++-------- test/built-ins/Math/trunc/Math.trunc_PosDecimal.js | 8 +------- test/built-ins/Math/trunc/Math.trunc_Success.js | 8 +------- test/built-ins/Math/trunc/Math.trunc_Zero.js | 8 +------- 21 files changed, 22 insertions(+), 148 deletions(-) diff --git a/test/built-ins/Math/clz32/Math.clz32.js b/test/built-ins/Math/clz32/Math.clz32.js index 0be6a84e64..f30b3a995b 100644 --- a/test/built-ins/Math/clz32/Math.clz32.js +++ b/test/built-ins/Math/clz32/Math.clz32.js @@ -5,12 +5,6 @@ es6id: 20.2.2.11 author: Ryan Lewis description: Math.clz32 should return 32 if passed 0. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.clz32(0) === 32) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.clz32(0), 32, 'Math.clz32(0)'); diff --git a/test/built-ins/Math/clz32/Math.clz32_1.js b/test/built-ins/Math/clz32/Math.clz32_1.js index 77a06c3bd9..3b571a737d 100644 --- a/test/built-ins/Math/clz32/Math.clz32_1.js +++ b/test/built-ins/Math/clz32/Math.clz32_1.js @@ -5,12 +5,6 @@ es6id: 20.2.2.11 author: Ryan Lewis description: Math.clz32 should return 31 if passed 1. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.clz32(1) === 31) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.clz32(1), 31, 'Math.clz32(1)'); diff --git a/test/built-ins/Math/clz32/Math.clz32_2.js b/test/built-ins/Math/clz32/Math.clz32_2.js index 29859bc2f3..65c65deac3 100644 --- a/test/built-ins/Math/clz32/Math.clz32_2.js +++ b/test/built-ins/Math/clz32/Math.clz32_2.js @@ -5,12 +5,6 @@ es6id: 20.2.2.11 author: Ryan Lewis description: Math.clz32 should return 0 if passed 2147483648 -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.clz32(2147483648) === 0) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.clz32(2147483648), 0, 'Math.clz32(2147483648)'); diff --git a/test/built-ins/Math/fround/Math.fround_Infinity.js b/test/built-ins/Math/fround/Math.fround_Infinity.js index b4f513796a..b59e40873b 100644 --- a/test/built-ins/Math/fround/Math.fround_Infinity.js +++ b/test/built-ins/Math/fround/Math.fround_Infinity.js @@ -5,12 +5,6 @@ es6id: 20.2.2.17 author: Ryan Lewis description: Math.fround should return Infinity if called with Infinity. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.fround(Infinity) === Infinity) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.fround(Infinity), Infinity, 'Math.fround(Infinity)'); diff --git a/test/built-ins/Math/fround/Math.fround_NaN.js b/test/built-ins/Math/fround/Math.fround_NaN.js index b266b1f2e7..6023333373 100644 --- a/test/built-ins/Math/fround/Math.fround_NaN.js +++ b/test/built-ins/Math/fround/Math.fround_NaN.js @@ -5,12 +5,6 @@ es6id: 20.2.2.17 author: Ryan Lewis description: Math.fround should return NaN if called with NaN. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Number.isNaN(Math.fround(NaN))) { - return true; - } - } -runTestCase(testcase); +assert(Number.isNaN(Math.fround(NaN)), 'Number.isNaN(Math.fround(NaN)) !== true'); diff --git a/test/built-ins/Math/fround/Math.fround_Zero.js b/test/built-ins/Math/fround/Math.fround_Zero.js index a9d358017e..b6864fe421 100644 --- a/test/built-ins/Math/fround/Math.fround_Zero.js +++ b/test/built-ins/Math/fround/Math.fround_Zero.js @@ -5,12 +5,6 @@ es6id: 20.2.2.17 author: Ryan Lewis description: Math.fround should return 0 if called with 0. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.fround(0) === 0) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.fround(0), 0, 'Math.fround(0)'); diff --git a/test/built-ins/Math/hypot/Math.hypot_Infinity.js b/test/built-ins/Math/hypot/Math.hypot_Infinity.js index 4457cdd821..f20b98fe7e 100644 --- a/test/built-ins/Math/hypot/Math.hypot_Infinity.js +++ b/test/built-ins/Math/hypot/Math.hypot_Infinity.js @@ -7,12 +7,6 @@ author: Ryan Lewis description: > Math.hypot should return Infinity if called with any argument that is Infinity. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.hypot(3, Infinity) === Infinity) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.hypot(3, Infinity), Infinity, 'Math.hypot(3, Infinity)'); diff --git a/test/built-ins/Math/hypot/Math.hypot_InfinityNaN.js b/test/built-ins/Math/hypot/Math.hypot_InfinityNaN.js index 798186153b..f87c222f74 100644 --- a/test/built-ins/Math/hypot/Math.hypot_InfinityNaN.js +++ b/test/built-ins/Math/hypot/Math.hypot_InfinityNaN.js @@ -7,12 +7,6 @@ author: Ryan Lewis description: > Math.hypot should return Infinity if called with any argument that is Infinity. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.hypot(NaN, Infinity) === Infinity) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.hypot(NaN, Infinity), Infinity, 'Math.hypot(NaN, Infinity)'); diff --git a/test/built-ins/Math/hypot/Math.hypot_NaN.js b/test/built-ins/Math/hypot/Math.hypot_NaN.js index f69404e3d2..0f29e79ae7 100644 --- a/test/built-ins/Math/hypot/Math.hypot_NaN.js +++ b/test/built-ins/Math/hypot/Math.hypot_NaN.js @@ -7,12 +7,6 @@ author: Ryan Lewis description: > Math.hypot should return NaN if called with any argument that is NaN. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Number.isNaN(Math.hypot(NaN, 3))) { - return true; - } - } -runTestCase(testcase); +assert(Number.isNaN(Math.hypot(NaN, 3)), 'Number.isNaN(Math.hypot(NaN, 3)) !== true'); diff --git a/test/built-ins/Math/hypot/Math.hypot_NegInfinity.js b/test/built-ins/Math/hypot/Math.hypot_NegInfinity.js index 14c3fb534b..c28083db02 100644 --- a/test/built-ins/Math/hypot/Math.hypot_NegInfinity.js +++ b/test/built-ins/Math/hypot/Math.hypot_NegInfinity.js @@ -7,12 +7,6 @@ author: Ryan Lewis description: > Math.hypot should return Infinity if called with any argument that is -Infinity. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.hypot(3, -Infinity) === Infinity) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.hypot(3, -Infinity), Infinity, 'Math.hypot(3, -Infinity)'); diff --git a/test/built-ins/Math/hypot/Math.hypot_NoArgs.js b/test/built-ins/Math/hypot/Math.hypot_NoArgs.js index 75a4b1ca5e..164a9aa38f 100644 --- a/test/built-ins/Math/hypot/Math.hypot_NoArgs.js +++ b/test/built-ins/Math/hypot/Math.hypot_NoArgs.js @@ -5,12 +5,6 @@ es6id: 20.2.2.18 author: Ryan Lewis description: Math.hypot should return 0 if called with no arguments. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.hypot() === 0) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.hypot(), 0, 'Math.hypot()'); diff --git a/test/built-ins/Math/hypot/Math.hypot_Success.js b/test/built-ins/Math/hypot/Math.hypot_Success.js index e341b053b7..02d7fc7e38 100644 --- a/test/built-ins/Math/hypot/Math.hypot_Success.js +++ b/test/built-ins/Math/hypot/Math.hypot_Success.js @@ -5,12 +5,6 @@ es6id: 20.2.2.18 author: Ryan Lewis description: Math.hypot should return 4 if called with 3 and 2.6457513110645907. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.hypot(3,2.6457513110645907) === 4) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.hypot(3,2.6457513110645907), 4, 'Math.hypot(3,2.6457513110645907)'); diff --git a/test/built-ins/Math/hypot/Math.hypot_Success_2.js b/test/built-ins/Math/hypot/Math.hypot_Success_2.js index d7354b5d45..4106a0a777 100644 --- a/test/built-ins/Math/hypot/Math.hypot_Success_2.js +++ b/test/built-ins/Math/hypot/Math.hypot_Success_2.js @@ -5,12 +5,6 @@ es6id: 20.2.2.18 author: Ryan Lewis description: Math.hypot should return 5 if called with 3 and 4. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.hypot(3,4) === 5) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.hypot(3,4), 5, 'Math.hypot(3,4)'); diff --git a/test/built-ins/Math/hypot/Math.hypot_Zero_2.js b/test/built-ins/Math/hypot/Math.hypot_Zero_2.js index 75a5d1c832..0a33737cbe 100644 --- a/test/built-ins/Math/hypot/Math.hypot_Zero_2.js +++ b/test/built-ins/Math/hypot/Math.hypot_Zero_2.js @@ -5,12 +5,6 @@ es6id: 20.2.2.18 author: Ryan Lewis description: Math.hypot should return 0 if called with all arguments being 0. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.hypot(0, 0) === 0) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.hypot(0, 0), 0, 'Math.hypot(0, 0)'); diff --git a/test/built-ins/Math/hypot/Math.hypot_lengthProp.js b/test/built-ins/Math/hypot/Math.hypot_lengthProp.js index d213617a22..1bafa47549 100644 --- a/test/built-ins/Math/hypot/Math.hypot_lengthProp.js +++ b/test/built-ins/Math/hypot/Math.hypot_lengthProp.js @@ -5,12 +5,6 @@ es6id: 20.2.2.18 author: Ryan Lewis description: Math.hypot.length should return 2. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.hypot.length === 2) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.hypot.length, 2, 'Math.hypot.length'); diff --git a/test/built-ins/Math/trunc/Math.trunc_Infinity.js b/test/built-ins/Math/trunc/Math.trunc_Infinity.js index 6d5f8fe918..6a9abb4272 100644 --- a/test/built-ins/Math/trunc/Math.trunc_Infinity.js +++ b/test/built-ins/Math/trunc/Math.trunc_Infinity.js @@ -5,12 +5,6 @@ es6id: 20.2.2.35 author: Ryan Lewis description: Math.trunc should return Infinity when called with Infinity. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.trunc(.9) === 0) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.trunc(.9), 0, 'Math.trunc(.9)'); diff --git a/test/built-ins/Math/trunc/Math.trunc_NaN.js b/test/built-ins/Math/trunc/Math.trunc_NaN.js index e7793128be..485b532177 100644 --- a/test/built-ins/Math/trunc/Math.trunc_NaN.js +++ b/test/built-ins/Math/trunc/Math.trunc_NaN.js @@ -5,12 +5,6 @@ es6id: 20.2.2.35 author: Ryan Lewis description: Math.trunc should return NaN when called with NaN. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Number.isNaN(Math.trunc(NaN))) { - return true; - } - } -runTestCase(testcase); +assert(Number.isNaN(Math.trunc(NaN)), 'Number.isNaN(Math.trunc(NaN)) !== true'); diff --git a/test/built-ins/Math/trunc/Math.trunc_NegDecimal.js b/test/built-ins/Math/trunc/Math.trunc_NegDecimal.js index 59b5e9ee15..3c543e3293 100644 --- a/test/built-ins/Math/trunc/Math.trunc_NegDecimal.js +++ b/test/built-ins/Math/trunc/Math.trunc_NegDecimal.js @@ -4,13 +4,7 @@ /*--- es6id: 20.2.2.35 author: Ryan Lewis -description: Math.trunc should return 0 if called with a value between 0 and -1. -includes: [runTestCase.js] +description: Math.trunc should return -0 if called with a value between 0 and -1. ---*/ -function testcase() { - if(Math.trunc(-.9) === 0) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.trunc(-.9), -0, 'Math.trunc(-.9)'); diff --git a/test/built-ins/Math/trunc/Math.trunc_PosDecimal.js b/test/built-ins/Math/trunc/Math.trunc_PosDecimal.js index 537bdd5af7..5efecccccd 100644 --- a/test/built-ins/Math/trunc/Math.trunc_PosDecimal.js +++ b/test/built-ins/Math/trunc/Math.trunc_PosDecimal.js @@ -5,12 +5,6 @@ es6id: 20.2.2.35 author: Ryan Lewis description: Math.trunc should return 0 if called with a value between 0 and 1. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.trunc(.9) === 0) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.trunc(.9), 0, 'Math.trunc(.9)'); diff --git a/test/built-ins/Math/trunc/Math.trunc_Success.js b/test/built-ins/Math/trunc/Math.trunc_Success.js index ba75251755..f035290e4c 100644 --- a/test/built-ins/Math/trunc/Math.trunc_Success.js +++ b/test/built-ins/Math/trunc/Math.trunc_Success.js @@ -5,12 +5,6 @@ es6id: 20.2.2.35 author: Ryan Lewis description: Math.trunc should return 4578 if called with 4578.584949 -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.trunc(4578.584949) === 4578) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.trunc(4578.584949), 4578, 'Math.trunc(4578.584949)'); diff --git a/test/built-ins/Math/trunc/Math.trunc_Zero.js b/test/built-ins/Math/trunc/Math.trunc_Zero.js index 847046863b..3101668f44 100644 --- a/test/built-ins/Math/trunc/Math.trunc_Zero.js +++ b/test/built-ins/Math/trunc/Math.trunc_Zero.js @@ -5,12 +5,6 @@ es6id: 20.2.2.35 author: Ryan Lewis description: Math.trunc should return 0 when called with 0. -includes: [runTestCase.js] ---*/ -function testcase() { - if(Math.trunc(0) === 0) { - return true; - } - } -runTestCase(testcase); +assert.sameValue(Math.trunc(0), 0, 'Math.trunc(0)');