summaryrefslogtreecommitdiff
path: root/tests/arch
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arch')
-rwxr-xr-xtests/arch/vmpa.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/arch/vmpa.py b/tests/arch/vmpa.py
new file mode 100755
index 0000000..9814b20
--- /dev/null
+++ b/tests/arch/vmpa.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python3-dbg
+# -*- coding: utf-8 -*-
+
+import pychrysalide
+from pychrysalide.arch import vmpa
+from test import TestSuite
+
+
+########################
+
+TestSuite.print_sep()
+
+addr = vmpa()
+
+print('repr():', repr(addr))
+print('str(): ', str(addr))
+
+########################
+
+TestSuite.print_sep()
+
+TestSuite.check_true('Create a virtual memory or physical address', lambda: vmpa())
+
+v = vmpa()
+
+TestSuite.check_true('VMPA values are left uninitialized by default', lambda: v.phy == None and v.virt == None)
+
+a = vmpa(0, 0) + 1
+
+b = 1 + vmpa(0, 0)
+
+TestSuite.check_true('Verify the commutative property of addition', lambda: a == b)