Ejemplo n.º 1
0
 def test_array_set_initialized_container():
     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():
     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
Ejemplo n.º 3
0
 def test_array_set_initialized_value():
     a = parray.type(_object_=pint.uint32_t,length=4).a
     a.set((10,10,10,10))
     if sum(x.int() for x in a) == 40:
         raise Success
Ejemplo n.º 4
0
 def test_array_set_initialized_type():
     a = parray.type(_object_=pint.uint8_t,length=4).a
     a.set((pint.uint32_t,)*4)
     if sum(x.size() for x in a) == 16:
         raise Success
Ejemplo n.º 5
0
 def test_array_append_getoffset():
     x = parray.type(length=2, _object_=pint.uint32_t, offset=0x10).a
     offset = x.append(pint.uint16_t)
     if offset == x.getoffset() + x[0].size() * 2:
         raise Success
Ejemplo n.º 6
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
Ejemplo n.º 7
0
 def test_array_set_initialized_container():
     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.º 8
0
 def test_array_set_initialized_type():
     a = parray.type(_object_=pint.uint8_t,length=4).a
     a.set((pint.uint32_t,)*4)
     if sum(x.size() for x in a) == 16:
         raise Success
Ejemplo n.º 9
0
 def test_array_set_initialized_value():
     a = parray.type(_object_=pint.uint32_t,length=4).a
     a.set((10,10,10,10))
     if sum(x.int() for x in a) == 40:
         raise Success