def test_dynamic_pointer_littleendian_64bit_deref(): pint.setbyteorder(config.byteorder.littleendian) t = dynamic.pointer(dynamic.block(4), pint.uint64_t) x = t(source=ptypes.provider.bytes( b'\x08\x00\x00\x00\x00\x00\x00\x00\x41\x41\x41\x41')).l if x.l.d.getoffset() == 8: raise Success
def test_dynamic_pointer_littleendian_deref(): pint.setbyteorder(config.byteorder.littleendian) s = ptypes.provider.bytes(b'\x04\x00\x00\x00\x44\x43\x42\x41') t = dynamic.pointer(dynamic.block(4), pint.uint32_t) x = t(source=s) if x.l.d.getoffset() == 4: raise Success
def test_dynamic_pointer_littleendian_1(): pint.setbyteorder(config.byteorder.littleendian) s = ptypes.provider.bytes(string2) t = dynamic.pointer(dynamic.block(0), pint.uint32_t) x = t(source=s).l if x.d.getoffset() == 0x41424344 and x.serialize() == string2: raise Success
def test_dynamic_pointer_bigendian_deref(): ptype.setbyteorder(config.byteorder.bigendian) s = ptype.provider.string('\x00\x00\x00\x04\x44\x43\x42\x41') t = dynamic.pointer(dynamic.block(4)) x = t(source=s) if x.l.d.getoffset() == 4: raise Success
def test_dynamic_pointer_bigendian(): ptype.setbyteorder(config.byteorder.bigendian) s = ptype.provider.string(string1) p = dynamic.pointer(dynamic.block(0)) x = p(source=s).l if x.d.getoffset() == 0x41424344 and x.serialize() == string1: raise Success
def test_dynamic_pointer_littleendian_deref(): pint.setbyteorder(config.byteorder.littleendian) s = ptype.provider.string('\x04\x00\x00\x00\x44\x43\x42\x41') t = dynamic.pointer(dynamic.block(4), pint.uint32_t) x = t(source=s) if x.l.d.getoffset() == 4: raise Success
def test_dynamic_pointer_littleendian_1(): pint.setbyteorder(config.byteorder.littleendian) s = ptype.provider.string(string2) t = dynamic.pointer(dynamic.block(0), pint.uint32_t) x = t(source=s).l if x.d.getoffset() == 0x41424344 and x.serialize() == string2: raise Success
def test_dynamic_pointer_littleendian_2(): pint.setbyteorder(config.byteorder.littleendian) string = b'\x26\xf8\x1a\x77' s = ptypes.provider.bytes(string) t = dynamic.pointer(dynamic.block(0), pint.uint32_t) x = t(source=s).l if x.d.getoffset() == 0x771af826 and x.serialize() == string: raise Success
def test_dynamic_pointer_littleendian_2(): pint.setbyteorder(config.byteorder.littleendian) string = '\x26\xf8\x1a\x77' s = ptype.provider.string(string) t = dynamic.pointer(dynamic.block(0), pint.uint32_t) x = t(source=s).l if x.d.getoffset() == 0x771af826 and x.serialize() == string: raise Success
class test(dynamic.union): _value_ = dynamic.array(pint.uint8_t, 4) _fields_ = [ (dynamic.block(4), 'block'), (pint.uint32_t, 'int'), ]
def test_dynamic_pointer_littleendian_64bit_deref(): pint.setbyteorder(config.byteorder.littleendian) t = dynamic.pointer(dynamic.block(4), pint.uint64_t) x = t(source=ptype.provider.string('\x08\x00\x00\x00\x00\x00\x00\x00\x41\x41\x41\x41')).l if x.l.d.getoffset() == 8: raise Success