Skip to content

Commit 6ed9e0b

Browse files
marsonyaruyadorno
authored andcommittedMar 24, 2021
test: improve test-arm-math-illegal-instruction
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 <[email protected]>
1 parent 95aa032 commit 6ed9e0b

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed
 

‎test/parallel/test-arm-math-illegal-instruction.js

+7-27
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,10 @@ require('../common');
66
// See https://github.com/nodejs/node/issues/1376
77
// and https://code.google.com/p/v8/issues/detail?id=4019
88

9-
Math.abs(-0.5);
10-
Math.acos(-0.5);
11-
Math.acosh(-0.5);
12-
Math.asin(-0.5);
13-
Math.asinh(-0.5);
14-
Math.atan(-0.5);
15-
Math.atanh(-0.5);
16-
Math.cbrt(-0.5);
17-
Math.ceil(-0.5);
18-
Math.cos(-0.5);
19-
Math.cosh(-0.5);
20-
Math.exp(-0.5);
21-
Math.expm1(-0.5);
22-
Math.floor(-0.5);
23-
Math.fround(-0.5);
24-
Math.log(-0.5);
25-
Math.log10(-0.5);
26-
Math.log1p(-0.5);
27-
Math.log2(-0.5);
28-
Math.round(-0.5);
29-
Math.sign(-0.5);
30-
Math.sin(-0.5);
31-
Math.sinh(-0.5);
32-
Math.sqrt(-0.5);
33-
Math.tan(-0.5);
34-
Math.tanh(-0.5);
35-
Math.trunc(-0.5);
9+
// Iterate over all Math functions
10+
Object.getOwnPropertyNames(Math).forEach((functionName) => {
11+
if (!/[A-Z]/.test(functionName)) {
12+
// The function names don't have capital letters.
13+
Math[functionName](-0.5);
14+
}
15+
});

0 commit comments

Comments
 (0)
Please sign in to comment.