예제 #1
0
    def test_structure_alloc_instance():
        class st(pstruct.type):
            _fields_ = [(pint.uint16_t, 'a'), (pint.uint32_t, 'b')]

        a = st().alloc(a=pint.uint32_t().set(0x0d0e0a0d), b=0x0d0e0a0d)
        if a['a'].int() == 0x0d0e0a0d and a['b'].int() == 0x0d0e0a0d:
            raise Success
예제 #2
0
파일: pstruct.py 프로젝트: arizvisa/syringe
 def test_structure_set_initialized_instance():
     class st(pstruct.type):
         _fields_ = [
             (pint.int_t, 'a'),
         ]
     a = st().a.set(a=pint.uint32_t().set(20))
     if a['a'].size() == 4 and a['a'].int() == 20:
         raise Success
예제 #3
0
 def test_structure_set_initialized_instance():
     class st(pstruct.type):
         _fields_ = [
             (pint.int_t, 'a'),
         ]
     a = st().a.set(a=pint.uint32_t().set(20))
     if a['a'].size() == 4 and a['a'].int() == 20:
         raise Success
예제 #4
0
파일: pint.py 프로젝트: arizvisa/syringe
 def test_int_revert_littleendian_uint32_load():
     pint.setbyteorder(config.byteorder.littleendian)
     a = pint.uint32_t(source=provider.string(string2)).l
     if a.int() == 0x0abcdef0 and a.serialize() == string2:
         raise Success
     print a, a.serialize().encode('hex')
예제 #5
0
 def test_int_revert_littleendian_uint32_load():
     pint.setbyteorder(config.byteorder.littleendian)
     a = pint.uint32_t(source=provider.bytes(string2)).l
     if a.int() == 0x0abcdef0 and a.serialize() == string2:
         raise Success
     print(a, tohex(a.serialize()))
예제 #6
0
파일: pstruct.py 프로젝트: arizvisa/syringe
 def test_structure_alloc_instance():
     class st(pstruct.type):
         _fields_ = [(pint.uint16_t,'a'),(pint.uint32_t,'b')]
     a = st().alloc(a=pint.uint32_t().set(0x0d0e0a0d),b=0x0d0e0a0d)
     if a['a'].int() == 0x0d0e0a0d and a['b'].int() == 0x0d0e0a0d:
         raise Success
예제 #7
0
파일: parray.py 프로젝트: arizvisa/syringe
 def test_array_set_initialized_instance():
     b = ptype.clone(parray.type,_object_=pint.uint8_t,length=4)
     a = parray.type(_object_=pint.uint8_t,length=4).a
     a.set(tuple(pint.uint32_t().set(0x40) for x in six.moves.range(4)))
     if sum(x.int() for x in a) == 256:
         raise Success
예제 #8
0
 def test_array_set_initialized_instance():
     b = ptype.clone(parray.type,_object_=pint.uint8_t,length=4)
     a = parray.type(_object_=pint.uint8_t,length=4).a
     a.set(tuple(pint.uint32_t().set(0x40) for x in range(4)))
     if sum(x.int() for x in a) == 256:
         raise Success