Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_array(self):
self.assertEqual(parse_type_name('int []'),
ArrayTypeName(BasicTypeName('int'), None))
self.assertEqual(parse_type_name('int [2]'),
ArrayTypeName(BasicTypeName('int'), 2))
self.assertEqual(parse_type_name('int [0x10]'),
ArrayTypeName(BasicTypeName('int'), 16))
self.assertEqual(parse_type_name('int [010]'),
ArrayTypeName(BasicTypeName('int'), 8))
self.assertEqual(parse_type_name('int [2][3]'),
ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2))
self.assertEqual(parse_type_name('int [2][3][4]'),
ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2))
def test_array(self):
self.assertEqual(parse_type_name('int []'),
ArrayTypeName(BasicTypeName('int'), None))
self.assertEqual(parse_type_name('int [2]'),
ArrayTypeName(BasicTypeName('int'), 2))
self.assertEqual(parse_type_name('int [0x10]'),
ArrayTypeName(BasicTypeName('int'), 16))
self.assertEqual(parse_type_name('int [010]'),
ArrayTypeName(BasicTypeName('int'), 8))
self.assertEqual(parse_type_name('int [2][3]'),
ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2))
self.assertEqual(parse_type_name('int [2][3][4]'),
ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2))
def test_array_of_pointers(self):
self.assertEqual(str(ArrayTypeName(ArrayTypeName(PointerTypeName(BasicTypeName('int')), 3), 2)),
'int *[2][3]')
def test_pointer_to_pointer_to_array(self):
self.assertEqual(parse_type_name('int (**)[2]'),
PointerTypeName(PointerTypeName(ArrayTypeName(BasicTypeName('int'), 2))))
def test_array(self):
self.assertEqual(parse_type_name('int []'),
ArrayTypeName(BasicTypeName('int'), None))
self.assertEqual(parse_type_name('int [2]'),
ArrayTypeName(BasicTypeName('int'), 2))
self.assertEqual(parse_type_name('int [0x10]'),
ArrayTypeName(BasicTypeName('int'), 16))
self.assertEqual(parse_type_name('int [010]'),
ArrayTypeName(BasicTypeName('int'), 8))
self.assertEqual(parse_type_name('int [2][3]'),
ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2))
self.assertEqual(parse_type_name('int [2][3][4]'),
ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2))
def test_array(self):
self.assertEqual(str(ArrayTypeName(BasicTypeName('int'), None)),
'int []')
self.assertEqual(str(ArrayTypeName(BasicTypeName('int'), 2)),
'int [2]')
self.assertEqual(str(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2)),
'int [2][3]')
self.assertEqual(str(ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2)),
'int [2][3][4]')
def test_array(self):
self.assertEqual(parse_type_name('int []'),
ArrayTypeName(BasicTypeName('int'), None))
self.assertEqual(parse_type_name('int [2]'),
ArrayTypeName(BasicTypeName('int'), 2))
self.assertEqual(parse_type_name('int [0x10]'),
ArrayTypeName(BasicTypeName('int'), 16))
self.assertEqual(parse_type_name('int [010]'),
ArrayTypeName(BasicTypeName('int'), 8))
self.assertEqual(parse_type_name('int [2][3]'),
ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2))
self.assertEqual(parse_type_name('int [2][3][4]'),
ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2))
def type_name(self) -> ArrayTypeName:
return ArrayTypeName(self.type.type_name(), self.size)