mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
jscript: Added infinity and nan handling to str_to_number.
This commit is contained in:
parent
4f6f8ef2d8
commit
531f8336a8
@ -246,26 +246,26 @@ static HRESULT str_to_number(BSTR str, VARIANT *ret)
|
|||||||
while(isspaceW(*ptr))
|
while(isspaceW(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if(!strncmpW(ptr, infinityW, sizeof(infinityW)/sizeof(WCHAR))) {
|
|
||||||
ptr += sizeof(infinityW)/sizeof(WCHAR);
|
|
||||||
while(*ptr && isspaceW(*ptr))
|
|
||||||
ptr++;
|
|
||||||
|
|
||||||
if(*ptr) {
|
|
||||||
FIXME("NaN\n");
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
FIXME("inf\n");
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(*ptr == '-') {
|
if(*ptr == '-') {
|
||||||
neg = TRUE;
|
neg = TRUE;
|
||||||
ptr++;
|
ptr++;
|
||||||
}else if(*ptr == '+') {
|
}else if(*ptr == '+') {
|
||||||
ptr++;
|
ptr++;
|
||||||
}else if(*ptr == '0' && ptr[1] == 'x') {
|
}
|
||||||
|
|
||||||
|
if(!strncmpW(ptr, infinityW, sizeof(infinityW)/sizeof(WCHAR))) {
|
||||||
|
ptr += sizeof(infinityW)/sizeof(WCHAR);
|
||||||
|
while(*ptr && isspaceW(*ptr))
|
||||||
|
ptr++;
|
||||||
|
|
||||||
|
if(*ptr)
|
||||||
|
num_set_nan(ret);
|
||||||
|
else
|
||||||
|
num_set_inf(ret, !neg);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*ptr == '0' && ptr[1] == 'x') {
|
||||||
DWORD l = 0;
|
DWORD l = 0;
|
||||||
|
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
@ -313,8 +313,8 @@ static HRESULT str_to_number(BSTR str, VARIANT *ret)
|
|||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if(*ptr) {
|
if(*ptr) {
|
||||||
FIXME("NaN\n");
|
num_set_nan(ret);
|
||||||
return E_NOTIMPL;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(neg)
|
if(neg)
|
||||||
|
@ -813,4 +813,11 @@ ok((Infinity < 2) === false, "(Infinity < 2) !== false");
|
|||||||
ok((Infinity > 2) === true, "(Infinity > 2) !== true");
|
ok((Infinity > 2) === true, "(Infinity > 2) !== true");
|
||||||
ok((-Infinity < 2) === true, "(-Infinity < 2) !== true");
|
ok((-Infinity < 2) === true, "(-Infinity < 2) !== true");
|
||||||
|
|
||||||
|
ok(isNaN(+"test") === true, "isNaN(+'test') !== true");
|
||||||
|
ok(isNaN(+"123t") === true, "isNaN(+'123t') !== true");
|
||||||
|
ok(isNaN(+"Infinity x") === true, "isNaN(+'Infinity x') !== true");
|
||||||
|
ok(+"Infinity" === Infinity, "+'Infinity' !== Infinity");
|
||||||
|
ok(+" Infinity " === Infinity, "+' Infinity ' !== Infinity");
|
||||||
|
ok(+"-Infinity" === -Infinity, "+'-Infinity' !== -Infinity");
|
||||||
|
|
||||||
reportSuccess();
|
reportSuccess();
|
||||||
|
Loading…
Reference in New Issue
Block a user