From 080afac9060501c1dc5aa4cf78c410c04d858147 Mon Sep 17 00:00:00 2001 From: Leonardo Balter Date: Wed, 22 Jun 2016 19:31:42 -0400 Subject: [PATCH] Update tests for Math.{sign,sin,trunc} --- test/built-ins/Math/sign/sign-specialVals.js | 20 ++++++++++++------- .../Math/sin/{S15.8.2.16_A3.js => zero.js} | 6 +++--- .../Math/trunc/Math.trunc_Infinity.js | 5 +++-- 3 files changed, 19 insertions(+), 12 deletions(-) rename test/built-ins/Math/sin/{S15.8.2.16_A3.js => zero.js} (57%) diff --git a/test/built-ins/Math/sign/sign-specialVals.js b/test/built-ins/Math/sign/sign-specialVals.js index 147842d31d..0e63fe895f 100644 --- a/test/built-ins/Math/sign/sign-specialVals.js +++ b/test/built-ins/Math/sign/sign-specialVals.js @@ -2,13 +2,19 @@ // This code is governed by the license found in the LICENSE file. /*--- -description: Math.sign with special values +description: > + Returns the sign of the x, indicating whether x is positive, negative or zero. es6id: 20.2.2.29 ---*/ -assert.sameValue(Math.sign(NaN), Number.NaN, - "Math.sign produces incorrect output for NaN"); -assert.sameValue(1/Math.sign(-0), Number.NEGATIVE_INFINITY, - "Math.sign produces incorrect output for -0"); -assert.sameValue(1/Math.sign(0), Number.POSITIVE_INFINITY, - "Math.sign produces incorrect output for 0"); +assert.sameValue(Math.sign(NaN), NaN, "NaN"); +assert.sameValue(Math.sign(-0), -0, "-0"); +assert.sameValue(Math.sign(0), 0, "0"); + +assert.sameValue(Math.sign(-0.000001), -1, "-0.000001"); +assert.sameValue(Math.sign(-1), -1, "-1"); +assert.sameValue(Math.sign(-Infinity), -1, "-Infinity"); + +assert.sameValue(Math.sign(0.000001), 1, "0.000001"); +assert.sameValue(Math.sign(1), 1, "1"); +assert.sameValue(Math.sign(Infinity), 1, "Infinity"); diff --git a/test/built-ins/Math/sin/S15.8.2.16_A3.js b/test/built-ins/Math/sin/zero.js similarity index 57% rename from test/built-ins/Math/sin/S15.8.2.16_A3.js rename to test/built-ins/Math/sin/zero.js index e43b043112..13380e0903 100644 --- a/test/built-ins/Math/sin/S15.8.2.16_A3.js +++ b/test/built-ins/Math/sin/zero.js @@ -2,9 +2,9 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -info: If x is -0, Math.sin(x) is -0 es5id: 15.8.2.16_A3 -description: Checking if Math.sin(-0) equals to -0 +description: Return arg if -0 or +0 ---*/ -assert.sameValue(Math.sin(-0), -0); +assert.sameValue(Math.sin(0), 0, "+0"); +assert.sameValue(Math.sin(-0), -0, "-0"); diff --git a/test/built-ins/Math/trunc/Math.trunc_Infinity.js b/test/built-ins/Math/trunc/Math.trunc_Infinity.js index 6a9abb4272..c90d127e1e 100644 --- a/test/built-ins/Math/trunc/Math.trunc_Infinity.js +++ b/test/built-ins/Math/trunc/Math.trunc_Infinity.js @@ -4,7 +4,8 @@ /*--- es6id: 20.2.2.35 author: Ryan Lewis -description: Math.trunc should return Infinity when called with Infinity. +description: Return arg when called with Infinity or -Infinity. ---*/ -assert.sameValue(Math.trunc(.9), 0, 'Math.trunc(.9)'); +assert.sameValue(Math.trunc(Infinity), Infinity, 'Math.trunc(Infinity)'); +assert.sameValue(Math.trunc(-Infinity), -Infinity, 'Math.trunc(-Infinity)');