-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: improve test-arm-math-illegal-instruction.js #37670
Conversation
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.
What do you think about doing something like this instead:
Object.getOwnPropertyNames(Math).forEach(function (functionName) {
if (!/[A-Z]/.test(functionName)) {
// The function names don't have capital letters.
Math[functionName](-0.5);
}
});
That way, we don't have to manually keep a track of all the function names.
This seems like a great idea. |
I don't think that will be a problem given the purpose of the test: node/test/parallel/test-arm-math-illegal-instruction.js Lines 4 to 7 in f355549
I think it's just checking whether calling any of these Math functions end up failing with an illegal instruction error, so it does not really matter what we feed into these functions provided the error does not happen.
|
That sounds fair. The functions that require more than one parameters are simply returning |
This seems a great solution to me. Let's wait for more reviews. |
+1 on @RaisinTen idea. FWIW we could use |
New changes made as per @RaisinTen's idea. |
Instead of writing each Math function and keeping track, loop over Math functions and test each one of them. PR-URL: #37670 Reviewed-By: Darshan Sen <raisinten@gmail.com>
Landed in 67d2262 |
Instead of writing each Math function and keeping track, loop over Math functions and test each one of them. PR-URL: #37670 Reviewed-By: Darshan Sen <raisinten@gmail.com>
Instead of writing each Math function and keeping track, loop over Math functions and test each one of them. PR-URL: #37670 Reviewed-By: Darshan Sen <raisinten@gmail.com>
add
Math.clz32(x)
to the test