From 6433f2aa7552b43b3d0d753f0d525e2040a5b922 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 11 Dec 2024 08:37:50 +0100 Subject: Move some tests. --- tests/arch/immediate.py | 62 ---------------------------------------- tests/arch/operands/immediate.py | 62 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 tests/arch/immediate.py create mode 100644 tests/arch/operands/immediate.py diff --git a/tests/arch/immediate.py b/tests/arch/immediate.py deleted file mode 100644 index 74b8069..0000000 --- a/tests/arch/immediate.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/python3-dbg -# -*- coding: utf-8 -*- - - -import pychrysalide -from chrysacase import ChrysalideTestCase -from pychrysalide import arch -from pychrysalide.arch import ImmOperand - - - -class TestImmediate(ChrysalideTestCase): - """TestCase for arch.ImmOperand.""" - - - def validateValue(self, value, size, padding, strings): - """Check all kinds of things with a given immediate operand.""" - - display = [ - ImmOperand.IOD_BIN, ImmOperand.IOD_OCT, - ImmOperand.IOD_DEC, - ImmOperand.IOD_HEX - ] - - for d in display: - - op = ImmOperand(size, value) - - self.assertTrue(op.size == size) - self.assertTrue(op.value == value) - - op.padding = padding - op.display = d - - string = op.to_string() - self.assertEqual(string, strings[d]) - - - def testByteOne(self): - """Run sanity checks on immediate operand with value 1.""" - - strings = { - ImmOperand.IOD_BIN: 'b1', - ImmOperand.IOD_OCT: '01', - ImmOperand.IOD_DEC: '1', - ImmOperand.IOD_HEX: '0x1' - } - - self.validateValue(1, arch.MDS_8_BITS_UNSIGNED, False, strings) - - - def testByteOnePadded(self): - """Run sanity checks on immediate operand with padded value 1.""" - - strings = { - ImmOperand.IOD_BIN: 'b00000001', - ImmOperand.IOD_OCT: '01', - ImmOperand.IOD_DEC: '1', - ImmOperand.IOD_HEX: '0x01' - } - - self.validateValue(1, arch.MDS_8_BITS_UNSIGNED, True, strings) diff --git a/tests/arch/operands/immediate.py b/tests/arch/operands/immediate.py new file mode 100644 index 0000000..74b8069 --- /dev/null +++ b/tests/arch/operands/immediate.py @@ -0,0 +1,62 @@ +#!/usr/bin/python3-dbg +# -*- coding: utf-8 -*- + + +import pychrysalide +from chrysacase import ChrysalideTestCase +from pychrysalide import arch +from pychrysalide.arch import ImmOperand + + + +class TestImmediate(ChrysalideTestCase): + """TestCase for arch.ImmOperand.""" + + + def validateValue(self, value, size, padding, strings): + """Check all kinds of things with a given immediate operand.""" + + display = [ + ImmOperand.IOD_BIN, ImmOperand.IOD_OCT, + ImmOperand.IOD_DEC, + ImmOperand.IOD_HEX + ] + + for d in display: + + op = ImmOperand(size, value) + + self.assertTrue(op.size == size) + self.assertTrue(op.value == value) + + op.padding = padding + op.display = d + + string = op.to_string() + self.assertEqual(string, strings[d]) + + + def testByteOne(self): + """Run sanity checks on immediate operand with value 1.""" + + strings = { + ImmOperand.IOD_BIN: 'b1', + ImmOperand.IOD_OCT: '01', + ImmOperand.IOD_DEC: '1', + ImmOperand.IOD_HEX: '0x1' + } + + self.validateValue(1, arch.MDS_8_BITS_UNSIGNED, False, strings) + + + def testByteOnePadded(self): + """Run sanity checks on immediate operand with padded value 1.""" + + strings = { + ImmOperand.IOD_BIN: 'b00000001', + ImmOperand.IOD_OCT: '01', + ImmOperand.IOD_DEC: '1', + ImmOperand.IOD_HEX: '0x01' + } + + self.validateValue(1, arch.MDS_8_BITS_UNSIGNED, True, strings) -- cgit v0.11.2-87-g4458