From 6e61c27aa5b2b12ed63890e4ec9be168baeee4ea Mon Sep 17 00:00:00 2001
From: Mike Pennisi <mike@mikepennisi.com>
Date: Thu, 17 Mar 2016 17:08:29 -0400
Subject: [PATCH] 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.
---
 test/built-ins/Math/random/S15.8.2.14_A1.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/built-ins/Math/random/S15.8.2.14_A1.js b/test/built-ins/Math/random/S15.8.2.14_A1.js
index e161a54fe1..bb5f652282 100644
--- a/test/built-ins/Math/random/S15.8.2.14_A1.js
+++ b/test/built-ins/Math/random/S15.8.2.14_A1.js
@@ -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);
-- 
GitLab