PageRenderTime 187ms CodeModel.GetById 85ms app.highlight 3ms RepoModel.GetById 97ms app.codeStats 0ms

/Lib/ctypes/test/test_sizes.py

http://unladen-swallow.googlecode.com/
Python | 27 lines | 19 code | 7 blank | 1 comment | 1 complexity | 1fec272c7072359b2f98f5e0a9b26c0a MD5 | raw file
 1# Test specifically-sized containers.
 2
 3import unittest
 4from ctypes import *
 5
 6class SizesTestCase(unittest.TestCase):
 7    def test_8(self):
 8        self.failUnlessEqual(1, sizeof(c_int8))
 9        self.failUnlessEqual(1, sizeof(c_uint8))
10
11    def test_16(self):
12        self.failUnlessEqual(2, sizeof(c_int16))
13        self.failUnlessEqual(2, sizeof(c_uint16))
14
15    def test_32(self):
16        self.failUnlessEqual(4, sizeof(c_int32))
17        self.failUnlessEqual(4, sizeof(c_uint32))
18
19    def test_64(self):
20        self.failUnlessEqual(8, sizeof(c_int64))
21        self.failUnlessEqual(8, sizeof(c_uint64))
22
23    def test_size_t(self):
24        self.failUnlessEqual(sizeof(c_void_p), sizeof(c_size_t))
25
26if __name__ == "__main__":
27    unittest.main()