summaryrefslogtreecommitdiff
path: root/tests/arch/errors.py
blob: 9d5e2731da23ff7b039c1bae0d59ac1ba2eef2c5 (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
33
34
35
#!/usr/bin/python3-dbg
# -*- coding: utf-8 -*-


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


from chrysacase import ChrysalideTestCase
from pychrysalide.arch import vmpa
from pychrysalide.arch import ArchProcessor


class TestArchErrors(ChrysalideTestCase):
    """TestCase for arch.ArchProcessor errors."""

    def testBasic(self):
        """Perform some sanity tests on architecture error handling."""

        errlen = 3

        pattern = []

        for i in range(errlen):

            addr = vmpa(vmpa.VMPA_NO_PHYSICAL, 0x100 + i * 0x10)

            pattern.append([ArchProcessor.APE_LABEL, addr, 'random desc #%d' % i])

        proc = ArchProcessor()

        for i in range(errlen):

            proc.add_error(pattern[i][0], pattern[i][1], pattern[i][2])

        self.assertEqual(len(proc.errors), errlen)