-
Notifications
You must be signed in to change notification settings - Fork 340
Conversation
test/addons-napi/test_number/test.js
Outdated
|
||
// Test non-finite numbers | ||
testInt64(Number.POSITIVE_INFINITY, 0); | ||
testInt64(Number.NEGATIVE_INFINITY, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two will fail if ported upstream until std::isnan
is replaced with !std::isinfinite
test/addons-napi/test_number/test.js
Outdated
// Test min/max double value | ||
testInt64(Number.MIN_VALUE, 0); | ||
testInt64(-Number.MIN_VALUE, 0); | ||
////testInt64(Number.MAX_VALUE, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these ones work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. I'm not a big fan of checking-in commented-out tests unless there's a reason.
test/addons-napi/test_number/test.js
Outdated
testInt64(Number.MIN_VALUE, 0); | ||
testInt64(-Number.MIN_VALUE, 0); | ||
////testInt64(Number.MAX_VALUE, 0); | ||
////testInt64(-Number.MAX_VALUE, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear what to do with these, we currently return 0x8000000000000000
when the cast fails (this appears to match the V8 behavior as well), but in reality this value just indicates that the operation failed. This appears to be the standard behavior for the cvttsd2si, but is platform-specific.
My preference would be to treat this as an error and return an error code indicating that the conversion failed.
Also updated/added tests for `Number` and `int32_t` as well. Updated N-API int64 behavior to check for all non-finite numbers instead of just NaN. PR-URL: nodejs#500 Reviewed-By: Taylor Woll <tawoll@ntdev.microsoft.com>
Also updated/added tests for `Number` and `int32_t` as well. Updated N-API int64 behavior to check for all non-finite numbers instead of just NaN. PR-URL: nodejs#500 Reviewed-By: Taylor Woll <tawoll@ntdev.microsoft.com>
Also updated/added tests for `Number` and `int32_t` as well. Updated N-API int64 behavior to check for all non-finite numbers instead of just NaN. PR-URL: nodejs#500 Reviewed-By: Taylor Woll <tawoll@ntdev.microsoft.com>
* Updated tests for `Number` and `int32_t` * Added new tests for `int64_t` * Updated N-API `int64_t` behavior to return zero for all non-finite numbers * Clarified the documentation for these calls. PR-URL: #19402 Refs: nodejs/node-chakracore#500 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* Updated tests for `Number` and `int32_t` * Added new tests for `int64_t` * Updated N-API `int64_t` behavior to return zero for all non-finite numbers * Clarified the documentation for these calls. PR-URL: nodejs#19402 Refs: nodejs/node-chakracore#500 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* Updated tests for `Number` and `int32_t` * Added new tests for `int64_t` * Updated N-API `int64_t` behavior to return zero for all non-finite numbers * Clarified the documentation for these calls. PR-URL: #19402 Refs: nodejs/node-chakracore#500 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* Updated tests for `Number` and `int32_t` * Added new tests for `int64_t` * Updated N-API `int64_t` behavior to return zero for all non-finite numbers * Clarified the documentation for these calls. PR-URL: nodejs#19402 Refs: nodejs/node-chakracore#500 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* Updated tests for `Number` and `int32_t` * Added new tests for `int64_t` * Updated N-API `int64_t` behavior to return zero for all non-finite numbers * Clarified the documentation for these calls. Backport-PR-URL: #19447 PR-URL: #19402 Refs: nodejs/node-chakracore#500 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* Updated tests for `Number` and `int32_t` * Added new tests for `int64_t` * Updated N-API `int64_t` behavior to return zero for all non-finite numbers * Clarified the documentation for these calls. Backport-PR-URL: #19265 PR-URL: #19402 Refs: nodejs/node-chakracore#500 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Also updated/added tests for
Number
andint32_t
as well.Updated N-API int64 behavior to check for all non-finite numbers
instead of just NaN.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes