built-ins/Math/*: make all indentation consistent (depth & character) (#1435)

This commit is contained in:
Rick Waldron 2018-02-15 17:35:45 -05:00 committed by Leo Balter
parent b59d956b3c
commit 0bf08dff3d
71 changed files with 558 additions and 522 deletions

View File

@ -18,7 +18,10 @@ includes: [compareArray.js]
var mapSet = Map.prototype.set; var mapSet = Map.prototype.set;
var counter = 0; var counter = 0;
var iterable = [["foo", 1], ["bar", 2]]; var iterable = [
["foo", 1],
["bar", 2]
];
var results = []; var results = [];
var _this = []; var _this = [];

View File

@ -20,14 +20,19 @@ var iterable = {};
iterable[Symbol.iterator] = function() { iterable[Symbol.iterator] = function() {
return { return {
next: function() { next: function() {
return { value: [], done: false }; return {
value: [],
done: false
};
}, },
return: function() { return: function() {
count += 1; count += 1;
} }
}; };
}; };
Map.prototype.set = function() { throw new Test262Error(); } Map.prototype.set = function() {
throw new Test262Error();
}
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
new Map(iterable); new Map(iterable);

View File

@ -27,7 +27,10 @@ var iterable = {};
iterable[Symbol.iterator] = function() { iterable[Symbol.iterator] = function() {
return { return {
next: function() { next: function() {
return { value: nextItem, done: false }; return {
value: nextItem,
done: false
};
}, },
return: function() { return: function() {
count += 1; count += 1;

View File

@ -44,5 +44,7 @@ assert.throws(TypeError, function() {
}); });
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
new Map([['a', 1], 2]); new Map([
['a', 1], 2
]);
}); });

View File

@ -23,5 +23,8 @@ info: |
Map.prototype.set = null; Map.prototype.set = null;
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
new Map([[1,1], [2,2]]); new Map([
[1, 1],
[2, 2]
]);
}); });

View File

@ -17,8 +17,8 @@ info: |
---*/ ---*/
var m = new Map([ var m = new Map([
[ "attr", 1 ], ["attr", 1],
[ "foo", 2 ] ["foo", 2]
]); ]);
assert.sameValue(m.size, 2, 'The value of `m.size` is `2`'); assert.sameValue(m.size, 2, 'The value of `m.size` is `2`');

View File

@ -25,7 +25,10 @@ assert.sameValue(
"`Object.getPrototypeOf(m1)` returns `Map.prototype`" "`Object.getPrototypeOf(m1)` returns `Map.prototype`"
); );
var m2 = new Map([[1, 1], [2, 2]]); var m2 = new Map([
[1, 1],
[2, 2]
]);
assert.sameValue( assert.sameValue(
Object.getPrototypeOf(m2), Object.getPrototypeOf(m2),

View File

@ -17,11 +17,14 @@ info: |
features: [Symbol] features: [Symbol]
---*/ ---*/
var m1 = new Map([['foo', 'bar'], [1, 1]]); var m1 = new Map([
['foo', 'bar'],
[1, 1]
]);
var m2 = new Map(); var m2 = new Map();
var m3 = new Map(); var m3 = new Map();
m2.set('foo', 'bar'); m2.set('foo', 'bar');
m2.set(1,1); m2.set(1, 1);
m2.set(Symbol('a'), Symbol('a')); m2.set(Symbol('a'), Symbol('a'));
m1.clear(); m1.clear();

View File

@ -11,9 +11,9 @@ includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Map.prototype.clear, typeof Map.prototype.clear,
'function', 'function',
'typeof Map.prototype.clear is "function"' 'typeof Map.prototype.clear is "function"'
); );
verifyNotEnumerable(Map.prototype, 'clear'); verifyNotEnumerable(Map.prototype, 'clear');

View File

@ -20,7 +20,11 @@ info: |
6. Return undefined. 6. Return undefined.
---*/ ---*/
var m = new Map([[1,1], [2,2], [3,3]]); var m = new Map([
[1, 1],
[2, 2],
[3, 3]
]);
var e = m.entries(); var e = m.entries();
e.next(); e.next();

View File

@ -16,7 +16,10 @@ info: |
6. Return undefined. 6. Return undefined.
---*/ ---*/
var m1 = new Map([['foo', 'bar'], [1, 1]]); var m1 = new Map([
['foo', 'bar'],
[1, 1]
]);
assert.sameValue(m1.clear(), undefined, 'clears a map and returns undefined'); assert.sameValue(m1.clear(), undefined, 'clears a map and returns undefined');
assert.sameValue(m1.clear(), undefined, 'returns undefined on an empty map'); assert.sameValue(m1.clear(), undefined, 'returns undefined on an empty map');

View File

@ -11,9 +11,9 @@ includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Map.prototype.delete, typeof Map.prototype.delete,
'function', 'function',
'typeof Map.prototype.delete is "function"' 'typeof Map.prototype.delete is "function"'
); );
verifyNotEnumerable(Map.prototype, 'delete'); verifyNotEnumerable(Map.prototype, 'delete');

View File

@ -16,7 +16,11 @@ info: |
... ...
---*/ ---*/
var m = new Map([['a',1], ['b', 2], ['c', 3]]); var m = new Map([
['a', 1],
['b', 2],
['c', 3]
]);
var e = m.entries(); var e = m.entries();
e.next(); e.next();

View File

@ -15,7 +15,10 @@ info: |
6. Return false. 6. Return false.
---*/ ---*/
var m = new Map([['a',1], ['b', 2]]); var m = new Map([
['a', 1],
['b', 2]
]);
assert.sameValue(m.delete('not-in-the-map'), false); assert.sameValue(m.delete('not-in-the-map'), false);

View File

@ -16,7 +16,10 @@ info: |
... ...
---*/ ---*/
var m = new Map([['a',1], ['b', 2]]); var m = new Map([
['a', 1],
['b', 2]
]);
var result = m.delete('a'); var result = m.delete('a');

View File

@ -11,5 +11,5 @@ description: Checking if Math.abs(-Infinity) equals to +Infinity
var x = -Infinity; var x = -Infinity;
if (Math.abs(x) !== +Infinity) if (Math.abs(x) !== +Infinity)
{ {
$ERROR("#1: 'var x=-Infinity; Math.abs(x) !== +Infinity'"); $ERROR("#1: 'var x=-Infinity; Math.abs(x) !== +Infinity'");
} }

View File

@ -1,18 +1,18 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.acosh with special values description: Math.acosh with special values
es6id: 20.2.2.3 es6id: 20.2.2.3
info: | info: |
Math.acosh ( x ) Math.acosh ( x )
- If x is NaN, the result is NaN. - If x is NaN, the result is NaN.
- If x is less than 1, the result is NaN. - If x is less than 1, the result is NaN.
---*/ ---*/
assert.sameValue(Math.acosh(NaN), NaN, "NaN"); assert.sameValue(Math.acosh(NaN), NaN, "NaN");
assert.sameValue(Math.acosh(0.999999), NaN, "0.999999"); assert.sameValue(Math.acosh(0.999999), NaN, "0.999999");
assert.sameValue(Math.acosh(0), NaN, "0"); assert.sameValue(Math.acosh(0), NaN, "0");
assert.sameValue(Math.acosh(-1), NaN, "-1"); assert.sameValue(Math.acosh(-1), NaN, "-1");
assert.sameValue(Math.acosh(-Infinity), NaN, "-Infinity"); assert.sameValue(Math.acosh(-Infinity), NaN, "-Infinity");

