예제 #1
0
파일: pint.py 프로젝트: arizvisa/syringe
 def test_int_littleendian_int32_unsigned_lowedge_load():
     pint.setbyteorder(config.byteorder.littleendian)
     s = '\x00\x00\x00\x00'
     a = pint.int32_t(source=provider.string(s)).l
     b, = struct.unpack('i',s)
     if a.int() == b and a.serialize() == s:
         raise Success
     print b, a, a.serialize().encode('hex')
예제 #2
0
 def test_int_littleendian_int32_unsigned_load():
     pint.setbyteorder(config.byteorder.littleendian)
     s = b'\x00\x00\x00\x80'
     a = pint.int32_t(source=provider.bytes(s)).l
     b, = struct.unpack('i',s)
     if a.int() == b and a.serialize() == s:
         raise Success
     print(b, a, tohex(a.serialize()))
예제 #3
0
파일: pstruct.py 프로젝트: arizvisa/syringe
 def test_structure_alloc_dynamic_instance():
     class st(pstruct.type):
         def __b(self):
             return ptype.clone(pint.int_t, length=self['a'].li.int())
         _fields_ = [
             (pint.int_t, 'a'),
             (__b, 'b'),
         ]
     a = st().alloc(a=pint.int32_t().set(4))
     if a['b'].size() == a['a'].int():
         raise Success
예제 #4
0
 def test_structure_alloc_dynamic_instance():
     class st(pstruct.type):
         def __b(self):
             return ptype.clone(pint.int_t, length=self['a'].li.int())
         _fields_ = [
             (pint.int_t, 'a'),
             (__b, 'b'),
         ]
     a = st().alloc(a=pint.int32_t().set(4))
     if a['b'].size() == a['a'].int():
         raise Success