Esempio n. 1
0
 def test_badinfo(self, _offset, size, flags, filename):
     data = bytearray(struct.pack('>LLL', _offset, size, flags) + filename.encode('ascii') + b'\x00')
     i = MarInfo.from_bytes(bytearray(data))
     self.assertEquals(i._offset, _offset)
     self.assertEquals(i.size, size)
     self.assertEquals(i.flags, flags)
     self.assertEquals(i.name, filename)
Esempio n. 2
0
 def test_badinfo(self, _offset, size, flags, filename):
     data = bytearray(
         struct.pack('>LLL', _offset, size, flags) +
         filename.encode('ascii') + b'\x00')
     i = MarInfo.from_bytes(bytearray(data))
     self.assertEquals(i._offset, _offset)
     self.assertEquals(i.size, size)
     self.assertEquals(i.flags, flags)
     self.assertEquals(i.name, filename)
Esempio n. 3
0
 def test_goodinfo(self):
     i = MarInfo.from_bytes(
         bytearray(
             b'\x00\x00\x12\x34\x00\x00\x56\x78\x00\x00\x00\x00filename\x00'
         ))
     self.assertEquals(i._offset, 0x1234)
     self.assertEquals(i.size, 0x5678)
     self.assertEquals(i.flags, 0)
     self.assertEquals(i.name, 'filename')
Esempio n. 4
0
 def test_goodinfo(self):
     i = MarInfo.from_bytes(bytearray(b'\x00\x00\x12\x34\x00\x00\x56\x78\x00\x00\x00\x00filename\x00'))
     self.assertEquals(i._offset, 0x1234)
     self.assertEquals(i.size, 0x5678)
     self.assertEquals(i.flags, 0)
     self.assertEquals(i.name, 'filename')