Specify argtypes for all test functions. Maybe that helps on strange ;-) architectures

This commit is contained in:
Thomas Heller 2006-06-06 15:34:18 +00:00
parent 215f13dd11
commit 56dab85022
3 changed files with 924 additions and 108 deletions

View File

@ -245,7 +245,6 @@ and how to embed it in other applications.
\input{libplatform} \input{libplatform}
\input{liberrno} \input{liberrno}
\input{libctypes} \input{libctypes}
\input{libctypesref}
\input{libsomeos} % Optional Operating System Services \input{libsomeos} % Optional Operating System Services
\input{libselect} \input{libselect}

File diff suppressed because it is too large Load Diff

View File

@ -40,41 +40,49 @@ class CFunctions(unittest.TestCase):
def test_short(self): def test_short(self):
self._dll.tf_h.restype = c_short self._dll.tf_h.restype = c_short
self._dll.tf_h.argtypes = (c_short,)
self.failUnlessEqual(self._dll.tf_h(-32766), -10922) self.failUnlessEqual(self._dll.tf_h(-32766), -10922)
self.failUnlessEqual(self.S(), -32766) self.failUnlessEqual(self.S(), -32766)
def test_short_plus(self): def test_short_plus(self):
self._dll.tf_bh.restype = c_short self._dll.tf_bh.restype = c_short
self._dll.tf_bh.argtypes = (c_byte, c_short)
self.failUnlessEqual(self._dll.tf_bh(0, -32766), -10922) self.failUnlessEqual(self._dll.tf_bh(0, -32766), -10922)
self.failUnlessEqual(self.S(), -32766) self.failUnlessEqual(self.S(), -32766)
def test_ushort(self): def test_ushort(self):
self._dll.tf_H.restype = c_ushort self._dll.tf_H.restype = c_ushort
self._dll.tf_H.argtypes = (c_ushort,)
self.failUnlessEqual(self._dll.tf_H(65535), 21845) self.failUnlessEqual(self._dll.tf_H(65535), 21845)
self.failUnlessEqual(self.U(), 65535) self.failUnlessEqual(self.U(), 65535)
def test_ushort_plus(self): def test_ushort_plus(self):
self._dll.tf_bH.restype = c_ushort self._dll.tf_bH.restype = c_ushort
self._dll.tf_bH.argtypes = (c_byte, c_ushort)
self.failUnlessEqual(self._dll.tf_bH(0, 65535), 21845) self.failUnlessEqual(self._dll.tf_bH(0, 65535), 21845)
self.failUnlessEqual(self.U(), 65535) self.failUnlessEqual(self.U(), 65535)
def test_int(self): def test_int(self):
self._dll.tf_i.restype = c_int self._dll.tf_i.restype = c_int
self._dll.tf_i.argtypes = (c_int,)
self.failUnlessEqual(self._dll.tf_i(-2147483646), -715827882) self.failUnlessEqual(self._dll.tf_i(-2147483646), -715827882)
self.failUnlessEqual(self.S(), -2147483646) self.failUnlessEqual(self.S(), -2147483646)
def test_int_plus(self): def test_int_plus(self):
self._dll.tf_bi.restype = c_int self._dll.tf_bi.restype = c_int
self._dll.tf_bi.argtypes = (c_byte, c_int)
self.failUnlessEqual(self._dll.tf_bi(0, -2147483646), -715827882) self.failUnlessEqual(self._dll.tf_bi(0, -2147483646), -715827882)
self.failUnlessEqual(self.S(), -2147483646) self.failUnlessEqual(self.S(), -2147483646)
def test_uint(self): def test_uint(self):
self._dll.tf_I.restype = c_uint self._dll.tf_I.restype = c_uint
self._dll.tf_I.argtypes = (c_uint,)
self.failUnlessEqual(self._dll.tf_I(4294967295), 1431655765) self.failUnlessEqual(self._dll.tf_I(4294967295), 1431655765)
self.failUnlessEqual(self.U(), 4294967295) self.failUnlessEqual(self.U(), 4294967295)
def test_uint_plus(self): def test_uint_plus(self):
self._dll.tf_bI.restype = c_uint self._dll.tf_bI.restype = c_uint
self._dll.tf_bI.argtypes = (c_byte, c_uint)
self.failUnlessEqual(self._dll.tf_bI(0, 4294967295), 1431655765) self.failUnlessEqual(self._dll.tf_bI(0, 4294967295), 1431655765)
self.failUnlessEqual(self.U(), 4294967295) self.failUnlessEqual(self.U(), 4294967295)