summaryrefslogtreecommitdiff
path: root/tests/arch
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arch')
-rw-r--r--tests/arch/__init__.py0
-rwxr-xr-xtests/arch/vmpa.py35
2 files changed, 19 insertions, 16 deletions
diff --git a/tests/arch/__init__.py b/tests/arch/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/arch/__init__.py
diff --git a/tests/arch/vmpa.py b/tests/arch/vmpa.py
index 9814b20..def61ea 100755
--- a/tests/arch/vmpa.py
+++ b/tests/arch/vmpa.py
@@ -1,32 +1,35 @@
#!/usr/bin/python3-dbg
# -*- coding: utf-8 -*-
-import pychrysalide
-from pychrysalide.arch import vmpa
-from test import TestSuite
+
+# Tests minimalistes pour valider l'intégration des adresses et espaces mémoire
+# depuis Python.
-########################
+from chrysacase import ChrysalideTestCase
+from pychrysalide.arch import vmpa
-TestSuite.print_sep()
-addr = vmpa()
+class TestVmpa(ChrysalideTestCase):
+ """TestCase for arch.vmpa."""
-print('repr():', repr(addr))
-print('str(): ', str(addr))
+ def testInit(self):
+ """VMPA values are left uninitialized by default."""
-########################
+ v = vmpa()
-TestSuite.print_sep()
+ self.assertIsNone(v.phys)
+ self.assertIsNone(v.virt)
-TestSuite.check_true('Create a virtual memory or physical address', lambda: vmpa())
-v = vmpa()
+ def testAdd(self):
+ """Verify the commutative property of addition."""
-TestSuite.check_true('VMPA values are left uninitialized by default', lambda: v.phy == None and v.virt == None)
+ a = vmpa(0, 0) + 1
-a = vmpa(0, 0) + 1
+ b = 1 + vmpa(0, 0)
-b = 1 + vmpa(0, 0)
+ c = vmpa(1, 1)
-TestSuite.check_true('Verify the commutative property of addition', lambda: a == b)
+ self.assertEqual(a, b)
+ self.assertEqual(a, c)