From 0f29f57fdc20f2fffbd0d8ce72d085d20710439c Mon Sep 17 00:00:00 2001
From: Leonardo Balter <leonardo.balter@gmail.com>
Date: Wed, 22 Jun 2016 12:40:52 -0400
Subject: [PATCH] Update Math functions to handle distinct -0 and +0

---
 test/built-ins/Math/abs/S15.8.2.1_A2.js       |  7 +-----
 test/built-ins/Math/acos/S15.8.2.2_A4.js      |  7 +-----
 test/built-ins/Math/asin/S15.8.2.3_A4.js      |  7 +-----
 test/built-ins/Math/asin/S15.8.2.3_A5.js      |  7 +-----
 test/built-ins/Math/atan/S15.8.2.4_A2.js      |  7 +-----
 test/built-ins/Math/atan/S15.8.2.4_A3.js      |  7 +-----
 test/built-ins/Math/atan2/S15.8.2.5_A14.js    |  3 +--
 test/built-ins/Math/atan2/S15.8.2.5_A16.js    |  7 ++++--
 test/built-ins/Math/atan2/S15.8.2.5_A4.js     |  3 +--
 test/built-ins/Math/atan2/S15.8.2.5_A5.js     |  6 +----
 test/built-ins/Math/atan2/S15.8.2.5_A8.js     |  7 ++++--
 test/built-ins/Math/atan2/S15.8.2.5_A9.js     |  6 +----
 test/built-ins/Math/ceil/S15.8.2.6_A2.js      |  7 +-----
 test/built-ins/Math/ceil/S15.8.2.6_A3.js      |  7 +-----
 test/built-ins/Math/ceil/S15.8.2.6_A6.js      | 23 +++----------------
 test/built-ins/Math/exp/S15.8.2.8_A5.js       |  7 +-----
 test/built-ins/Math/floor/S15.8.2.9_A2.js     |  7 +-----
 test/built-ins/Math/floor/S15.8.2.9_A3.js     |  7 +-----
 test/built-ins/Math/floor/S15.8.2.9_A6.js     | 23 +++----------------
 test/built-ins/Math/log/S15.8.2.10_A4.js      |  7 +-----
 .../Math/pow/applying-the-exp-operator_A12.js |  5 +---
 .../Math/pow/applying-the-exp-operator_A15.js |  5 +---
 .../Math/pow/applying-the-exp-operator_A16.js |  5 +---
 .../Math/pow/applying-the-exp-operator_A17.js |  5 +---
 .../Math/pow/applying-the-exp-operator_A19.js |  5 +---
 .../Math/pow/applying-the-exp-operator_A20.js |  5 +---
 .../Math/pow/applying-the-exp-operator_A6.js  |  5 +---
 .../Math/pow/applying-the-exp-operator_A9.js  |  5 +---
 test/built-ins/Math/round/S15.8.2.15_A2.js    |  7 +-----
 test/built-ins/Math/round/S15.8.2.15_A3.js    |  7 +-----
 test/built-ins/Math/sin/S15.8.2.16_A3.js      |  7 +-----
 test/built-ins/Math/sqrt/S15.8.2.17_A3.js     |  7 +-----
 test/built-ins/Math/sqrt/S15.8.2.17_A4.js     |  7 +-----
 test/built-ins/Math/tan/S15.8.2.18_A2.js      |  7 +-----
 test/built-ins/Math/tan/S15.8.2.18_A3.js      |  7 +-----
 35 files changed, 47 insertions(+), 204 deletions(-)

diff --git a/test/built-ins/Math/abs/S15.8.2.1_A2.js b/test/built-ins/Math/abs/S15.8.2.1_A2.js
index 1f1eaa7e95..aa62299e60 100644
--- a/test/built-ins/Math/abs/S15.8.2.1_A2.js
+++ b/test/built-ins/Math/abs/S15.8.2.1_A2.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.1_A2
 description: Checking if Math.abs(-0) equals to +0
 ---*/
 
-// CHECK#1
-var x = -0;
-if (Math.abs(x) !== +0)
-{
-	$ERROR("#1: 'var x=-0; Math.abs(x) !== +0'");
-}
+assert.sameValue(Math.abs(-0), 0);
diff --git a/test/built-ins/Math/acos/S15.8.2.2_A4.js b/test/built-ins/Math/acos/S15.8.2.2_A4.js
index 87e3ff1f2e..738a3b1445 100644
--- a/test/built-ins/Math/acos/S15.8.2.2_A4.js
+++ b/test/built-ins/Math/acos/S15.8.2.2_A4.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.2_A4
 description: Checking if Math.acos(1) equals to +0
 ---*/
 
-// CHECK#1
-var x = 1;
-if (Math.acos(x) !== +0)
-{
-	$ERROR("#1: 'var x = 1; Math.acos(x) !== +0'");
-}
+assert.sameValue(Math.acos(1), 0);
diff --git a/test/built-ins/Math/asin/S15.8.2.3_A4.js b/test/built-ins/Math/asin/S15.8.2.3_A4.js
index 8b21a28378..29d8055140 100644
--- a/test/built-ins/Math/asin/S15.8.2.3_A4.js
+++ b/test/built-ins/Math/asin/S15.8.2.3_A4.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.3_A4
 description: Checking if Math.asin(+0) equals +0
 ---*/
 
-// CHECK#1
-var x = +0;
-if (Math.asin(x) !== +0)
-{
-	$ERROR("#1: 'var x = +0; Math.asin(x) !== +0'");
-}
+assert.sameValue(Math.asin(0), 0);
diff --git a/test/built-ins/Math/asin/S15.8.2.3_A5.js b/test/built-ins/Math/asin/S15.8.2.3_A5.js
index 3c21880758..b5e8e7c6ba 100644
--- a/test/built-ins/Math/asin/S15.8.2.3_A5.js
+++ b/test/built-ins/Math/asin/S15.8.2.3_A5.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.3_A5
 description: Checking if Math.asin(-0) equals to -0
 ---*/
 
-// CHECK#1
-var x = -0;
-if (Math.asin(x) !== -0)
-{
-	$ERROR("#1: 'var x = -0; Math.asin(x) !== -0'");
-}
+assert.sameValue(Math.asin(-0), -0);
diff --git a/test/built-ins/Math/atan/S15.8.2.4_A2.js b/test/built-ins/Math/atan/S15.8.2.4_A2.js
index cc04a648b0..2d0e39fe86 100644
--- a/test/built-ins/Math/atan/S15.8.2.4_A2.js
+++ b/test/built-ins/Math/atan/S15.8.2.4_A2.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.4_A2
 description: Checking if Math.atan(+0) equals to +0
 ---*/
 
-// CHECK#1
-var x = +0;
-if (Math.atan(x) !== +0)
-{
-	$ERROR("#1: 'var x = +0; Math.atan(x) !== +0'");
-}
+assert.sameValue(Math.atan(0), 0);
diff --git a/test/built-ins/Math/atan/S15.8.2.4_A3.js b/test/built-ins/Math/atan/S15.8.2.4_A3.js
index 069ea8a8d2..d2dc13a3be 100644
--- a/test/built-ins/Math/atan/S15.8.2.4_A3.js
+++ b/test/built-ins/Math/atan/S15.8.2.4_A3.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.4_A3
 description: Checking if Math.atan(-0) equals to -0
 ---*/
 
-// CHECK#1
-var x = -0;
-if (Math.atan(x) !== -0)
-{
-	$ERROR("#1: 'var x = -0; Math.atan(x) !== -0'");
-}
+assert.sameValue(Math.atan(-0), -0);
diff --git a/test/built-ins/Math/atan2/S15.8.2.5_A14.js b/test/built-ins/Math/atan2/S15.8.2.5_A14.js
index 1827f23f30..51cbb27ff9 100644
--- a/test/built-ins/Math/atan2/S15.8.2.5_A14.js
+++ b/test/built-ins/Math/atan2/S15.8.2.5_A14.js
@@ -19,6 +19,5 @@ var ynum = 3;
 
 for (var i = 0; i < ynum; i++)
 {
-	if (Math.atan2(y[i],x) !== +0)
-		$ERROR("#1: Math.atan2(" + y[i] + ", " + x + ") !== +0");
+  assert.sameValue(Math.atan2(y[i], x), 0, y[i]);
 }
diff --git a/test/built-ins/Math/atan2/S15.8.2.5_A16.js b/test/built-ins/Math/atan2/S15.8.2.5_A16.js
index 4fb2ba1195..19f2509a17 100644
--- a/test/built-ins/Math/atan2/S15.8.2.5_A16.js
+++ b/test/built-ins/Math/atan2/S15.8.2.5_A16.js
@@ -19,6 +19,9 @@ var ynum = 3;
 
 for (var i = 0; i < ynum; i++)
 {
-	if (Math.atan2(y[i],x) !== -0)
-		$ERROR("#1: Math.atan2(" + y[i] + ", " + x + ") !== -0");
+  assert.sameValue(
+    Math.atan2(y[i], x),
+    -0,
+    "(" + y[i] + ", Infinity)"
+  );
 }
diff --git a/test/built-ins/Math/atan2/S15.8.2.5_A4.js b/test/built-ins/Math/atan2/S15.8.2.5_A4.js
index ce1101ad1c..ef663e63ff 100644
--- a/test/built-ins/Math/atan2/S15.8.2.5_A4.js
+++ b/test/built-ins/Math/atan2/S15.8.2.5_A4.js
@@ -17,6 +17,5 @@ var xnum = 3;
 
 for (var i = 0; i < xnum; i++)
 {
-	if (Math.atan2(y,x[i]) !== +0)
-		$ERROR("#1: Math.atan2(" + y + ", " + x[i] + ") !== +0");
+  assert.sameValue(Math.atan2(y, x[i]), 0, x[i]);
 }
diff --git a/test/built-ins/Math/atan2/S15.8.2.5_A5.js b/test/built-ins/Math/atan2/S15.8.2.5_A5.js
index aafdb801b5..3d8ac5bd1a 100644
--- a/test/built-ins/Math/atan2/S15.8.2.5_A5.js
+++ b/test/built-ins/Math/atan2/S15.8.2.5_A5.js
@@ -7,8 +7,4 @@ es5id: 15.8.2.5_A5
 description: Checking if Math.atan2(y,x) is +0, where y is +0 and x is +0
 ---*/
 
-// CHECK#1
-var y = +0;
-var x = +0;
-if (Math.atan2(y,x) !== +0)
-	$ERROR("#1: Math.atan2(" + y + ", " + x + ") !== +0");
+assert.sameValue(Math.atan2(0, 0), 0);
diff --git a/test/built-ins/Math/atan2/S15.8.2.5_A8.js b/test/built-ins/Math/atan2/S15.8.2.5_A8.js
index d7eb835794..64dc40028f 100644
--- a/test/built-ins/Math/atan2/S15.8.2.5_A8.js
+++ b/test/built-ins/Math/atan2/S15.8.2.5_A8.js
@@ -17,6 +17,9 @@ var xnum = 3;
 
 for (var i = 0; i < xnum; i++)
 {
-	if (Math.atan2(y,x[i]) !== -0)
-		$ERROR("#1: Math.atan2(" + y + ", " + x[i] + ") !== -0");
+  assert.sameValue(
+    Math.atan2(y, x[i]),
+    -0,
+    "(-0, " + x[i] + ")"
+  );
 }
diff --git a/test/built-ins/Math/atan2/S15.8.2.5_A9.js b/test/built-ins/Math/atan2/S15.8.2.5_A9.js
index fc892e706a..8b0c1da04a 100644
--- a/test/built-ins/Math/atan2/S15.8.2.5_A9.js
+++ b/test/built-ins/Math/atan2/S15.8.2.5_A9.js
@@ -7,8 +7,4 @@ es5id: 15.8.2.5_A9
 description: Checking if Math.atan2(y,x) is -0, where y is -0 and x is +0
 ---*/
 
-// CHECK#1
-var y = -0;
-var x = +0;
-if (Math.atan2(y,x) !== -0)
-	$ERROR("#1: Math.atan2(" + y + ", " + x + ") !== -0");
+assert.sameValue(Math.atan2(-0, 0), -0);
diff --git a/test/built-ins/Math/ceil/S15.8.2.6_A2.js b/test/built-ins/Math/ceil/S15.8.2.6_A2.js
index f4c6542011..e0d0b96120 100644
--- a/test/built-ins/Math/ceil/S15.8.2.6_A2.js
+++ b/test/built-ins/Math/ceil/S15.8.2.6_A2.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.6_A2
 description: Checking if Math.ceil(x) is +0, where x is +0
 ---*/
 
-// CHECK#1
-var x = +0;
-if (Math.ceil(x) !== +0)
-{
-	$ERROR("#1: 'var x = +0; Math.ceil(x) !== +0'");
-}
+assert.sameValue(Math.ceil(0), 0);
diff --git a/test/built-ins/Math/ceil/S15.8.2.6_A3.js b/test/built-ins/Math/ceil/S15.8.2.6_A3.js
index 80c10cfc80..4f06ec58f9 100644
--- a/test/built-ins/Math/ceil/S15.8.2.6_A3.js
+++ b/test/built-ins/Math/ceil/S15.8.2.6_A3.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.6_A3
 description: Checking if Math.ceil(x) is -0, where x is -0
 ---*/
 
-// CHECK#1
-var x = -0;
-if (Math.ceil(x) !== -0)
-{
-	$ERROR("#1: 'var x = -0; Math.ceil(x) !== -0'");
-}
+assert.sameValue(Math.ceil(-0), -0);
diff --git a/test/built-ins/Math/ceil/S15.8.2.6_A6.js b/test/built-ins/Math/ceil/S15.8.2.6_A6.js
index 5665ab1056..067dffe699 100644
--- a/test/built-ins/Math/ceil/S15.8.2.6_A6.js
+++ b/test/built-ins/Math/ceil/S15.8.2.6_A6.js
@@ -9,23 +9,6 @@ description: >
     than -1
 ---*/
 
-// CHECK#1
-var x = -0.000000000000001;
-if (Math.ceil(x) !== -0)
-{
-	$ERROR("#1: 'var x = -0.000000000000001; Math.ceil(x) !== -0'");
-}
-
-// CHECK#2
-var x = -0.999999999999999;
-if (Math.ceil(x) !== -0)
-{
-	$ERROR("#2: 'var x = -0.999999999999999; Math.ceil(x) !== -0'");
-}
-
-// CHECK#3
-var x = -0.5;
-if (Math.ceil(x) !== -0)
-{
-	$ERROR("#3: 'var x = -0.5; Math.ceil(x) !== -0'");
-}
+assert.sameValue(Math.ceil(-0.000000000000001), -0, "-0.000000000000001");
+assert.sameValue(Math.ceil(-0.999999999999999), -0, "-0.999999999999999");
+assert.sameValue(Math.ceil(-0.5), -0, "-0.5");
diff --git a/test/built-ins/Math/exp/S15.8.2.8_A5.js b/test/built-ins/Math/exp/S15.8.2.8_A5.js
index 4a26d60851..d2db7ced9d 100644
--- a/test/built-ins/Math/exp/S15.8.2.8_A5.js
+++ b/test/built-ins/Math/exp/S15.8.2.8_A5.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.8_A5
 description: Checking if Math.exp(-Infinity) is +0
 ---*/
 
-// CHECK#1
-var x = -Infinity;
-if (Math.exp(x) !== +0)
-{
-	$ERROR("#1: 'var x = -Infinity; Math.exp(x) !== +0'");
-}
+assert.sameValue(Math.exp(-Infinity), 0);
diff --git a/test/built-ins/Math/floor/S15.8.2.9_A2.js b/test/built-ins/Math/floor/S15.8.2.9_A2.js
index 68eca4808e..aace84d59d 100644
--- a/test/built-ins/Math/floor/S15.8.2.9_A2.js
+++ b/test/built-ins/Math/floor/S15.8.2.9_A2.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.9_A2
 description: Checking if Math.floor(x) is +0, where x is +0
 ---*/
 
-// CHECK#1
-var x = +0;
-if (Math.floor(x) !== +0)
-{
-	$ERROR("#1: 'var x = +0; Math.floor(x) !== +0'");
-}
+assert.sameValue(Math.floor(0), 0);
diff --git a/test/built-ins/Math/floor/S15.8.2.9_A3.js b/test/built-ins/Math/floor/S15.8.2.9_A3.js
index af028bdb98..57289eff4b 100644
--- a/test/built-ins/Math/floor/S15.8.2.9_A3.js
+++ b/test/built-ins/Math/floor/S15.8.2.9_A3.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.9_A3
 description: Checking if Math.floor(x) is -0, where x is -0
 ---*/
 
-// CHECK#1
-var x = -0;
-if (Math.floor(x) !== -0)
-{
-	$ERROR("#1: 'var x = -0; Math.floor(x) !== -0'");
-}
+assert.sameValue(Math.floor(-0), -0);
diff --git a/test/built-ins/Math/floor/S15.8.2.9_A6.js b/test/built-ins/Math/floor/S15.8.2.9_A6.js
index 52909cb035..34eca404af 100644
--- a/test/built-ins/Math/floor/S15.8.2.9_A6.js
+++ b/test/built-ins/Math/floor/S15.8.2.9_A6.js
@@ -9,23 +9,6 @@ description: >
     less than 1
 ---*/
 
-// CHECK#1
-var x = 0.000000000000001;
-if (Math.floor(x) !== +0)
-{
-	$ERROR("#1: 'var x = 0.000000000000001; Math.floor(x) !==  +0'");
-}
-
-// CHECK#2
-var x = 0.999999999999999;
-if (Math.floor(x) !== +0)
-{
-	$ERROR("#2: 'var x = 0.999999999999999; Math.ceil(x) !== +0'");
-}
-
-// CHECK#3
-var x = 0.5;
-if (Math.floor(x) !== +0)
-{
-	$ERROR("#3: 'var x = 0.5; Math.ceil(x) !== +0'");
-}
+assert.sameValue(Math.floor(0.000000000000001), 0, "0.000000000000001");
+assert.sameValue(Math.floor(0.999999999999999), 0, "0.999999999999999");
+assert.sameValue(Math.floor(0.5), 0, "0.5");
diff --git a/test/built-ins/Math/log/S15.8.2.10_A4.js b/test/built-ins/Math/log/S15.8.2.10_A4.js
index cd0ff197ca..6bbbba835e 100644
--- a/test/built-ins/Math/log/S15.8.2.10_A4.js
+++ b/test/built-ins/Math/log/S15.8.2.10_A4.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.10_A4
 description: Checking if Math.log(1) equals to +0
 ---*/
 
-// CHECK#1
-var x = 1;
-if (Math.log(x) !== +0)
-{
-	$ERROR("#1: 'var x=1; Math.log(x) !== +0'");
-}
+assert.sameValue(Math.log(1), 0);
diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A12.js b/test/built-ins/Math/pow/applying-the-exp-operator_A12.js
index 72a1a6e49f..e9dc94944f 100644
--- a/test/built-ins/Math/pow/applying-the-exp-operator_A12.js
+++ b/test/built-ins/Math/pow/applying-the-exp-operator_A12.js
@@ -17,8 +17,5 @@ var exponentnum = 4;
 
 for (var i = 0; i < exponentnum; i++)
 {
-	if (Math.pow(base,exponent[i]) !== +0)
-	{
-		$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +0");
-	}
+  assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]);
 }
diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A15.js b/test/built-ins/Math/pow/applying-the-exp-operator_A15.js
index 86de40f948..caf4f4f1a3 100644
--- a/test/built-ins/Math/pow/applying-the-exp-operator_A15.js
+++ b/test/built-ins/Math/pow/applying-the-exp-operator_A15.js
@@ -16,8 +16,5 @@ var exponentnum = 3;
 
 for (var i = 0; i < exponentnum; i++)
 {
-	if (Math.pow(base,exponent[i]) !== -0)
-	{
-		$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -0");
-	}
+  assert.sameValue(Math.pow(base, exponent[i]), -0, exponent[i]);
 }
diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A16.js b/test/built-ins/Math/pow/applying-the-exp-operator_A16.js
index 4c74246a1d..f4ef700400 100644
--- a/test/built-ins/Math/pow/applying-the-exp-operator_A16.js
+++ b/test/built-ins/Math/pow/applying-the-exp-operator_A16.js
@@ -18,8 +18,5 @@ var exponentnum = 5;
 
 for (var i = 0; i < exponentnum; i++)
 {
-	if (Math.pow(base,exponent[i]) !== +0)
-	{
-		$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +0");
-	}
+  assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]);
 }
diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A17.js b/test/built-ins/Math/pow/applying-the-exp-operator_A17.js
index a93442e7d0..388dcaf607 100644
--- a/test/built-ins/Math/pow/applying-the-exp-operator_A17.js
+++ b/test/built-ins/Math/pow/applying-the-exp-operator_A17.js
@@ -17,8 +17,5 @@ var exponentnum = 4;
 
 for (var i = 0; i < exponentnum; i++)
 {
-	if (Math.pow(base,exponent[i]) !== +0)
-	{
-		$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +0");
-	}
+  assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]);
 }
diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A19.js b/test/built-ins/Math/pow/applying-the-exp-operator_A19.js
index 2b592ee53b..fae8fa4bb7 100644
--- a/test/built-ins/Math/pow/applying-the-exp-operator_A19.js
+++ b/test/built-ins/Math/pow/applying-the-exp-operator_A19.js
@@ -16,8 +16,5 @@ var exponentnum = 3;
 
 for (var i = 0; i < exponentnum; i++)
 {
-	if (Math.pow(base,exponent[i]) !== -0)
-	{
-		$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -0");
-	}
+  assert.sameValue(Math.pow(base, exponent[i]), -0, exponent[i]);
 }
diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A20.js b/test/built-ins/Math/pow/applying-the-exp-operator_A20.js
index 5e07062cdc..b81837f074 100644
--- a/test/built-ins/Math/pow/applying-the-exp-operator_A20.js
+++ b/test/built-ins/Math/pow/applying-the-exp-operator_A20.js
@@ -18,8 +18,5 @@ var exponentnum = 5;
 
 for (var i = 0; i < exponentnum; i++)
 {
-	if (Math.pow(base,exponent[i]) !== +0)
-	{
-		$ERROR("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +0");
-	}
+  assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]);
 }
diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A6.js b/test/built-ins/Math/pow/applying-the-exp-operator_A6.js
index 1b71bbdc1a..a4bad1832b 100644
--- a/test/built-ins/Math/pow/applying-the-exp-operator_A6.js
+++ b/test/built-ins/Math/pow/applying-the-exp-operator_A6.js
@@ -19,8 +19,5 @@ var basenum = 6;
 
 for (var i = 0; i < basenum; i++)
 {
-	if (Math.pow(base[i],exponent) !== +0)
-	{
-		$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +0");
-	}
+  assert.sameValue(Math.pow(base[i], exponent), 0, base[i]);
 }
diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A9.js b/test/built-ins/Math/pow/applying-the-exp-operator_A9.js
index 104130bbc1..8801a29416 100644
--- a/test/built-ins/Math/pow/applying-the-exp-operator_A9.js
+++ b/test/built-ins/Math/pow/applying-the-exp-operator_A9.js
@@ -19,8 +19,5 @@ var basenum = 6;
 
 for (var i = 0; i < basenum; i++)
 {
-	if (Math.pow(base[i],exponent) !== +0)
-	{
-		$ERROR("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +0");
-	}
+  assert.sameValue(Math.pow(base[i], exponent), 0, exponent);
 }
diff --git a/test/built-ins/Math/round/S15.8.2.15_A2.js b/test/built-ins/Math/round/S15.8.2.15_A2.js
index 6c9bbfdf17..1dc804c693 100644
--- a/test/built-ins/Math/round/S15.8.2.15_A2.js
+++ b/test/built-ins/Math/round/S15.8.2.15_A2.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.15_A2
 description: Checking if Math.round(x) equals to +0, where x is +0
 ---*/
 
-// CHECK#1
-var x = +0;
-if (Math.round(x) !== +0)
-{
-	$ERROR("#1: 'var x=+0; Math.round(x) !== +0'");
-}
+assert.sameValue(Math.round(0), 0);
diff --git a/test/built-ins/Math/round/S15.8.2.15_A3.js b/test/built-ins/Math/round/S15.8.2.15_A3.js
index 1c67d522c3..e556db84da 100644
--- a/test/built-ins/Math/round/S15.8.2.15_A3.js
+++ b/test/built-ins/Math/round/S15.8.2.15_A3.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.15_A3
 description: Checking if Math.round(x) equals to -0, where x is -0
 ---*/
 
-// CHECK#1
-var x = -0;
-if (Math.round(x) !== -0)
-{
-	$ERROR("#1: 'var x=-0; Math.round(x) !== -0'");
-}
+assert.sameValue(Math.round(-0), -0);
diff --git a/test/built-ins/Math/sin/S15.8.2.16_A3.js b/test/built-ins/Math/sin/S15.8.2.16_A3.js
index aaaba2ce0c..e43b043112 100644
--- a/test/built-ins/Math/sin/S15.8.2.16_A3.js
+++ b/test/built-ins/Math/sin/S15.8.2.16_A3.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.16_A3
 description: Checking if Math.sin(-0) equals to -0
 ---*/
 
-// CHECK#1
-var x = -0;
-if (Math.sin(x) !== -0)
-{
-	$ERROR("#1: 'var x = -0; Math.sin(x) !== -0'");
-}
+assert.sameValue(Math.sin(-0), -0);
diff --git a/test/built-ins/Math/sqrt/S15.8.2.17_A3.js b/test/built-ins/Math/sqrt/S15.8.2.17_A3.js
index a4c739c728..5c5a2799fd 100644
--- a/test/built-ins/Math/sqrt/S15.8.2.17_A3.js
+++ b/test/built-ins/Math/sqrt/S15.8.2.17_A3.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.17_A3
 description: Checking if Math.sqrt(+0) equals to +0
 ---*/
 
-// CHECK#1
-var x = +0;
-if (Math.sqrt(x) !== +0)
-{
-	$ERROR("#1: 'var x=+0; Math.sqrt(x) !== +0'");
-}
+assert.sameValue(Math.sqrt(0), 0);
diff --git a/test/built-ins/Math/sqrt/S15.8.2.17_A4.js b/test/built-ins/Math/sqrt/S15.8.2.17_A4.js
index 63802eceea..de44f0f470 100644
--- a/test/built-ins/Math/sqrt/S15.8.2.17_A4.js
+++ b/test/built-ins/Math/sqrt/S15.8.2.17_A4.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.17_A4
 description: Checking if Math.sqrt(-0) equals to -0
 ---*/
 
-// CHECK#1
-var x = -0;
-if (Math.sqrt(x) !== -0)
-{
-	$ERROR("#1: 'var x=-0; Math.sqrt(x) !== -0'");
-}
+assert.sameValue(Math.sqrt(-0), -0);
diff --git a/test/built-ins/Math/tan/S15.8.2.18_A2.js b/test/built-ins/Math/tan/S15.8.2.18_A2.js
index a4c1ca8a01..88b57f75f1 100644
--- a/test/built-ins/Math/tan/S15.8.2.18_A2.js
+++ b/test/built-ins/Math/tan/S15.8.2.18_A2.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.18_A2
 description: Checking if Math.tan(+0) equals to +0
 ---*/
 
-// CHECK#1
-var x = +0;
-if (Math.tan(x) !== +0)
-{
-	$ERROR("#1: 'var x=+0; Math.tan(x) !== +0'");
-}
+assert.sameValue(Math.tan(0), 0);
diff --git a/test/built-ins/Math/tan/S15.8.2.18_A3.js b/test/built-ins/Math/tan/S15.8.2.18_A3.js
index 0a858ed528..8cef4798aa 100644
--- a/test/built-ins/Math/tan/S15.8.2.18_A3.js
+++ b/test/built-ins/Math/tan/S15.8.2.18_A3.js
@@ -7,9 +7,4 @@ es5id: 15.8.2.18_A3
 description: Checking if Math.tan(-0) equals to -0
 ---*/
 
-// CHECK#1
-var x = -0;
-if (Math.tan(x) !== -0)
-{
-	$ERROR("#1: 'var x=-0; Math.tan(x) !== -0'");
-}
+assert.sameValue(Math.tan(-0), -0);
-- 
GitLab