[pypy-svn] r64141 - in pypy/trunk/pypy/translator: cli/src jvm/test oosupport/test_template

antocuni at codespeak.net antocuni at codespeak.net
Thu Apr 16 11:44:35 CEST 2009


Author: antocuni
Date: Thu Apr 16 11:44:34 2009
New Revision: 64141

Modified:
   pypy/trunk/pypy/translator/cli/src/pypylib.cs
   pypy/trunk/pypy/translator/jvm/test/test_primitive.py
   pypy/trunk/pypy/translator/oosupport/test_template/builtin.py
Log:
(antocuni, niko) move test_rffi_primitive to oosupport and make it working also for cli


Modified: pypy/trunk/pypy/translator/cli/src/pypylib.cs
==============================================================================
--- pypy/trunk/pypy/translator/cli/src/pypylib.cs	(original)
+++ pypy/trunk/pypy/translator/cli/src/pypylib.cs	Thu Apr 16 11:44:34 2009
@@ -765,4 +765,13 @@
             System.Threading.Thread.Sleep((int)(seconds*1000));
         }
     }
+
+    public class rffi
+    {
+      public static int tolower(int chr)
+      {
+        return (int)Char.ToLower((char)chr);
+      }
+    }
+
 }

Modified: pypy/trunk/pypy/translator/jvm/test/test_primitive.py
==============================================================================
--- pypy/trunk/pypy/translator/jvm/test/test_primitive.py	(original)
+++ pypy/trunk/pypy/translator/jvm/test/test_primitive.py	Thu Apr 16 11:44:34 2009
@@ -12,19 +12,3 @@
         t1 = self.interpret(fn, [])
         t2 = self.interpret(fn, [])
         assert t1 <= t2
-
-    def test_rffi_primitive(self):
-        from pypy.rpython.lltypesystem import rffi, lltype
-        from pypy.translator.tool.cbuild import ExternalCompilationInfo
-        eci = ExternalCompilationInfo(
-            includes = ['ctype.h']
-        )
-        tolower = rffi.llexternal('tolower', [lltype.Signed], lltype.Signed,
-                                  compilation_info=eci,
-                                  oo_primitive='tolower')
-        assert tolower._ptr._obj.oo_primitive == 'tolower'
-
-        def fn(n):
-            return tolower(n)
-        res = self.interpret(fn, [ord('A')])
-        assert res == ord('a')

Modified: pypy/trunk/pypy/translator/oosupport/test_template/builtin.py
==============================================================================
--- pypy/trunk/pypy/translator/oosupport/test_template/builtin.py	(original)
+++ pypy/trunk/pypy/translator/oosupport/test_template/builtin.py	Thu Apr 16 11:44:34 2009
@@ -171,6 +171,24 @@
                 assert act_res.item0 == exp_res[0]
                 assert act_res.item1 == exp_res[1]
 
+
+    def test_rffi_primitive(self):
+        from pypy.rpython.lltypesystem import rffi, lltype
+        from pypy.translator.tool.cbuild import ExternalCompilationInfo
+        eci = ExternalCompilationInfo(
+            includes = ['ctype.h']
+        )
+        tolower = rffi.llexternal('tolower', [lltype.Signed], lltype.Signed,
+                                  compilation_info=eci,
+                                  oo_primitive='tolower')
+        assert tolower._ptr._obj.oo_primitive == 'tolower'
+
+        def fn(n):
+            return tolower(n)
+        res = self.interpret(fn, [ord('A')])
+        assert res == ord('a')
+
+
 class BaseTestTime(llBaseTestTime):
 
     def test_time_clock(self):



More information about the Pypy-commit mailing list