Home | History | Annotate | Download | only in test
      1 # Test specifically-sized containers.
      2 
      3 from ctypes import *
      4 
      5 import sys
      6 import unittest
      7 
      8 
      9 class SizesTestCase(unittest.TestCase):
     10     def test_8(self):
     11         self.assertEqual(1, sizeof(c_int8))
     12         self.assertEqual(1, sizeof(c_uint8))
     13 
     14     def test_16(self):
     15         self.assertEqual(2, sizeof(c_int16))
     16         self.assertEqual(2, sizeof(c_uint16))
     17 
     18     def test_32(self):
     19         self.assertEqual(4, sizeof(c_int32))
     20         self.assertEqual(4, sizeof(c_uint32))
     21 
     22     def test_64(self):
     23         self.assertEqual(8, sizeof(c_int64))
     24         self.assertEqual(8, sizeof(c_uint64))
     25 
     26     def test_size_t(self):
     27         self.assertEqual(sizeof(c_void_p), sizeof(c_size_t))
     28 
     29     def test_ssize_t(self):
     30         self.assertEqual(sizeof(c_void_p), sizeof(c_ssize_t))
     31 
     32 
     33 if __name__ == "__main__":
     34     unittest.main()
     35