Update tests for Math.{sign,sin,trunc}

This commit is contained in:
Leonardo Balter 2016-06-22 19:31:42 -04:00 committed by Mike Pennisi
parent e3e7a510ff
commit 080afac906
3 changed files with 19 additions and 12 deletions

View File

@ -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");

View File

@ -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");

View File

@ -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)');