From 2c97b766469c25b09c3b173aa6b8abdb066671c1 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 14 Aug 2019 21:09:26 +0200 Subject: Fixed a copy/paste bug. --- plugins/pychrysalide/format/symbol.c | 2 +- tests/format/symbol.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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) -- cgit v0.11.2-87-g4458