[pypy-commit] pypy ffistruct: add tests for floats and doubles

antocuni noreply at buildbot.pypy.org
Thu Jan 12 14:28:20 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: ffistruct
Changeset: r51263:ff33c5e7f4a9
Date: 2012-01-10 15:04 +0100
http://bitbucket.org/pypy/pypy/changeset/ff33c5e7f4a9/

Log:	add tests for floats and doubles

diff --git a/pypy/module/_ffi/test/test_type_converter.py b/pypy/module/_ffi/test/test_type_converter.py
--- a/pypy/module/_ffi/test/test_type_converter.py
+++ b/pypy/module/_ffi/test/test_type_converter.py
@@ -1,6 +1,6 @@
 import sys
 from pypy.conftest import gettestobjspace
-from pypy.rlib.rarithmetic import r_uint
+from pypy.rlib.rarithmetic import r_uint, r_singlefloat
 from pypy.module._ffi.interp_ffitype import app_types, descr_new_pointer
 from pypy.module._ffi.type_converter import FromAppLevelConverter, ToAppLevelConverter
 
@@ -60,6 +60,11 @@
         self.check(app_types.char, space.wrap('a'), ord('a'))
         self.check(app_types.unichar, space.wrap(u'\u1234'), 0x1234)
 
+    def test_float_and_double(self):
+        space = self.space
+        self.check(app_types.float, space.wrap(12.34), r_singlefloat(12.34))
+        self.check(app_types.double, space.wrap(12.34), 12.34)
+
     def test_pointer(self):
         # pointers are "unsigned" at applevel, but signed at interp-level (for
         # no good reason, at interp-level Signed or Unsigned makes no


More information about the pypy-commit mailing list