[pypy-commit] pypy default: Add tests

arigo noreply at buildbot.pypy.org
Sat Feb 8 11:14:43 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r69096:4d5c3e138c63
Date: 2014-02-08 11:01 +0100
http://bitbucket.org/pypy/pypy/changeset/4d5c3e138c63/

Log:	Add tests

diff --git a/rpython/jit/metainterp/test/test_history.py b/rpython/jit/metainterp/test/test_history.py
--- a/rpython/jit/metainterp/test/test_history.py
+++ b/rpython/jit/metainterp/test/test_history.py
@@ -1,5 +1,6 @@
 from rpython.jit.metainterp.history import *
 from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
+from rpython.rlib.rfloat import NAN, INFINITY
 
 
 def test_repr():
@@ -38,3 +39,20 @@
     assert not c3a.same_constant(c1b)
     assert not c3a.same_constant(c2b)
     assert     c3a.same_constant(c3b)
+
+def test_same_constant_float():
+    c1 = Const._new(12.34)
+    c2 = Const._new(12.34)
+    c3 = Const._new(NAN)
+    c4 = Const._new(NAN)
+    c5 = Const._new(INFINITY)
+    c6 = Const._new(INFINITY)
+    assert c1.same_constant(c2)
+    assert c3.same_constant(c4)
+    assert c5.same_constant(c6)
+    assert not c1.same_constant(c4)
+    assert not c1.same_constant(c6)
+    assert not c3.same_constant(c2)
+    assert not c3.same_constant(c6)
+    assert not c5.same_constant(c2)
+    assert not c5.same_constant(c4)


More information about the pypy-commit mailing list