コード例 #1
0
ファイル: test_image.py プロジェクト: guillermoarb/objutils
def test_read_write_string_length():
    img = Image(Section(data=bytearray(32), start_address=0x1000))
    img.write_string(0x1000, 'hello world!!!')
    assert img.read_string(0x1000, length=5) == "hello"
コード例 #2
0
ファイル: test_image.py プロジェクト: guillermoarb/objutils
def test_read_unterminated_string_raises():
    img = Image(Section(data=bytearray(b"\x0a" * 32), start_address=0x1000))
    img.write(0x1000, b'hello')
    with pytest.raises(TypeError):
        data = img.read_string(0x1000)
コード例 #3
0
ファイル: test_image.py プロジェクト: guillermoarb/objutils
def test_read_write_string():
    img = Image(Section(data=bytearray(32), start_address=0x1000))
    img.write_string(0x1000, 'hello')
    assert img.read_string(0x1000) == "hello"