[pypy-svn] r22544 - pypy/dist/pypy/rpython/rctypes/test

gromit at codespeak.net gromit at codespeak.net
Mon Jan 23 18:37:03 CET 2006


Author: gromit
Date: Mon Jan 23 18:37:02 2006
New Revision: 22544

Modified:
   pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py
Log:
ADD: (gromit,stephan) A rtyping testcase for atoi.

Modified: pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py	(original)
+++ pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py	Mon Jan 23 18:37:02 2006
@@ -5,25 +5,37 @@
         import ctypes
     except ImportError:
         py.test.skip("this test needs ctypes installed")
-
-class Test_rctypes:
-    def test_simple(self):
-        from pypy.rpython.rctypes.interface import cdll, c_char_p, c_int
-
+    else:
         import sys
+        from pypy.rpython.rctypes.interface import cdll, c_char_p, c_int
         if sys.platform == 'win32':
             mylib = cdll.LoadLibrary('msvcrt.dll')
         elif sys.platform == 'linux2':
             mylib = cdll.LoadLibrary('libc.so.6')
         else:
             py.test.skip("don't know how to load the c lib for %s" % 
-                          sys.platform)
+                    sys.platform)
 
         atoi = mylib.atoi
         atoi.restype = c_int
         atoi.argstype = [c_char_p]
         def o_atoi(a):
            return atoi(a)
+        mod.o_atoi = o_atoi
+
+
+class Test_rctypes:
+
+    from pypy.annotation.annrpython import RPythonAnnotator
+    
+    def test_simple(self):
+
 
         res = o_atoi('42')   
         assert res == 42 
+
+    def inprogress_test_annotate_simple(self):
+        a = self.RPythonAnnotator()
+        s = a.build_types(o_atoi, [str])
+        # result should be an integer
+        assert s.knowntype == int



More information about the Pypy-commit mailing list