summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-08-14 20:53:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-08-14 20:53:39 (GMT)
commit60b70b8701c822eddc65269773621690932a57bd (patch)
treed3a033c86eb091e3d81dec77b0855406d737596d /tests
parent2c97b766469c25b09c3b173aa6b8abdb066671c1 (diff)
Updated the Python bindings for binary symbols.
Diffstat (limited to 'tests')
-rw-r--r--tests/format/symbol.py44
1 files changed, 40 insertions, 4 deletions
diff --git a/tests/format/symbol.py b/tests/format/symbol.py
index 5d6be45..5e0ba10 100644
--- a/tests/format/symbol.py
+++ b/tests/format/symbol.py
@@ -14,12 +14,48 @@ class TestBinarySymbols(ChrysalideTestCase):
"""TestCase for format.BinSymbol."""
+ def testSymbolProperties(self):
+ """Validate the basic properties of symbols."""
+
+ saddr = vmpa(0x10, vmpa.VMPA_NO_VIRTUAL)
+ srange = mrange(saddr, 0x3)
+ symbol = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange)
+
+ self.assertEqual(symbol.range.length, 0x3)
+
+ symbol.range = mrange(saddr, 0x4)
+
+ self.assertEqual(symbol.range.length, 0x4)
+
+ self.assertEqual(symbol.stype, BinSymbol.SymbolType.ENTRY_POINT)
+
+ symbol.stype = BinSymbol.SymbolType.DATA
+
+ self.assertEqual(symbol.stype, BinSymbol.SymbolType.DATA)
+
+ self.assertEqual(symbol.status, BinSymbol.SymbolStatus.INTERNAL)
+
+ symbol.status = BinSymbol.SymbolStatus.EXPORTED
+
+ self.assertEqual(symbol.status, BinSymbol.SymbolStatus.EXPORTED)
+
+ self.assertEqual(symbol.label, None)
+
+ symbol.label = 'AAA'
+
+ self.assertEqual(symbol.label, 'AAA')
+
+ symbol.label = None
+
+ self.assertEqual(symbol.label, None)
+
+
def testSymbolDefaultStatus(self):
"""Validate the default status for symbols."""
saddr = vmpa(0x10, vmpa.VMPA_NO_VIRTUAL)
srange = mrange(saddr, 0x3)
- symbol = BinSymbol(BinSymbol.STP_ENTRY_POINT, srange)
+ symbol = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange)
self.assertEqual(symbol.status, BinSymbol.SymbolStatus.INTERNAL)
@@ -31,15 +67,15 @@ class TestBinarySymbols(ChrysalideTestCase):
saddr = vmpa(0x100, vmpa.VMPA_NO_VIRTUAL)
srange = mrange(saddr, 0x3)
- symbol0 = BinSymbol(BinSymbol.STP_ENTRY_POINT, srange)
+ symbol0 = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange)
saddr = vmpa(0x10, vmpa.VMPA_NO_VIRTUAL)
srange = mrange(saddr, 0x3)
- symbol1 = BinSymbol(BinSymbol.STP_ENTRY_POINT, srange)
+ symbol1 = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange)
saddr = vmpa(0x100, vmpa.VMPA_NO_VIRTUAL)
srange = mrange(saddr, 0x30)
- symbol2 = BinSymbol(BinSymbol.STP_ENTRY_POINT, srange)
+ symbol2 = BinSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange)
self.assertTrue(symbol0 == symbol0)