summaryrefslogtreecommitdiff
path: root/tests/analysis/contents
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-04 18:50:07 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-04 18:50:07 (GMT)
commitb9fe3a839e9212b809d64c11bf92b703adb18fb2 (patch)
tree86a1c42f305265372bb4d697dad9c99f2ea3715a /tests/analysis/contents
parent0b2cada60941d109bde2f54a198f4c3a799e0606 (diff)
Updated the test suite for the current API.
Diffstat (limited to 'tests/analysis/contents')
-rw-r--r--tests/analysis/contents/endian.py25
-rw-r--r--tests/analysis/contents/memory.py7
-rw-r--r--tests/analysis/contents/restricted.py21
3 files changed, 28 insertions, 25 deletions
diff --git a/tests/analysis/contents/endian.py b/tests/analysis/contents/endian.py
index 209600a..77ed77a 100644
--- a/tests/analysis/contents/endian.py
+++ b/tests/analysis/contents/endian.py
@@ -6,6 +6,7 @@
from chrysacase import ChrysalideTestCase
+from pychrysalide import arch
from pychrysalide.analysis.contents import FileContent, RestrictedContent
from pychrysalide.arch import vmpa
import tempfile
@@ -54,36 +55,36 @@ class TestEndianness(ChrysalideTestCase):
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u16(start, vmpa.SRE_LITTLE_WORD)
+ val = fcnt.read_u16(start, arch.SRE_LITTLE_WORD)
self.assertEqual(val, 0x1516)
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u16(start, vmpa.SRE_BIG_WORD)
+ val = fcnt.read_u16(start, arch.SRE_BIG_WORD)
self.assertEqual(val, 0x1615)
# 32 bits
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u32(start, vmpa.SRE_LITTLE_WORD)
+ val = fcnt.read_u32(start, arch.SRE_LITTLE_WORD)
self.assertEqual(val, 0x17181516)
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u32(start, vmpa.SRE_BIG_WORD)
+ val = fcnt.read_u32(start, arch.SRE_BIG_WORD)
self.assertEqual(val, 0x16151817)
# 64 bits
start = vmpa(0, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u64(start, vmpa.SRE_LITTLE_WORD)
+ val = fcnt.read_u64(start, arch.SRE_LITTLE_WORD)
self.assertEqual(val, 0x0708050603040102)
start = vmpa(0, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u64(start, vmpa.SRE_BIG_WORD)
+ val = fcnt.read_u64(start, arch.SRE_BIG_WORD)
self.assertEqual(val, 0x0201040306050807)
@@ -96,34 +97,34 @@ class TestEndianness(ChrysalideTestCase):
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u16(start, vmpa.SRE_LITTLE)
+ val = fcnt.read_u16(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x1615)
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u16(start, vmpa.SRE_BIG)
+ val = fcnt.read_u16(start, arch.SRE_BIG)
self.assertEqual(val, 0x1516)
# 32 bits
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u32(start, vmpa.SRE_LITTLE)
+ val = fcnt.read_u32(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x18171615)
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u32(start, vmpa.SRE_BIG)
+ val = fcnt.read_u32(start, arch.SRE_BIG)
self.assertEqual(val, 0x15161718)
# 64 bits
start = vmpa(0, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u64(start, vmpa.SRE_LITTLE)
+ val = fcnt.read_u64(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x0807060504030201)
start = vmpa(0, vmpa.VMPA_NO_VIRTUAL)
- val = fcnt.read_u64(start, vmpa.SRE_BIG)
+ val = fcnt.read_u64(start, arch.SRE_BIG)
self.assertEqual(val, 0x0102030405060708)
diff --git a/tests/analysis/contents/memory.py b/tests/analysis/contents/memory.py
index e8ba6b5..55ce035 100644
--- a/tests/analysis/contents/memory.py
+++ b/tests/analysis/contents/memory.py
@@ -7,6 +7,7 @@
from chrysacase import ChrysalideTestCase
+from pychrysalide import arch
from pychrysalide.analysis.contents import MemoryContent
from pychrysalide.arch import vmpa, mrange
@@ -38,12 +39,12 @@ class TestMemoryContent(ChrysalideTestCase):
start = vmpa(14, vmpa.VMPA_NO_VIRTUAL)
- val = cnt.read_u16(start, vmpa.SRE_LITTLE)
+ val = cnt.read_u16(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x1817)
start = vmpa(10, vmpa.VMPA_NO_VIRTUAL)
- val = cnt.read_u32(start, vmpa.SRE_LITTLE)
+ val = cnt.read_u32(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x16150013)
@@ -62,4 +63,4 @@ class TestMemoryContent(ChrysalideTestCase):
with self.assertRaisesRegex(Exception, 'Invalid read access.'):
start = vmpa(0, vmpa.VMPA_NO_VIRTUAL)
- val = cnt.read_u16(start, vmpa.SRE_LITTLE)
+ val = cnt.read_u16(start, arch.SRE_LITTLE)
diff --git a/tests/analysis/contents/restricted.py b/tests/analysis/contents/restricted.py
index 6484299..08aa968 100644
--- a/tests/analysis/contents/restricted.py
+++ b/tests/analysis/contents/restricted.py
@@ -7,6 +7,7 @@
from chrysacase import ChrysalideTestCase
+from pychrysalide import arch
from pychrysalide.analysis.contents import FileContent, RestrictedContent
from pychrysalide.arch import vmpa, mrange
import tempfile
@@ -63,10 +64,10 @@ class TestRestrictedContent(ChrysalideTestCase):
val = rcnt.read_u8(start)
self.assertEqual(val, 0x16)
- val = rcnt.read_u16(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u16(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x1817)
- val = rcnt.read_u32(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u32(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x24232221)
@@ -110,15 +111,15 @@ class TestRestrictedContent(ChrysalideTestCase):
self.assertEqual(val, 0x15)
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = rcnt.read_u16(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u16(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x1615)
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = rcnt.read_u32(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u32(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x18171615)
start = vmpa(12, vmpa.VMPA_NO_VIRTUAL)
- val = rcnt.read_u64(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u64(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x2423222118171615)
start = vmpa(23, vmpa.VMPA_NO_VIRTUAL)
@@ -126,15 +127,15 @@ class TestRestrictedContent(ChrysalideTestCase):
self.assertEqual(val, 0x28)
start = vmpa(22, vmpa.VMPA_NO_VIRTUAL)
- val = rcnt.read_u16(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u16(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x2827)
start = vmpa(20, vmpa.VMPA_NO_VIRTUAL)
- val = rcnt.read_u32(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u32(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x28272625)
start = vmpa(16, vmpa.VMPA_NO_VIRTUAL)
- val = rcnt.read_u64(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u64(start, arch.SRE_LITTLE)
self.assertEqual(val, 0x2827262524232221)
@@ -201,9 +202,9 @@ class TestRestrictedContent(ChrysalideTestCase):
with self.assertRaisesRegex(Exception, 'Invalid read access.'):
start = vmpa(11, vmpa.VMPA_NO_VIRTUAL)
- val = rcnt.read_u16(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u16(start, arch.SRE_LITTLE)
with self.assertRaisesRegex(Exception, 'Invalid read access.'):
start = vmpa(23, vmpa.VMPA_NO_VIRTUAL)
- val = rcnt.read_u16(start, vmpa.SRE_LITTLE)
+ val = rcnt.read_u16(start, arch.SRE_LITTLE)