[pypy-svn] r43641 - pypy/dist/pypy/rlib/test

cfbolz at codespeak.net cfbolz at codespeak.net
Fri May 25 19:09:32 CEST 2007


Author: cfbolz
Date: Fri May 25 19:09:31 2007
New Revision: 43641

Added:
   pypy/dist/pypy/rlib/test/test_jit.py   (contents, props changed)
Modified:
   pypy/dist/pypy/rlib/test/test_objectmodel.py
Log:
move jit rlib tests into their own file. fixes them, too, because the imports
were wrong.


Added: pypy/dist/pypy/rlib/test/test_jit.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rlib/test/test_jit.py	Fri May 25 19:09:31 2007
@@ -0,0 +1,31 @@
+import py
+from pypy.rlib.jit import hint, _is_early_constant
+from pypy.translator.translator import TranslationContext, graphof
+from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
+
+class TestJIT(BaseRtypingTest, LLRtypeMixin):
+    def test_hint(self):
+        def f():
+            x = hint(5, hello="world")
+            return x
+        res = self.interpret(f, [])
+        assert res == 5
+
+    def test_is_early_constant(self):
+        def f(x):
+            if _is_early_constant(x):
+                return 42
+            return 0
+
+        assert f(3) == 0
+        res = self.interpret(f, [5])
+        assert res == 0
+
+        def g():
+            return f(88)
+        
+        res = self.interpret(g, [])
+        assert res == 42
+
+
+

Modified: pypy/dist/pypy/rlib/test/test_objectmodel.py
==============================================================================
--- pypy/dist/pypy/rlib/test/test_objectmodel.py	(original)
+++ pypy/dist/pypy/rlib/test/test_objectmodel.py	Fri May 25 19:09:31 2007
@@ -269,14 +269,6 @@
         res = self.interpret(g, [3])
         assert res == 77
 
-    def test_hint(self):
-        from pypy.rlib import objectmodel
-        def f():
-            x = objectmodel.hint(5, hello="world")
-            return x
-        res = self.interpret(f, [])
-        assert res == 5
-
 class TestLLtype(BaseTestObjectModel, LLRtypeMixin):
 
     def test_cast_to_and_from_weakaddress(self):
@@ -312,23 +304,6 @@
         res = self.interpret(f, [])
         assert res == 1
 
-    def test_is_early_constant(self):
-        from pypy.rlib import objectmodel
-        def f(x):
-            if objectmodel._is_early_constant(x):
-                return 42
-            return 0
-
-        assert f(3) == 0
-        res = self.interpret(f, [5])
-        assert res == 0
-
-        def g():
-            return f(88)
-        
-        res = self.interpret(g, [])
-        assert res == 42
-
 
 class TestOOtype(BaseTestObjectModel, OORtypeMixin):
     pass



More information about the Pypy-commit mailing list