View File

@ -1,18 +1,18 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.asinh with special values description: Math.asinh with special values
es6id: 20.2.2.5 es6id: 20.2.2.5
---*/ ---*/
assert.sameValue(Math.asinh(NaN), Number.NaN, assert.sameValue(Math.asinh(NaN), Number.NaN,
"Math.asinh produces incorrect output for NaN"); "Math.asinh produces incorrect output for NaN");
assert.sameValue(Math.asinh(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY, assert.sameValue(Math.asinh(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY,
"Math.asinh should produce negative infinity for Number.NEGATIVE_INFINITY"); "Math.asinh should produce negative infinity for Number.NEGATIVE_INFINITY");
assert.sameValue(Math.asinh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, assert.sameValue(Math.asinh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.asinh should produce positive infinity for Number.POSITIVE_INFINITY"); "Math.asinh should produce positive infinity for Number.POSITIVE_INFINITY");
assert.sameValue(1 / Math.asinh(-0), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.asinh(-0), Number.NEGATIVE_INFINITY,
"Math.asinh should produce -0 for -0"); "Math.asinh should produce -0 for -0");
assert.sameValue(1 / Math.asinh(0), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.asinh(0), Number.POSITIVE_INFINITY,
"Math.asinh should produce +0 for +0"); "Math.asinh should produce +0 for +0");

View File

@ -24,14 +24,14 @@ var valnum = 7;
var args = new Array(); var args = new Array();
for (var i = 0; i < 2; i++) for (var i = 0; i < 2; i++)
{ {
args[i] = NaN; args[i] = NaN;
for (var j = 0; j < valnum; j++) for (var j = 0; j < valnum; j++)
{ {
args[1-i] = vals[j]; args[1 - i] = vals[j];
assert.sameValue( assert.sameValue(
Math.atan2(args[0], args[1]), Math.atan2(args[0], args[1]),
NaN, NaN,
"(" + args[0] + ", " + args[1] + ")" "(" + args[0] + ", " + args[1] + ")"
); );
} }
} }

View File

@ -20,8 +20,7 @@ var ynum = 3;
for (var i = 0; i < ynum; i++) for (var i = 0; i < ynum; i++)
{ {
assert.sameValue( assert.sameValue(
Math.atan2(y[i], x), Math.atan2(y[i], x), -0,
-0,
"(" + y[i] + ", Infinity)" "(" + y[i] + ", Infinity)"
); );
} }

View File

@ -12,7 +12,7 @@ var y = +0;
var x = new Array(); var x = new Array();
x[0] = 0.000000000000001; x[0] = 0.000000000000001;
x[2] = +Infinity; x[2] = +Infinity;
x[1] = 1; x[1] = 1;
var xnum = 3; var xnum = 3;
for (var i = 0; i < xnum; i++) for (var i = 0; i < xnum; i++)

View File

@ -12,14 +12,13 @@ var y = -0;
var x = new Array(); var x = new Array();
x[0] = 0.000000000000001; x[0] = 0.000000000000001;
x[2] = +Infinity; x[2] = +Infinity;
x[1] = 1; x[1] = 1;
var xnum = 3; var xnum = 3;
for (var i = 0; i < xnum; i++) for (var i = 0; i < xnum; i++)
{ {
assert.sameValue( assert.sameValue(
Math.atan2(y, x[i]), Math.atan2(y, x[i]), -0,
-0,
"(-0, " + x[i] + ")" "(-0, " + x[i] + ")"
); );
} }

View File

@ -1,31 +1,31 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.atanh with special values description: Math.atanh with special values
es6id: 20.2.2.7 es6id: 20.2.2.7
---*/ ---*/
assert.sameValue(Math.atanh(-1.9), Number.NaN, assert.sameValue(Math.atanh(-1.9), Number.NaN,
"Math.atanh produces incorrect output for -1.9"); "Math.atanh produces incorrect output for -1.9");
assert.sameValue(Math.atanh(NaN), Number.NaN, assert.sameValue(Math.atanh(NaN), Number.NaN,
"Math.atanh produces incorrect output for NaN"); "Math.atanh produces incorrect output for NaN");
assert.sameValue(Math.atanh(-10), Number.NaN, assert.sameValue(Math.atanh(-10), Number.NaN,
"Math.atanh produces incorrect output for -10"); "Math.atanh produces incorrect output for -10");
assert.sameValue(Math.atanh(-Infinity), Number.NaN, assert.sameValue(Math.atanh(-Infinity), Number.NaN,
"Math.atanh produces incorrect output for -Infinity"); "Math.atanh produces incorrect output for -Infinity");
assert.sameValue(Math.atanh(1.9), Number.NaN, assert.sameValue(Math.atanh(1.9), Number.NaN,
"Math.atanh produces incorrect output for 1.9"); "Math.atanh produces incorrect output for 1.9");
assert.sameValue(Math.atanh(10), Number.NaN, assert.sameValue(Math.atanh(10), Number.NaN,
"Math.atanh produces incorrect output for 10"); "Math.atanh produces incorrect output for 10");
assert.sameValue(Math.atanh(Number.POSITIVE_INFINITY), Number.NaN, assert.sameValue(Math.atanh(Number.POSITIVE_INFINITY), Number.NaN,
"Math.atanh produces incorrect output for Number.POSITIVE_INFINITY"); "Math.atanh produces incorrect output for Number.POSITIVE_INFINITY");
assert.sameValue(Math.atanh(-1), Number.NEGATIVE_INFINITY, assert.sameValue(Math.atanh(-1), Number.NEGATIVE_INFINITY,
"Math.atanh should produce negative infinity for -1"); "Math.atanh should produce negative infinity for -1");
assert.sameValue(Math.atanh(+1), Number.POSITIVE_INFINITY, assert.sameValue(Math.atanh(+1), Number.POSITIVE_INFINITY,
"Math.atanh should produce positive infinity for +1"); "Math.atanh should produce positive infinity for +1");
assert.sameValue(1/Math.atanh(-0), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.atanh(-0), Number.NEGATIVE_INFINITY,
"Math.atanh should produce -0 for -0"); "Math.atanh should produce -0 for -0");
assert.sameValue(1/Math.atanh(0), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.atanh(0), Number.POSITIVE_INFINITY,
"Math.atanh should produce +0 for +0"); "Math.atanh should produce +0 for +0");

View File

