Fix the builtin Math.min and Math.max function

JerryScript-DCO-1.0-Signed-off-by: Kristof Kosztyo kkosztyo.u-szeged@partner.samsung.com
This commit is contained in:
Kristof Kosztyo
2015-07-08 11:12:08 +02:00
parent 8d7cdebee0
commit 9fc1958903
3 changed files with 26 additions and 42 deletions
+2 -4
View File
@@ -14,6 +14,8 @@
assert(isNaN (Math['max'] (1.0, NaN)));
assert(isNaN (Math['max'] (NaN, 1.0)));
assert(isNaN (Math['max'] (Infinity, NaN)));
assert(isNaN (Math['max'] (NaN, Infinity)));
assert(Math['max'] (1.0, 3.0, 0.0) === 3.0);
assert(Math['max'] (1.0, 3.0, Infinity) === Infinity);
assert(Math['max'] (1.0, 3.0, -Infinity) === 3.0);
@@ -23,9 +25,5 @@ assert(Math['max'] (Infinity, Infinity) === Infinity);
assert(Math['max'] (-Infinity, -Infinity) === -Infinity);
assert(Math['max'] () === -Infinity);
/*
FIXME: Uncomment when unary minus support appears.
assert(Math['max'] (0.0, -0.0) === 0.0);
assert(Math['max'] (-0.0, 0.0) === 0.0);
*/
+2 -4
View File
@@ -14,6 +14,8 @@
assert(isNaN (Math['min'] (1.0, NaN)));
assert(isNaN (Math['min'] (NaN, 1.0)));
assert(isNaN (Math['min'] (-Infinity, NaN)));
assert(isNaN (Math['min'] (NaN, -Infinity)));
assert(Math['min'] (1.0, 3.0, 0.0) === 0.0);
assert(Math['min'] (1.0, 3.0, Infinity) === 1.0);
assert(Math['min'] (1.0, 3.0, -Infinity) === -Infinity);
@@ -23,9 +25,5 @@ assert(Math['min'] (Infinity, Infinity) === Infinity);
assert(Math['min'] (-Infinity, -Infinity) === -Infinity);
assert(Math['min'] () === Infinity);
/*
FIXME: Uncomment when unary minus support appears.
assert(Math['min'] (0.0, -0.0) === -0.0);
assert(Math['min'] (-0.0, 0.0) === -0.0);
*/