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