Skip to content
Snippets Groups Projects
Commit 6e61c27a authored by Mike Pennisi's avatar Mike Pennisi
Browse files

Avoid false positives

As written, the test for `Math.random` would pass if the runtime
erroneously produced a non-numeric value. Add the necessary assertions
to guard against this case.
parent b1c979d3
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,12 @@ description: >
for (var i = 0; i < 100; i++)
{
var val = Math.random();
assert.sameValue(
typeof val, 'number', 'should not produce a non-numeric value: ' + val
);
assert.notSameValue(val, NaN, 'should not produce NaN');
if (val < 0 || val >= 1)
{
$ERROR("#1: Math.random() = " + val);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment