From 13e01e434096b1af9498f64e531b5739500b9f04 Mon Sep 17 00:00:00 2001
From: Leonardo Balter <leonardo.balter@gmail.com>
Date: Wed, 22 Jun 2016 12:24:57 -0400
Subject: [PATCH] Add tests for Math.{max,min} handling zeros

---
 test/built-ins/Math/max/S15.8.2.11_A3.js | 20 --------------------
 test/built-ins/Math/max/zeros.js         | 21 +++++++++++++++++++++
 test/built-ins/Math/min/S15.8.2.12_A3.js | 20 --------------------
 test/built-ins/Math/min/zeros.js         | 21 +++++++++++++++++++++
 4 files changed, 42 insertions(+), 40 deletions(-)
 delete mode 100644 test/built-ins/Math/max/S15.8.2.11_A3.js
 create mode 100644 test/built-ins/Math/max/zeros.js
 delete mode 100644 test/built-ins/Math/min/S15.8.2.12_A3.js
 create mode 100644 test/built-ins/Math/min/zeros.js

diff --git a/test/built-ins/Math/max/S15.8.2.11_A3.js b/test/built-ins/Math/max/S15.8.2.11_A3.js
deleted file mode 100644
index ea35d1fcf5..0000000000
--- a/test/built-ins/Math/max/S15.8.2.11_A3.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2009 the Sputnik authors.  All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-info: +0 is considered to be larger than -0
-es5id: 15.8.2.11_A3
-description: Checking if Math.max(-0,+0) and Math.max(+0,-0) equals to +0
----*/
-
-// CHECK#1
-if (Math.max(-0, +0) !== +0)
-{
-	$ERROR("#1: 'Math.max(-0, +0) !== +0'");
-}
-
-// CHECK#1
-if (Math.max(+0, -0) !== +0)
-{
-	$ERROR("#2: 'Math.max(+0, -0) !== +0'");
-}
diff --git a/test/built-ins/Math/max/zeros.js b/test/built-ins/Math/max/zeros.js
new file mode 100644
index 0000000000..8be2cf7f60
--- /dev/null
+++ b/test/built-ins/Math/max/zeros.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-math.max
+es6id: 20.2.2.24
+description: >
+  +0 is considered to be larger than -0
+info: |
+  Math.max ( value1, value2 , …values )
+
+  The comparison of values to determine the largest value is done using the
+  Abstract Relational Comparison algorithm except that +0 is considered to be
+  larger than -0.
+---*/
+
+assert.sameValue(Math.max(0, 0), 0, "(0, 0)");
+assert.sameValue(Math.max(-0, -0), -0, "(-0, -0)");
+assert.sameValue(Math.max(0, -0), 0, "(0, -0)");
+assert.sameValue(Math.max(-0, 0), 0, "(-0, 0)");
+assert.sameValue(Math.max(0, 0, -0), 0, "(0, 0, -0)");
diff --git a/test/built-ins/Math/min/S15.8.2.12_A3.js b/test/built-ins/Math/min/S15.8.2.12_A3.js
deleted file mode 100644
index 7b6049fb14..0000000000
--- a/test/built-ins/Math/min/S15.8.2.12_A3.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2009 the Sputnik authors.  All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-info: +0 is considered to be larger than -0
-es5id: 15.8.2.12_A3
-description: Checking if Math.max(-0,+0) and Math.max(+0,-0) equals to -0
----*/
-
-// CHECK#1
-if (Math.max(-0, +0) !== -0)
-{
-	$ERROR("#1: 'Math.max(-0, +0) !== -0'");
-}
-
-// CHECK#1
-if (Math.max(+0, -0) !== -0)
-{
-	$ERROR("#2: 'Math.max(+0, -0) !== -0'");
-}
diff --git a/test/built-ins/Math/min/zeros.js b/test/built-ins/Math/min/zeros.js
new file mode 100644
index 0000000000..4889fdff94
--- /dev/null
+++ b/test/built-ins/Math/min/zeros.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-math.min
+es6id: 20.2.2.25
+description: >
+  +0 is considered to be larger than -0
+info: |
+  Math.min ( value1, value2 , …values )
+
+  The comparison of values to determine the smallest value is done using the
+  Abstract Relational Comparison algorithm except that +0 is considered to be
+  larger than -0.
+---*/
+
+assert.sameValue(Math.min(0, 0), 0, "(0, 0)");
+assert.sameValue(Math.min(-0, -0), -0, "(-0, -0)");
+assert.sameValue(Math.min(0, -0), -0, "(0, -0)");
+assert.sameValue(Math.min(-0, 0), -0, "(-0, 0)");
+assert.sameValue(Math.min(0, 0, -0), -0, "(0, 0, -0)");
-- 
GitLab