def encode_section(self, elf): """ Generate the contents of the notes section. """ note = section.UnpreparedElfNote(elffile=elf, name='elfweaver.notes') note.note_name = "Memstats Details" note.note_type = 1 encoded = self.encode() note._desc_data = ByteArray.ByteArray(encoded) return note
def test_get_data(self): a = ByteArray("12345678qwerty") # Note: There should be more extensive testing of the return # value. a.get_data(0, 8, '<')
def test_array_set_data(self): b = ByteArray() for bytes, fmt in [(1, "B"), (2, "H"), (4, "L"), (8, "Q")]: b.set_data(0, 10, bytes, '<') self.assertEqual(len(b), bytes) self.assertEqual(struct.unpack("<" + fmt, b)[0], 10)
def test_copy(self): a = ByteArray("12345678qwerty") b = a.copy() self.assertEqual(a, b) b[0] = 7 self.assertNotEqual(a, b)
def test_init_data(self): ByteArray("foo")
def test_init(self): ByteArray()