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