diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-08-14 19:09:26 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-08-14 19:09:26 (GMT) |
commit | 2c97b766469c25b09c3b173aa6b8abdb066671c1 (patch) | |
tree | 67988f6f796fe16a4f976c8d9702ea03969cc9cf | |
parent | 7cb4e815b691d05d8c0aea9decf56b9dbc41dfa6 (diff) |
Fixed a copy/paste bug.
-rw-r--r-- | plugins/pychrysalide/format/symbol.c | 2 | ||||
-rw-r--r-- | tests/format/symbol.py | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/plugins/pychrysalide/format/symbol.c b/plugins/pychrysalide/format/symbol.c index af03473..932b0fd 100644 --- a/plugins/pychrysalide/format/symbol.c +++ b/plugins/pychrysalide/format/symbol.c @@ -103,7 +103,7 @@ static PyObject *py_binary_symbol_richcompare(PyObject *a, PyObject *b, int op) } sym_a = G_BIN_SYMBOL(pygobject_get(a)); - sym_a = G_BIN_SYMBOL(pygobject_get(b)); + sym_b = G_BIN_SYMBOL(pygobject_get(b)); status = g_binary_symbol_cmp(&sym_a, &sym_b); diff --git a/tests/format/symbol.py b/tests/format/symbol.py index c720256..5d6be45 100644 --- a/tests/format/symbol.py +++ b/tests/format/symbol.py @@ -24,3 +24,27 @@ class TestBinarySymbols(ChrysalideTestCase): self.assertEqual(symbol.status, BinSymbol.SymbolStatus.INTERNAL) self.assertEqual(str(symbol.status), 'SymbolStatus.INTERNAL') + + + def testSymbolComparison(self): + """Compare symbols and check the result.""" + + saddr = vmpa(0x100, vmpa.VMPA_NO_VIRTUAL) + srange = mrange(saddr, 0x3) + symbol0 = BinSymbol(BinSymbol.STP_ENTRY_POINT, srange) + + saddr = vmpa(0x10, vmpa.VMPA_NO_VIRTUAL) + srange = mrange(saddr, 0x3) + symbol1 = BinSymbol(BinSymbol.STP_ENTRY_POINT, srange) + + saddr = vmpa(0x100, vmpa.VMPA_NO_VIRTUAL) + srange = mrange(saddr, 0x30) + symbol2 = BinSymbol(BinSymbol.STP_ENTRY_POINT, srange) + + self.assertTrue(symbol0 == symbol0) + + self.assertTrue(symbol0 > symbol1) + + self.assertTrue(symbol1 < symbol2) + + self.assertTrue(symbol0 == symbol2) |