Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo n.º 5
0
 def __b(self):
     return ptype.clone(pint.int_t, length=self['a'].li.int())
Ejemplo 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)
Ejemplo 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)
Ejemplo 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')
     ]
Ejemplo n.º 9
0
 def __b(self):
     return ptype.clone(pint.int_t, length=self['a'].li.int())