Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1241)

Unified Diff: test/mjsunit/harmony/math-sign.js

Issue 28723002: Harmony: implement Math.sign. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: complete test Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/harmony-math.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/math-sign.js
diff --git a/src/hydrogen-bch.h b/test/mjsunit/harmony/math-sign.js
similarity index 64%
copy from src/hydrogen-bch.h
copy to test/mjsunit/harmony/math-sign.js
index a22dacdd4229748e2735b3c0d8519c927b2f617d..8a89d62828bdbd43a972498f0b32d1a27939171e 100644
--- a/src/hydrogen-bch.h
+++ b/test/mjsunit/harmony/math-sign.js
@@ -25,31 +25,24 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef V8_HYDROGEN_BCH_H_
-#define V8_HYDROGEN_BCH_H_
-
-#include "hydrogen.h"
-
-namespace v8 {
-namespace internal {
-
-
-class HBoundsCheckHoistingPhase : public HPhase {
- public:
- explicit HBoundsCheckHoistingPhase(HGraph* graph)
- : HPhase("H_Bounds checks hoisting", graph) { }
-
- void Run() {
- HoistRedundantBoundsChecks();
- }
-
- private:
- void HoistRedundantBoundsChecks();
-
- DISALLOW_COPY_AND_ASSIGN(HBoundsCheckHoistingPhase);
-};
-
-
-} } // namespace v8::internal
-
-#endif // V8_HYDROGEN_BCE_H_
+// Flags: --harmony-maths
+
+assertEquals("Infinity", String(1/Math.sign(0)));
Dmitry Lomov (no reviews) 2013/10/21 06:57:58 Needs tests for +0 and -0: var x = 1e-200 var y =
Sven Panne 2013/10/21 07:18:39 Why do we need this? I thought the line below alre
Yang 2013/10/21 07:53:23 The line below does test the -0 case. Using actual
+assertEquals("-Infinity", String(1/Math.sign(-0)));
+assertEquals(1, Math.sign(100));
+assertEquals(-1, Math.sign(-199));
+assertEquals(1, Math.sign(100.1));
+assertTrue(isNaN(Math.sign("abc")));
+assertTrue(isNaN(Math.sign({})));
+assertEquals(0, Math.sign([]));
+assertEquals(1, Math.sign([1]));
+assertEquals(-1, Math.sign([-100.1]));
+assertTrue(isNaN(Math.sign([1, 1])));
+assertEquals(1, Math.sign({ toString: function() { return "100"; } }));
+assertEquals(1, Math.sign({ toString: function() { return 100; } }));
+assertEquals(-1, Math.sign({ valueOf: function() { return -1.1; } }));
+assertEquals(-1, Math.sign({ valueOf: function() { return "-1.1"; } }));
+assertEquals(-1, Math.sign(-Infinity));
+assertEquals(1, Math.sign(Infinity));
+assertEquals(-1, Math.sign("-Infinity"));
+assertEquals(1, Math.sign("Infinity"));
« no previous file with comments | « src/harmony-math.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698