summaryrefslogtreecommitdiff
path: root/tests/format/flat.py
blob: 4ab5aa229d20cf7b620d13067c16e8922db63974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python3-dbg
# -*- coding: utf-8 -*-


# Tests minimalistes pour valider la gestion des erreurs relevées.


from chrysacase import ChrysalideTestCase
from pychrysalide.analysis import LoadedBinary
from pychrysalide.analysis.contents import MemoryContent
from pychrysalide.format import FlatFormat


class TestFlatFormat(ChrysalideTestCase):
    """TestCase for format.FlatFormat."""


    def testSimpleFlatFormatContent(self):
        """Load a simple content for a flat format."""

        data  = b'\x00\x00\x00\xef'

        cnt = MemoryContent(data)

        fmt = FlatFormat(cnt)
        fmt.set_machine('armv7')

        binary = LoadedBinary(fmt)

        binary.analyze_and_wait()

        self.assertTrue(list(binary.processor.instrs)[0].keyword == 'svc')