diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-12-07 20:33:21 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-12-07 20:33:21 (GMT) |
commit | c0af4cc392a246b05d41b7b7c05bbcd8b0cfb39e (patch) | |
tree | 0d645c71c40fc4b625271d0ab1ef8e7ebab04075 /tests | |
parent | a13d12c758184449bf3305785ef33273802a761c (diff) |
Relied on GObject introspection and dynamic gtypes to inherit in Python.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arch/processor.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/arch/processor.py b/tests/arch/processor.py new file mode 100644 index 0000000..5ad6490 --- /dev/null +++ b/tests/arch/processor.py @@ -0,0 +1,52 @@ +#!/usr/bin/python3-dbg +# -*- coding: utf-8 -*- + + +import pychrysalide +from chrysacase import ChrysalideTestCase +from pychrysalide.analysis.contents import MemoryContent +from pychrysalide.arch import ArchProcessor +from pychrysalide.arch import ProcContext +from pychrysalide.arch import vmpa +from pychrysalide.format import FlatFormat + + + +class TestProcessor(ChrysalideTestCase): + """TestCase for arch.ArchProcessor.""" + + + + def testGI(self): + """Validate the GObject introspection.""" + + with self.assertRaises(RuntimeError): + np = ArchProcessor() + + + class NewContext(ProcContext): + pass + + class NewProc(ArchProcessor): + + def _get_context(self): + return NewContext() + + def _disassemble(self, ctx, content, pos, format): + return None + + + np = NewProc() + + data = b'\x01\x02\x03\x04' + cnt = MemoryContent(data) + fmt = FlatFormat(cnt) + + ctx = np.get_context() + self.assertTrue(type(ctx) == NewContext) + + pos = vmpa(0) + + ins = np.disassemble(ctx, cnt, pos, fmt) + + self.assertIsNone(ins) |