@ -1,18 +1,18 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.cbrt with special values description: Math.cbrt with special values
es6id: 20.2.2.9 es6id: 20.2.2.9
---*/ ---*/
assert.sameValue(Math.cbrt(NaN), Number.NaN, assert.sameValue(Math.cbrt(NaN), Number.NaN,
"Math.cbrt produces incorrect output for NaN"); "Math.cbrt produces incorrect output for NaN");
assert.sameValue(Math.cbrt(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY, assert.sameValue(Math.cbrt(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY,
"Math.cbrt should produce negative infinity for Number.NEGATIVE_INFINITY"); "Math.cbrt should produce negative infinity for Number.NEGATIVE_INFINITY");
assert.sameValue(Math.cbrt(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, assert.sameValue(Math.cbrt(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.cbrt should produce positive infinity for Number.POSITIVE_INFINITY"); "Math.cbrt should produce positive infinity for Number.POSITIVE_INFINITY");
assert.sameValue(1/Math.cbrt(-0), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.cbrt(-0), Number.NEGATIVE_INFINITY,
"Math.cbrt should produce -0 for -0"); "Math.cbrt should produce -0 for -0");
assert.sameValue(1/Math.cbrt(0), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.cbrt(0), Number.POSITIVE_INFINITY,
"Math.cbrt should produce +0 for +0"); "Math.cbrt should produce +0 for +0");

View File

@ -1,12 +1,12 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Testing descriptor property of Math.cbrt description: Testing descriptor property of Math.cbrt
includes: [propertyHelper.js] includes: [propertyHelper.js]
es6id: 20.2.2.9 es6id: 20.2.2.9
---*/ ---*/
verifyNotEnumerable(Math, "cbrt"); verifyNotEnumerable(Math, "cbrt");
verifyWritable(Math, "cbrt"); verifyWritable(Math, "cbrt");
verifyConfigurable(Math, "cbrt"); verifyConfigurable(Math, "cbrt");

View File

@ -11,5 +11,5 @@ description: Checking if Math.ceil(x) is +Infinity, where x is +Infinity
var x = +Infinity; var x = +Infinity;
if (Math.ceil(x) !== +Infinity) if (Math.ceil(x) !== +Infinity)
{ {
$ERROR("#1: 'var x = +Infinity; Math.ceil(x) !== +Infinity'"); $ERROR("#1: 'var x = +Infinity; Math.ceil(x) !== +Infinity'");
} }

View File

@ -11,5 +11,5 @@ description: Checking if Math.ceil(x) is -Infinity, where x is -Infinity
var x = -Infinity; var x = -Infinity;
if (Math.ceil(x) !== -Infinity) if (Math.ceil(x) !== -Infinity)
{ {
$ERROR("#1: 'var x = -Infinity; Math.ceil(x) !== -Infinity'"); $ERROR("#1: 'var x = -Infinity; Math.ceil(x) !== -Infinity'");
} }

View File

@ -10,11 +10,11 @@ description: >
---*/ ---*/
// CHECK#1 // CHECK#1
for (var i=-1000; i<1000; i++) for (var i = -1000; i < 1000; i++)
{ {
var x = i/10.0; var x = i / 10.0;
if (Math.ceil(x) !== -Math.floor(-x)) if (Math.ceil(x) !== -Math.floor(-x))
{ {
$ERROR("#1: 'x = " + x + "; Math.ceil(x) !== -Math.floor(-x)'"); $ERROR("#1: 'x = " + x + "; Math.ceil(x) !== -Math.floor(-x)'");
} }
} }

View File

@ -11,5 +11,5 @@ description: Checking if Math.cos(+0) is 1
var x = +0; var x = +0;
if (Math.cos(x) !== 1) if (Math.cos(x) !== 1)
{ {
$ERROR("#1: 'var x = +0; Math.cos(x) !== 1'"); $ERROR("#1: 'var x = +0; Math.cos(x) !== 1'");
} }

View File

@ -11,5 +11,5 @@ description: Checking if Math.cos(-0) is 1
var x = -0; var x = -0;
if (Math.cos(x) !== 1) if (Math.cos(x) !== 1)
{ {
$ERROR("#1: 'var x = -0; Math.cos(x) !== 1'"); $ERROR("#1: 'var x = -0; Math.cos(x) !== 1'");
} }

View File

@ -1,16 +1,16 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.cosh with special values description: Math.cosh with special values
es6id: 20.2.2.13 es6id: 20.2.2.13
---*/ ---*/
assert.sameValue(Math.cosh(NaN), Number.NaN, assert.sameValue(Math.cosh(NaN), Number.NaN,
"Math.cosh produces incorrect output for NaN"); "Math.cosh produces incorrect output for NaN");
assert.sameValue(Math.cosh(0), 1, "Math.cosh should produce 1 for input = 0"); assert.sameValue(Math.cosh(0), 1, "Math.cosh should produce 1 for input = 0");
assert.sameValue(Math.cosh(-0), 1, "Math.cosh should produce 1 for input = -0"); assert.sameValue(Math.cosh(-0), 1, "Math.cosh should produce 1 for input = -0");
assert.sameValue(Math.cosh(Number.NEGATIVE_INFINITY), Number.POSITIVE_INFINITY, assert.sameValue(Math.cosh(Number.NEGATIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.cosh should produce Number.POSITIVE_INFINITY for Number.NEGATIVE_INFINITY"); "Math.cosh should produce Number.POSITIVE_INFINITY for Number.NEGATIVE_INFINITY");
assert.sameValue(Math.cosh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, assert.sameValue(Math.cosh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.cosh should produce Number.POSITIVE_INFINITY for Number.POSITIVE_INFINITY"); "Math.cosh should produce Number.POSITIVE_INFINITY for Number.POSITIVE_INFINITY");

View File

@ -11,5 +11,5 @@ description: Checking if Math.exp(+0) is 1
var x = +0; var x = +0;
if (Math.exp(x) !== 1) if (Math.exp(x) !== 1)
{ {
$ERROR("#1: 'var x = +0; Math.exp(x) !== 1'"); $ERROR("#1: 'var x = +0; Math.exp(x) !== 1'");
} }

View File

@ -11,5 +11,5 @@ description: Checking if Math.exp(-0) is 1
var x = -0; var x = -0;
if (Math.exp(x) !== 1) if (Math.exp(x) !== 1)
{ {
$ERROR("#1: 'var x = -0; Math.exp(x) !== 1'"); $ERROR("#1: 'var x = -0; Math.exp(x) !== 1'");
} }

View File

@ -11,5 +11,5 @@ description: Checking if Math.exp(+Infinity) is +Ifinity
var x = +Infinity; var x = +Infinity;
if (Math.exp(x) !== +Infinity) if (Math.exp(x) !== +Infinity)
{ {
$ERROR("#1: 'var x = +Infinity; Math.exp(x) !== +Infinity'"); $ERROR("#1: 'var x = +Infinity; Math.exp(x) !== +Infinity'");
} }

View File

@ -1,18 +1,18 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.expm1 with sample values. description: Math.expm1 with sample values.
es6id: 20.2.2.15 es6id: 20.2.2.15
---*/ ---*/
assert.sameValue(Math.expm1(NaN), Number.NaN, assert.sameValue(Math.expm1(NaN), Number.NaN,
"Math.expm1 produces incorrect output for NaN"); "Math.expm1 produces incorrect output for NaN");
assert.sameValue(Math.expm1(Number.NEGATIVE_INFINITY), -1, assert.sameValue(Math.expm1(Number.NEGATIVE_INFINITY), -1,
"Math.expm1 should produce -1 for Number.NEGATIVE_INFINITY"); "Math.expm1 should produce -1 for Number.NEGATIVE_INFINITY");
assert.sameValue(Math.expm1(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, assert.sameValue(Math.expm1(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.expm1 should produce POSITIVE infinity for Number.POSITIVE_INFINITY"); "Math.expm1 should produce POSITIVE infinity for Number.POSITIVE_INFINITY");
assert.sameValue(1/Math.expm1(-0), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.expm1(-0), Number.NEGATIVE_INFINITY,
"Math.expm1 should produce -0 for -0"); "Math.expm1 should produce -0 for -0");
assert.sameValue(1/Math.expm1(0), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.expm1(0), Number.POSITIVE_INFINITY,
"Math.expm1 should produce +0 for +0"); "Math.expm1 should produce +0 for +0");

View File

@ -11,5 +11,5 @@ description: Checking if Math.floor(x) is +Infinity, where x is +Infinity
var x = +Infinity; var x = +Infinity;
if (Math.floor(x) !== +Infinity) if (Math.floor(x) !== +Infinity)
{ {
$ERROR("#1: 'var x = +Infinity; Math.floor(x) !== +Infinity'"); $ERROR("#1: 'var x = +Infinity; Math.floor(x) !== +Infinity'");
} }

View File

@ -11,5 +11,5 @@ description: Checking if Math.floor(x) is -Infinity, where x is -Infinity
var x = -Infinity; var x = -Infinity;
if (Math.floor(x) !== -Infinity) if (Math.floor(x) !== -Infinity)
{ {
$ERROR("#1: 'var x = -Infinity; Math.floor(x) !== -Infinity'"); $ERROR("#1: 'var x = -Infinity; Math.floor(x) !== -Infinity'");
} }

View File

@ -10,11 +10,11 @@ description: >
---*/ ---*/
// CHECK#1 // CHECK#1
for (var i=-1000; i<1000; i++) for (var i = -1000; i < 1000; i++)
{ {
var x = i/10.0; var x = i / 10.0;
if (-Math.ceil(-x) !== Math.floor(x)) if (-Math.ceil(-x) !== Math.floor(x))
{ {
$ERROR("#1: 'x = " + x + "; Math.floor(x) !== -Math.ceil(-x)'"); $ERROR("#1: 'x = " + x + "; Math.floor(x) !== -Math.ceil(-x)'");
} }
} }

View File

@ -7,4 +7,4 @@ author: Ryan Lewis
description: Math.hypot should return 5 if called with 3 and 4. description: Math.hypot should return 5 if called with 3 and 4.
---*/ ---*/
assert.sameValue(Math.hypot(3,4), 5, 'Math.hypot(3,4)'); assert.sameValue(Math.hypot(3, 4), 5, 'Math.hypot(3,4)');

View File

@ -11,12 +11,12 @@ description: Checking if Math.log(+0) and Math.log(-0) equals to -Infinity
var x = +0; var x = +0;
if (Math.log(x) !== -Infinity) if (Math.log(x) !== -Infinity)
{ {
$ERROR("#1: 'var x=+0; Math.log(x) !== -Infinity'"); $ERROR("#1: 'var x=+0; Math.log(x) !== -Infinity'");
} }
// CHECK#2 // CHECK#2
var x = -0; var x = -0;
if (Math.log(x) !== -Infinity) if (Math.log(x) !== -Infinity)
{ {
$ERROR("#1: 'var x=-0; Math.log(x) !== -Infinity'"); $ERROR("#1: 'var x=-0; Math.log(x) !== -Infinity'");
} }

View File

@ -11,5 +11,5 @@ description: Checking if Math.log(+Infinity) equals to +Infinity
var x = +Infinity; var x = +Infinity;
if (Math.log(x) !== +Infinity) if (Math.log(x) !== +Infinity)
{ {
$ERROR("#1: 'var x=+Infinity; Math.log(x) !== +Infinity'"); $ERROR("#1: 'var x=+Infinity; Math.log(x) !== +Infinity'");
} }

View File

@ -1,33 +1,32 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.Log10 with sample values. description: Math.Log10 with sample values.
es6id: 20.2.2.20 es6id: 20.2.2.20
---*/ ---*/
assert.sameValue(Math.log10(-0), Number.NEGATIVE_INFINITY, assert.sameValue(Math.log10(-0), Number.NEGATIVE_INFINITY,
"Math.log10 produces incorrect output for -0"); "Math.log10 produces incorrect output for -0");
assert.sameValue(Math.log10(+0), Number.NEGATIVE_INFINITY, assert.sameValue(Math.log10(+0), Number.NEGATIVE_INFINITY,
"Math.log10 produces incorrect output for +0"); "Math.log10 produces incorrect output for +0");
assert.sameValue(Math.log10(-0.9), Number.NaN, assert.sameValue(Math.log10(-0.9), Number.NaN,
"Math.log10 produces incorrect output for -0.9"); "Math.log10 produces incorrect output for -0.9");
assert.sameValue(Math.log10(NaN), Number.NaN, assert.sameValue(Math.log10(NaN), Number.NaN,
"Math.log10 produces incorrect output for NaN"); "Math.log10 produces incorrect output for NaN");
assert.sameValue(Math.log10(-10), Number.NaN, assert.sameValue(Math.log10(-10), Number.NaN,
"Math.log10 produces incorrect output for -10"); "Math.log10 produces incorrect output for -10");
assert.sameValue(Math.log10(null), Number.NEGATIVE_INFINITY, assert.sameValue(Math.log10(null), Number.NEGATIVE_INFINITY,
"Math.log10 produces incorrect output for null"); "Math.log10 produces incorrect output for null");
assert.sameValue(Math.log10(undefined), Number.NaN, assert.sameValue(Math.log10(undefined), Number.NaN,
"Math.log10 produces incorrect output for undefined"); "Math.log10 produces incorrect output for undefined");
assert.sameValue(Math.log10(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, assert.sameValue(Math.log10(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.log10 produces incorrect output for Number.POSITIVE_INFINITY"); "Math.log10 produces incorrect output for Number.POSITIVE_INFINITY");
assert.sameValue(Math.log10(1), 0, assert.sameValue(Math.log10(1), 0,
"Math.log10 produces incorrect output for 1"); "Math.log10 produces incorrect output for 1");
assert.sameValue(Math.log10(10.00), 1, assert.sameValue(Math.log10(10.00), 1,
"Math.log10 produces incorrect output for 10.00"); "Math.log10 produces incorrect output for 10.00");
assert.sameValue(Math.log10(100.00), 2, assert.sameValue(Math.log10(100.00), 2,
"Math.log10 produces incorrect output for 100.00"); "Math.log10 produces incorrect output for 100.00");
assert.sameValue(Math.log10(1000.00), 3, assert.sameValue(Math.log10(1000.00), 3,
"Math.log10 produces incorrect output for 1000.00"); "Math.log10 produces incorrect output for 1000.00");

View File

@ -1,34 +1,34 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.Log2 with sample values. description: Math.Log2 with sample values.
es6id: 20.2.2.23 es6id: 20.2.2.23
---*/ ---*/
assert.sameValue(Math.log2(-0), Number.NEGATIVE_INFINITY, assert.sameValue(Math.log2(-0), Number.NEGATIVE_INFINITY,
"Math.log2 produces incorrect output for -0"); "Math.log2 produces incorrect output for -0");
assert.sameValue(Math.log2(+0), Number.NEGATIVE_INFINITY, assert.sameValue(Math.log2(+0), Number.NEGATIVE_INFINITY,
"Math.log2 produces incorrect output for +0"); "Math.log2 produces incorrect output for +0");
assert.sameValue(Math.log2(-0.9), NaN, assert.sameValue(Math.log2(-0.9), NaN,
"Math.log2 produces incorrect output for -0.9"); "Math.log2 produces incorrect output for -0.9");
assert.sameValue(Math.log2(NaN), NaN, assert.sameValue(Math.log2(NaN), NaN,
"Math.log2 produces incorrect output for NaN"); "Math.log2 produces incorrect output for NaN");
assert.sameValue(Math.log2(-10), NaN, assert.sameValue(Math.log2(-10), NaN,
"Math.log2 produces incorrect output for -10"); "Math.log2 produces incorrect output for -10");
assert.sameValue(Math.log2(-Infinity), NaN, assert.sameValue(Math.log2(-Infinity), NaN,
"Math.log2 produces incorrect output for -Infinity"); "Math.log2 produces incorrect output for -Infinity");
assert.sameValue(Math.log2(null), Number.NEGATIVE_INFINITY, assert.sameValue(Math.log2(null), Number.NEGATIVE_INFINITY,
"Math.log2 produces incorrect output for null"); "Math.log2 produces incorrect output for null");
assert.sameValue(Math.log2(undefined), NaN, assert.sameValue(Math.log2(undefined), NaN,
"Math.log2 produces incorrect output for undefined"); "Math.log2 produces incorrect output for undefined");
assert.sameValue(Math.log2(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, assert.sameValue(Math.log2(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.log2 produces incorrect output for Number.POSITIVE_INFINITY"); "Math.log2 produces incorrect output for Number.POSITIVE_INFINITY");
assert.sameValue(Math.log2(1), 0, assert.sameValue(Math.log2(1), 0,
"Math.log2 produces incorrect output for 1"); "Math.log2 produces incorrect output for 1");
assert.sameValue(Math.log2(2.00), 1, assert.sameValue(Math.log2(2.00), 1,
"Math.log2 produces incorrect output for 2.00"); "Math.log2 produces incorrect output for 2.00");
assert.sameValue(Math.log2(4.00), 2, assert.sameValue(Math.log2(4.00), 2,
"Math.log2 produces incorrect output for 4.00"); "Math.log2 produces incorrect output for 4.00");
assert.sameValue(Math.log2(8.00), 3, assert.sameValue(Math.log2(8.00), 3,
"Math.log2 produces incorrect output for 8.00"); "Math.log2 produces incorrect output for 8.00");

View File

@ -10,5 +10,5 @@ description: Checking if Math.max() equals to -Infinity
// CHECK#1 // CHECK#1
if (Math.max() != -Infinity) if (Math.max() != -Infinity)
{ {
$ERROR("#1: 'Math.max() != -Infinity'"); $ERROR("#1: 'Math.max() != -Infinity'");
} }

View File

@ -25,16 +25,16 @@ var valnum = 7;
var args = new Array(); var args = new Array();
for (var i = 0; i <= 1; i++) for (var i = 0; i <= 1; i++)
{ {
args[i] = NaN; args[i] = NaN;
for (var j = 0; j < valnum; j++) for (var j = 0; j < valnum; j++)
{ {
args[1-i] = vals[j]; args[1 - i] = vals[j];
assert.sameValue( assert.sameValue(
Math.max(args[0], args[1]), Math.max(args[0], args[1]),
NaN, NaN,
"max(" + args[0] + ", " + args[1] + ")" "max(" + args[0] + ", " + args[1] + ")"
); );
} }
} }
// CHECK #3 // CHECK #3
@ -42,25 +42,25 @@ var k = 1;
var l = 2; var l = 2;
for (var i = 0; i <= 2; i++) for (var i = 0; i <= 2; i++)
{ {
args[i] = NaN; args[i] = NaN;
if (i === 1) if (i === 1)
{ {
k = 0; k = 0;
} else if (i === 2) } else if (i === 2)
{ {
l = 1; l = 1;
} }
for (var j = 0; j < valnum; j++) for (var j = 0; j < valnum; j++)
{ {
for (var jj = 0; jj < valnum; jj++) for (var jj = 0; jj < valnum; jj++)
{ {
args[k] = vals[j]; args[k] = vals[j];
args[l] = vals[jj]; args[l] = vals[jj];
assert.sameValue( assert.sameValue(
Math.max(args[0], args[1], args[2]), Math.max(args[0], args[1], args[2]),
NaN, NaN,
"max(" + args[0] + ", " + args[1] + ", " + args[2] + ")" "max(" + args[0] + ", " + args[1] + ", " + args[2] + ")"
); );
} }
} }
} }

View File

@ -9,15 +9,15 @@ description: Checking if Math.max.length property is defined and equals to 2
// CHECK#1 // CHECK#1
if (typeof Math.max !== "function") { if (typeof Math.max !== "function") {
$ERROR('#1: Math.max method is not defined'); $ERROR('#1: Math.max method is not defined');
} }
// CHECK#2 // CHECK#2
if (typeof Math.max.length === "undefined") { if (typeof Math.max.length === "undefined") {
$ERROR('#2: length property of Math.max method is undefined'); $ERROR('#2: length property of Math.max method is undefined');
} }
// CHECK#3 // CHECK#3
if (Math.max.length !== 2) { if (Math.max.length !== 2) {
$ERROR('#3: The length property of the Math.max method is not 2'); $ERROR('#3: The length property of the Math.max method is not 2');
} }

View File

@ -10,5 +10,5 @@ description: Checking if Math.min() equals to +Infinity
// CHECK#1 // CHECK#1
if (Math.min() != +Infinity) if (Math.min() != +Infinity)
{ {
$ERROR("#1: 'Math.min() != +Infinity'"); $ERROR("#1: 'Math.min() != +Infinity'");
} }

View File

@ -26,16 +26,16 @@ var valnum = 7;
var args = new Array(); var args = new Array();
for (var i = 0; i <= 1; i++) for (var i = 0; i <= 1; i++)
{ {
args[i] = NaN; args[i] = NaN;
for (var j = 0; j < valnum; j++) for (var j = 0; j < valnum; j++)
{ {
args[1-i] = vals[j]; args[1 - i] = vals[j];
assert.sameValue( assert.sameValue(
Math.min(args[0], args[1]), Math.min(args[0], args[1]),
NaN, NaN,
"min(" + args[0] + ", " + args[1] + ")" "min(" + args[0] + ", " + args[1] + ")"
); );
} }
} }
// CHECK #3 // CHECK #3
@ -43,25 +43,25 @@ var k = 1;
var l = 2; var l = 2;
for (var i = 0; i <= 2; i++) for (var i = 0; i <= 2; i++)
{ {
args[i] = NaN; args[i] = NaN;
if (i === 1) if (i === 1)
{ {
k = 0; k = 0;
} else if (i === 2) } else if (i === 2)
{ {
l = 1; l = 1;
} }
for (var j = 0; j < valnum; j++) for (var j = 0; j < valnum; j++)
{ {
for (var jj = 0; jj < valnum; jj++) for (var jj = 0; jj < valnum; jj++)
{ {
args[k] = vals[j]; args[k] = vals[j];
args[l] = vals[jj]; args[l] = vals[jj];
assert.sameValue( assert.sameValue(
Math.min(args[0], args[1], args[2]), Math.min(args[0], args[1], args[2]),
NaN, NaN,
"min(" + args[0] + ", " + args[1] + ", " + args[2] + ")" "min(" + args[0] + ", " + args[1] + ", " + args[2] + ")"
); );
} }
} }
} }

View File

@ -9,15 +9,15 @@ description: Checking if Math.min.length property is defined and equals to 2
// CHECK#1 // CHECK#1
if (typeof Math.min !== "function") { if (typeof Math.min !== "function") {
$ERROR('#1: Math.min method is not defined'); $ERROR('#1: Math.min method is not defined');
} }
// CHECK#2 // CHECK#2
if (typeof Math.min.length === "undefined") { if (typeof Math.min.length === "undefined") {
$ERROR('#2: length property of Math.min method is undefined'); $ERROR('#2: length property of Math.min method is undefined');
} }
// CHECK#3 // CHECK#3
if (Math.min.length !== 2) { if (Math.min.length !== 2) {
$ERROR('#3: The length property of the Math.min method is not 2'); $ERROR('#3: The length property of the Math.min method is not 2');
} }

View File

@ -19,8 +19,8 @@ var basenum = 6;
for (var i = 0; i < basenum; i++) for (var i = 0; i < basenum; i++)
{ {
if (Math.pow(base[i],exponent) !== +Infinity) if (Math.pow(base[i], exponent) !== +Infinity)
{ {
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity"); $ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity");
} }
} }

View File

@ -17,8 +17,8 @@ var exponentnum = 4;
for (var i = 0; i < exponentnum; i++) for (var i = 0; i < exponentnum; i++)
{ {
if (Math.pow(base,exponent[i]) !== +Infinity) if (Math.pow(base, exponent[i]) !== +Infinity)
{ {
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); $ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
} }
} }

View File

@ -16,8 +16,8 @@ var exponentnum = 3;
for (var i = 0; i < exponentnum; i++) for (var i = 0; i < exponentnum; i++)
{ {
if (Math.pow(base,exponent[i]) !== -Infinity) if (Math.pow(base, exponent[i]) !== -Infinity)
{ {
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity"); $ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity");
} }
} }

View File

@ -18,8 +18,8 @@ var exponentnum = 5;
for (var i = 0; i < exponentnum; i++) for (var i = 0; i < exponentnum; i++)
{ {
if (Math.pow(base,exponent[i]) !== +Infinity) if (Math.pow(base, exponent[i]) !== +Infinity)
{ {
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); $ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
} }
} }

View File

@ -17,8 +17,8 @@ var exponentnum = 4;
for (var i = 0; i < exponentnum; i++) for (var i = 0; i < exponentnum; i++)
{ {
if (Math.pow(base,exponent[i]) !== +Infinity) if (Math.pow(base, exponent[i]) !== +Infinity)
{ {
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); $ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
} }
} }

View File

@ -22,8 +22,8 @@ var basenum = 9;
for (var i = 0; i < basenum; i++) for (var i = 0; i < basenum; i++)
{ {
if (Math.pow(base[i],exponent) !== 1) if (Math.pow(base[i], exponent) !== 1)
{ {
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== 1"); $ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== 1");
} }
} }

View File

@ -16,8 +16,8 @@ var exponentnum = 3;
for (var i = 0; i < exponentnum; i++) for (var i = 0; i < exponentnum; i++)
{ {
if (Math.pow(base,exponent[i]) !== -Infinity) if (Math.pow(base, exponent[i]) !== -Infinity)
{ {
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity"); $ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity");
} }
} }

View File

@ -18,8 +18,8 @@ var exponentnum = 5;
for (var i = 0; i < exponentnum; i++) for (var i = 0; i < exponentnum; i++)
{ {
if (Math.pow(base, exponent[i]) !== +Infinity) if (Math.pow(base, exponent[i]) !== +Infinity)
{ {
$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); $ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity");
} }
} }

View File

@ -27,7 +27,7 @@ exponent[7] = Math.PI;
var exponentnum = 8; var exponentnum = 8;
for (var i = 0; i < basenum; i++) { for (var i = 0; i < basenum; i++) {
for (var j = 0; j < exponentnum; j++) { for (var j = 0; j < exponentnum; j++) {
assert.sameValue( assert.sameValue(
Math.pow(base[i], exponent[j]), Math.pow(base[i], exponent[j]),
NaN, NaN,

View File

@ -22,8 +22,8 @@ var basenum = 9;
for (var i = 0; i < basenum; i++) for (var i = 0; i < basenum; i++)
{ {
if (Math.pow(base[i],exponent) !== 1) if (Math.pow(base[i], exponent) !== 1)
{ {
$ERROR("#1: Math.pow(" + base[i] + ", -0) !== 1"); $ERROR("#1: Math.pow(" + base[i] + ", -0) !== 1");
} }
} }

View File

@ -19,8 +19,8 @@ var basenum = 6;
for (var i = 0; i < basenum; i++) for (var i = 0; i < basenum; i++)
{ {
if (Math.pow(base[i],exponent) !== +Infinity) if (Math.pow(base[i], exponent) !== +Infinity)
{ {
$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity"); $ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity");
} }
} }

View File

@ -14,15 +14,15 @@ description: >
// CHECK#1 // CHECK#1
for (var i = 0; i < 100; i++) for (var i = 0; i < 100; i++)
{ {
var val = Math.random(); var val = Math.random();
assert.sameValue( assert.sameValue(
typeof val, 'number', 'should not produce a non-numeric value: ' + val typeof val, 'number', 'should not produce a non-numeric value: ' + val
); );
assert.notSameValue(val, NaN, 'should not produce NaN'); assert.notSameValue(val, NaN, 'should not produce NaN');
if (val < 0 || val >= 1) if (val < 0 || val >= 1)
{ {
$ERROR("#1: Math.random() = " + val); $ERROR("#1: Math.random() = " + val);
} }
} }

View File

@ -11,5 +11,5 @@ description: Checking if Math.round(x) is +Infinity, where x is +Infinity
var x = +Infinity; var x = +Infinity;
if (Math.round(x) !== +Infinity) if (Math.round(x) !== +Infinity)
{ {
$ERROR("#1: 'var x=+Infinity; Math.round(x) !== +Infinity'"); $ERROR("#1: 'var x=+Infinity; Math.round(x) !== +Infinity'");
} }

View File

@ -11,5 +11,5 @@ description: Checking if Math.round(x) is -Infinity, where x is -Infinity
var x = -Infinity; var x = -Infinity;
if (Math.round(x) !== -Infinity) if (Math.round(x) !== -Infinity)
{ {
$ERROR("#1: 'var x=-Infinity; Math.round(x) !== -Infinity'"); $ERROR("#1: 'var x=-Infinity; Math.round(x) !== -Infinity'");
} }

View File

@ -15,25 +15,25 @@ description: >
// CHECK#1 // CHECK#1
for (var i = 0; i <= 1000; i++) for (var i = 0; i <= 1000; i++)
{ {
var x = i/10.0; var x = i / 10.0;
if (Math.round(x) !== Math.floor(x + 0.5)) if (Math.round(x) !== Math.floor(x + 0.5))
{ {
$ERROR("#1: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'") $ERROR("#1: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'")
} }
} }
for (i = -5; i >= -1000; i--) for (i = -5; i >= -1000; i--)
{ {
if (i === -5) if (i === -5)
{ {
x = -0.500000000000001; x = -0.500000000000001;
} else } else
{ {
x = i/10.0; x = i / 10.0;
} }
if (Math.round(x) !== Math.floor(x + 0.5)) if (Math.round(x) !== Math.floor(x + 0.5))
{ {
$ERROR("#2: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'") $ERROR("#2: 'x = " + x + "; Math.round(x) !== Math.floor(x + 0.5)'")
} }
} }

View File

@ -21,7 +21,7 @@ if (1 / Math.round(-0.5) !== 1 / -0) {
// CHECK#2 // CHECK#2
if (1 / Math.round(-0.25) !== 1 / -0) { if (1 / Math.round(-0.25) !== 1 / -0) {
$ERROR("#2: '1 / Math.round(-0.25) !== 1 / -0'"); $ERROR("#2: '1 / Math.round(-0.25) !== 1 / -0'");
} }
// CHECK#3 // CHECK#3

View File

@ -1,20 +1,20 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: > description: >
Returns the sign of the x, indicating whether x is positive, negative or zero. Returns the sign of the x, indicating whether x is positive, negative or zero.
es6id: 20.2.2.29 es6id: 20.2.2.29
---*/ ---*/
assert.sameValue(Math.sign(NaN), NaN, "NaN"); 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), 0, "0"); assert.sameValue(Math.sign(0), 0, "0");
assert.sameValue(Math.sign(-0.000001), -1, "-0.000001"); assert.sameValue(Math.sign(-0.000001), -1, "-0.000001");
assert.sameValue(Math.sign(-1), -1, "-1"); assert.sameValue(Math.sign(-1), -1, "-1");
assert.sameValue(Math.sign(-Infinity), -1, "-Infinity"); assert.sameValue(Math.sign(-Infinity), -1, "-Infinity");
assert.sameValue(Math.sign(0.000001), 1, "0.000001"); assert.sameValue(Math.sign(0.000001), 1, "0.000001");
assert.sameValue(Math.sign(1), 1, "1"); assert.sameValue(Math.sign(1), 1, "1");
assert.sameValue(Math.sign(Infinity), 1, "Infinity"); assert.sameValue(Math.sign(Infinity), 1, "Infinity");

View File

@ -1,18 +1,18 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.sinh with special values description: Math.sinh with special values
es6id: 20.2.2.31 es6id: 20.2.2.31
---*/ ---*/
assert.sameValue(Math.sinh(NaN), Number.NaN, assert.sameValue(Math.sinh(NaN), Number.NaN,
"Math.sinh produces incorrect output for NaN"); "Math.sinh produces incorrect output for NaN");
assert.sameValue(Math.sinh(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY, assert.sameValue(Math.sinh(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY,
"Math.sinh should produce negative infinity for Number.NEGATIVE_INFINITY"); "Math.sinh should produce negative infinity for Number.NEGATIVE_INFINITY");
assert.sameValue(Math.sinh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, assert.sameValue(Math.sinh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.sinh should produce positive infinity for Number.POSITIVE_INFINITY"); "Math.sinh should produce positive infinity for Number.POSITIVE_INFINITY");
assert.sameValue(1/Math.sinh(-0), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.sinh(-0), Number.NEGATIVE_INFINITY,
"Math.sinh should produce -0 for -0"); "Math.sinh should produce -0 for -0");
assert.sameValue(1/Math.sinh(0), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.sinh(0), Number.POSITIVE_INFINITY,
"Math.sinh should produce +0 for +0"); "Math.sinh should produce +0 for +0");

View File

@ -11,5 +11,5 @@ description: Checking if Math.sqrt(+Infinity) is +Infinity
var x = +Infinity; var x = +Infinity;
if (Math.sqrt(x) !== +Infinity) if (Math.sqrt(x) !== +Infinity)
{ {
$ERROR("#1: 'var x=+Infinity; Math.sqrt(x) !== +Infinity'"); $ERROR("#1: 'var x=+Infinity; Math.sqrt(x) !== +Infinity'");
} }

View File

@ -1,18 +1,18 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.tanh with special values description: Math.tanh with special values
es6id: 20.2.2.34 es6id: 20.2.2.34
---*/ ---*/
assert.sameValue(Math.tanh(NaN), Number.NaN, assert.sameValue(Math.tanh(NaN), Number.NaN,
"Math.tanh produces incorrect output for NaN"); "Math.tanh produces incorrect output for NaN");
assert.sameValue(Math.tanh(Number.NEGATIVE_INFINITY), -1, assert.sameValue(Math.tanh(Number.NEGATIVE_INFINITY), -1,
"Math.tanh should produce -1 for Number.NEGATIVE_INFINITY"); "Math.tanh should produce -1 for Number.NEGATIVE_INFINITY");
assert.sameValue(Math.tanh(Number.POSITIVE_INFINITY), 1, assert.sameValue(Math.tanh(Number.POSITIVE_INFINITY), 1,
"Math.tanh should produce 1 for Number.POSITIVE_INFINITY"); "Math.tanh should produce 1 for Number.POSITIVE_INFINITY");
assert.sameValue(1/Math.tanh(-0), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.tanh(-0), Number.NEGATIVE_INFINITY,
"Math.tanh should produce -0 for -0"); "Math.tanh should produce -0 for -0");
assert.sameValue(1/Math.tanh(0), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.tanh(0), Number.POSITIVE_INFINITY,
"Math.tanh should produce +0 for +0"); "Math.tanh should produce +0 for +0");

View File

@ -1,47 +1,47 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: sample tests for trunc description: sample tests for trunc
es6id: 20.2.2.35 es6id: 20.2.2.35
---*/ ---*/
assert.sameValue(1 / Math.trunc(0.02047410048544407), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.trunc(0.02047410048544407), Number.POSITIVE_INFINITY,
"Math.trunc should produce +0 for values between 0 and 1"); "Math.trunc should produce +0 for values between 0 and 1");
assert.sameValue(1 / Math.trunc(0.00000000000000001), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.trunc(0.00000000000000001), Number.POSITIVE_INFINITY,
"Math.trunc should produce +0 for values between 0 and 1"); "Math.trunc should produce +0 for values between 0 and 1");
assert.sameValue(1 / Math.trunc(0.9999999999999999), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.trunc(0.9999999999999999), Number.POSITIVE_INFINITY,
"Math.trunc should produce +0 for values between 0 and 1"); "Math.trunc should produce +0 for values between 0 and 1");
assert.sameValue(1 / Math.trunc(Number.EPSILON), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.trunc(Number.EPSILON), Number.POSITIVE_INFINITY,
"Math.trunc should produce +0 for values between 0 and 1"); "Math.trunc should produce +0 for values between 0 and 1");
assert.sameValue(1 / Math.trunc(Number.MIN_VALUE), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.trunc(Number.MIN_VALUE), Number.POSITIVE_INFINITY,
"Math.trunc should produce +0 for values between 0 and 1"); "Math.trunc should produce +0 for values between 0 and 1");
assert.sameValue(1 / Math.trunc(-0.02047410048544407), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.trunc(-0.02047410048544407), Number.NEGATIVE_INFINITY,
"Math.trunc should produce -0 for values between -1 and 0"); "Math.trunc should produce -0 for values between -1 and 0");
assert.sameValue(1 / Math.trunc(-0.00000000000000001), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.trunc(-0.00000000000000001), Number.NEGATIVE_INFINITY,
"Math.trunc should produce -0 for values between -1 and 0"); "Math.trunc should produce -0 for values between -1 and 0");
assert.sameValue(1 / Math.trunc(-0.9999999999999999), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.trunc(-0.9999999999999999), Number.NEGATIVE_INFINITY,
"Math.trunc should produce -0 for values between -1 and 0"); "Math.trunc should produce -0 for values between -1 and 0");
assert.sameValue(1 / Math.trunc(-Number.EPSILON), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.trunc(-Number.EPSILON), Number.NEGATIVE_INFINITY,
"Math.trunc should produce -0 for values between -1 and 0"); "Math.trunc should produce -0 for values between -1 and 0");
assert.sameValue(1 / Math.trunc(-Number.MIN_VALUE), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.trunc(-Number.MIN_VALUE), Number.NEGATIVE_INFINITY,
"Math.trunc should produce -0 for values between -1 and 0"); "Math.trunc should produce -0 for values between -1 and 0");
assert.sameValue(Math.trunc(Number.MAX_VALUE), Math.floor(Number.MAX_VALUE), assert.sameValue(Math.trunc(Number.MAX_VALUE), Math.floor(Number.MAX_VALUE),
"Math.trunc produces incorrect result for Number.MAX_VALUE"); "Math.trunc produces incorrect result for Number.MAX_VALUE");
assert.sameValue(Math.trunc(10), Math.floor(10), assert.sameValue(Math.trunc(10), Math.floor(10),
"Math.trunc produces incorrect result for 10"); "Math.trunc produces incorrect result for 10");
assert.sameValue(Math.trunc(3.9), Math.floor(3.9), assert.sameValue(Math.trunc(3.9), Math.floor(3.9),
"Math.trunc produces incorrect result for 3.9"); "Math.trunc produces incorrect result for 3.9");
assert.sameValue(Math.trunc(4.9), Math.floor(4.9), assert.sameValue(Math.trunc(4.9), Math.floor(4.9),
"Math.trunc produces incorrect result for 4.9"); "Math.trunc produces incorrect result for 4.9");
assert.sameValue(Math.trunc(-Number.MAX_VALUE), Math.ceil(-Number.MAX_VALUE), assert.sameValue(Math.trunc(-Number.MAX_VALUE), Math.ceil(-Number.MAX_VALUE),
"Math.trunc produces incorrect result for -Number.MAX_VALUE"); "Math.trunc produces incorrect result for -Number.MAX_VALUE");
assert.sameValue(Math.trunc(-10), Math.ceil(-10), assert.sameValue(Math.trunc(-10), Math.ceil(-10),
"Math.trunc produces incorrect result for -10"); "Math.trunc produces incorrect result for -10");
assert.sameValue(Math.trunc(-3.9), Math.ceil(-3.9), assert.sameValue(Math.trunc(-3.9), Math.ceil(-3.9),
"Math.trunc produces incorrect result for -3.9"); "Math.trunc produces incorrect result for -3.9");
assert.sameValue(Math.trunc(-4.9), Math.ceil(-4.9), assert.sameValue(Math.trunc(-4.9), Math.ceil(-4.9),
"Math.trunc produces incorrect result for -4.9"); "Math.trunc produces incorrect result for -4.9");

View File

@ -1,16 +1,16 @@
// Copyright 2015 Microsoft Corporation. All rights reserved. // Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file. // This code is governed by the license found in the LICENSE file.
/*--- /*---
description: Math.trunc with sample values. description: Math.trunc with sample values.
es6id: 20.2.2.35 es6id: 20.2.2.35
---*/ ---*/
assert.sameValue(Math.trunc(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY, assert.sameValue(Math.trunc(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY,
"Math.trunc should produce negative infinity for Number.NEGATIVE_INFINITY"); "Math.trunc should produce negative infinity for Number.NEGATIVE_INFINITY");
assert.sameValue(Math.trunc(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, assert.sameValue(Math.trunc(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.trunc should produce positive infinity for Number.POSITIVE_INFINITY"); "Math.trunc should produce positive infinity for Number.POSITIVE_INFINITY");
assert.sameValue(1/Math.trunc(-0), Number.NEGATIVE_INFINITY, assert.sameValue(1 / Math.trunc(-0), Number.NEGATIVE_INFINITY,
"Math.trunc should produce -0 for -0"); "Math.trunc should produce -0 for -0");
assert.sameValue(1/Math.trunc(0), Number.POSITIVE_INFINITY, assert.sameValue(1 / Math.trunc(0), Number.POSITIVE_INFINITY,
"Math.trunc should produce +0 for +0"); "Math.trunc should produce +0 for +0");