Exemple #1
0
 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('l',s)
     if a.int() == b and a.serialize() == s:
         raise Success
     print b,a, repr(a.serialize())
Exemple #2
0
 def test_structure_alloc_dynamic_instance():
     import pint
     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
Exemple #3
0
    def test_structure_alloc_dynamic_instance():
        import pint

        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