summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/arch/processor.py52
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)