[pypy-commit] pypy ffistruct: add a test for shorts

antocuni noreply at buildbot.pypy.org
Wed Nov 9 13:51:16 CET 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: ffistruct
Changeset: r49004:b1f919c81753
Date: 2011-11-09 12:33 +0100
http://bitbucket.org/pypy/pypy/changeset/b1f919c81753/

Log:	add a test for shorts

diff --git a/pypy/module/_ffi/test/test_struct.py b/pypy/module/_ffi/test/test_struct.py
--- a/pypy/module/_ffi/test/test_struct.py
+++ b/pypy/module/_ffi/test/test_struct.py
@@ -137,6 +137,7 @@
         longsize = types.slong.sizeof()
         fields = [
             Field('sbyte', types.sbyte),
+            Field('sshort', types.sshort),
             Field('sint', types.sint),
             Field('slong', types.slong),
             ]
@@ -144,13 +145,14 @@
         struct = descr.allocate()
         struct.setfield('sbyte', 128)
         assert struct.getfield('sbyte') == -128
+        struct.setfield('sshort', 32768)
+        assert struct.getfield('sshort') == -32768
         struct.setfield('sint', 43)
         assert struct.getfield('sint') == 43
         struct.setfield('slong', sys.maxint+1)
         assert struct.getfield('slong') == -sys.maxint-1
         struct.setfield('slong', sys.maxint*3)
         assert struct.getfield('slong') == sys.maxint-2
-
         
     def test_compute_shape(self):
         from _ffi import Structure, Field, types


More information about the pypy-commit mailing list