Module: wine Branch: master Commit: 142cffc249ca95b7e3335006fb88f74d0152c575 URL: http://source.winehq.org/git/wine.git/?a=commit;h=142cffc249ca95b7e3335006fb...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Oct 16 14:31:58 2008 -0500
jscript: Added Math.abs with no arg implementation.
---
dlls/jscript/math.c | 5 +++-- dlls/jscript/tests/api.js | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/math.c b/dlls/jscript/math.c index b55ed52..1d37de5 100644 --- a/dlls/jscript/math.c +++ b/dlls/jscript/math.c @@ -121,8 +121,9 @@ static HRESULT Math_abs(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *d TRACE("\n");
if(!arg_cnt(dp)) { - FIXME("arg_cnt = 0\n"); - return E_NOTIMPL; + if(retv) + num_set_nan(retv); + return S_OK; }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index c0e63ef..3bb3ddf 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -431,6 +431,15 @@ ok(tmp === 3, "Math.abs(-3) = " + tmp); tmp = Math.abs(true); ok(tmp === 1, "Math.abs(true) = " + tmp);
+tmp = Math.abs(); +ok(isNaN(tmp), "Math.abs() is not NaN"); + +tmp = Math.abs(NaN); +ok(isNaN(tmp), "Math.abs() is not NaN"); + +tmp = Math.abs(-Infinity); +ok(tmp === Infinity, "Math.abs(-Infinite) = " + tmp); + tmp = Math.abs(-3, 2); ok(tmp === 3, "Math.abs(-3, 2) = " + tmp);