Esempio n. 1
0
 def test_array_set_initialized_container():
     import pint,ptype
     b = ptype.clone(parray.type,_object_=pint.uint8_t,length=4)
     a = parray.type(_object_=pint.uint8_t,length=4).a
     a.set((b,)*4)
     if sum(x.size() for x in a) == 16:
         raise Success
Esempio n. 2
0
 def test_array_set_initialized_instance():
     import pint,ptype
     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
Esempio n. 3
0
 def test_array_set_initialized_instance():
     import pint, ptype
     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
Esempio n. 4
0
 def test_array_set_initialized_container():
     import pint, ptype
     b = ptype.clone(parray.type, _object_=pint.uint8_t, length=4)
     a = parray.type(_object_=pint.uint8_t, length=4).a
     a.set((b, ) * 4)
     if sum(x.size() for x in a) == 16:
         raise Success
Esempio n. 5
0
 def __b(self):
     return ptype.clone(pint.int_t, length=self['a'].li.int())
Esempio n. 6
0
 def _object_(self):
     length = 0 if len(self.value) == 0 else (self.value[-1].length+1)%4
     return ptype.clone(pint.uint_t,length=length)
Esempio n. 7
0
 def _object_(self):
     length = 0 if len(
         self.value) == 0 else (self.value[-1].length + 1) % 4
     return ptype.clone(pint.uint_t, length=length)
Esempio n. 8
0
 class st1(pstruct.type):
     _fields_ = [
         (pint.int8_t, 'a'),
         (lambda s: ptype.clone(pint.int_t, length=s['a'].li.int()),
          'b')
     ]
Esempio n. 9
0
 def __b(self):
     return ptype.clone(pint.int_t, length=self['a'].li.int())