def testCreateNamedStruct(self): ty = Type.create_named_structure(self.global_context, "mystruct") self.assertEqual('mystruct', ty.struct_name()) el = Type.int8() ty.set_body([el, el], True) self.assertEqual(2, ty.num_elements()) self.assertTrue(ty.is_packed())
def testCreateNamedStructInMod(self): ctx = Context() mod = Module.CreateWithName('mod', ctx) ty = Type.create_named_structure(mod.context, 'mystruct') el = Type.int8(context=mod.context) ty.set_body([el, el], True) t = mod.get_type('mystruct') self.assertEqual(ty, t)